Mounting an ISO image on Solaris

No doubt you’ve had experience with this under Linux (mount -o loop /root/animage.iso /mnt) or Windows (using Daemon Tools), but I had a need to do this under Solaris. Fortunately, it is a rather simple process using a relatively unknown command: lofiadm. (loopback file admin)
lofiadm is a Solaris tool which can be used to map a file to a block device id. With that, you can then use the mount command to mount that block device id to a directory.

Now, you can do this in two steps:

# lofiadm -a /export/temp/software.iso /dev/lofi/1

# mount -F hsfs -o ro /dev/lofi/1 /mnt

But that requires some cleanup afterwards (rm /dev/lofi/1) otherwise, over time, you end up with a bunch of mapped block devices pointing to files that are no longer on the system. It is a “best practice” to combine the commands in to a single command:

# mount -F hsfs -o ro `lofiadm -a /export/temp/software.iso` /mnt

Leave a Reply