Find it

Thursday, April 22, 2010

Mounting an ISO image on Solaris Systems

Now a days it's not necessary to create CD's for the downloaded ISO images & for cost cutting reasons IT staff does not allow it without manager approval. Instead of burning the image to a CD-ROM to access its contents, it is easy to mount the image directly into the file system with the help of lofiadm and mount commands -

lofiadm administers lofi, the loopback file driver. lofi allows a file to be associated with a block device. That file can then be accessed through the block device. This is useful when the file contains an image of some file system (such as a floppy or CD-ROM image), because the block device can then be used with the normal system utilities for mounting, checking or repairing filesystems.

Given an ISO image in /home/nilesh_rjoshi/sol-10-ccd-GA-SPARC-iso, a loopback file device (/dev/lofi/1) is created with the following command -

# lofiadm -a /home/nilesh_rjoshi/sol-10-ccd-GA-SPARC-iso /dev/lofi/1

The lofi device creates a block device version of the file:


# lofiadm
Block Device File
/dev/lofi/1 /home/nilesh_rjoshi/sol-10-ccd-GA-SPARC-iso

And then mount the block device on /mnt with the following command:

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

All the above commands can be combined into a single command as follows:


# mount -F hsfs -o ro `lofiadm -a /export/home/techno/sol-10-ccd-GA-x86-iso.iso` /mnt

# ls /mnt

components installer README volstart

Once done using the files from CD image, unmount the lofi block device

# umount /mnt

Finally remove the association of loopback file device as follows:

# lofiadm -d /dev/lofi/1

# lofiadm
Block Device File


HTS

4 comments:

  1. Is there some way to mount an iso image locally
    and then share it so another system could NFS
    mount the iso image ?
    Thanks,
    Bill

    ReplyDelete
  2. Hi Bill,

    Try this -

    # mount -r -o loop -t iso9660 /path/to/iso/image/Solarisx86.iso /mnt

    Here is the line from the dfstab file on the same machine:

    /mount/point 192.168.1.0/255.255.255.0(sync,ro,no_root_squash)

    This will work certainly.

    Thank you,
    Nilesh

    ReplyDelete
  3. Even this will also work -

    # mount -o loop,ro /mnt/isos/xyz.iso /mnt

    HTH,
    Nilesh

    ReplyDelete
  4. Thanks Nilesh Joshi....
    Worked for me....
    Really useful...

    ReplyDelete