Pages

Wednesday, November 28, 2012

Mount an ISO image with Solaris

Before you can mount an ISO image with Solaris you need a block device. An ISO image is only a normal file so you need to make it available as a block device. The right tool for this is lofiadm. With lofiadm you can make files available as block devices:

# lofiadm -a /root/sol-10-u10-ga2-sparc-dvd.iso
/dev/lofi/1


The command above attaches the ISO image /root/sol-10-u10-ga2-sparc-dvd.iso to /dev/lofi/1. To view all attached files run lofiadm without any option:

# lofiadm
Block Device             File
/dev/lofi/1              /root/sol-10-u10-ga2-sparc-dvd.iso


If you take a closer at /dev/lofi/1 then you will recognize that it is just a symbolic link pointing to /devices/pseudo/lofi@0:1:

# ls -la /dev/lofi/1
lrwxrwxrwx ... /dev/lofi/1 -> ../../devices/pseudo/lofi@0:1


Now take a look at /devices/pseudo/lofi@0:1:

# ls -la /devices/pseudo/lofi\@0\:1
brw------- ... /devices/pseudo/lofi@0:1


The leading b shows clearly that /devices/pseudo/lofi@0:1 is a block device. The device (symbolic link) /dev/lofi/1 is now ready to mount (use hsfs as file system for mounting ISO images):

# mount -F hsfs /dev/lofi/1 /mnt/
# ls /mnt/
Copyright                         boot
Offer_to_Provide_Source_Code.txt  installer
Solaris_10                        platform


To dettach the ISO image unmount it first:

# umount /mnt

Next detach the ISO image by running lofiadm with the -d option:

# lofiadm -d /dev/lofi/1

Finally check that the ISO image was detached:

# lofiadm
Block Device             File


As you can see mounting ISO images with Solaris is not a too difficult job.