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 /export/home/techno/sol-10-ccd-GA-x86-iso.iso, a loopback file device (/dev/lofi/1) is created with the following command (note: pathname of the iso should be absolute, but not relative):
Govinda% unzip sol-10*.zip
Archive: sol-10-ccd-GA-x86-iso.zip
inflating: sol-10-ccd-GA-x86-iso.iso
Govinda% su
Password:
# lofiadm -a sol-10-ccd-GA-x86-iso.iso /dev/lofi/1The lofi device creates a block device version of the file:
lofiadm: pathname is not an absolute path -- sol-10-ccd-GA-x86-iso.iso
# lofiadm -a /export/home/techno/sol-10-ccd-GA-x86-iso.iso /dev/lofi/1
# lofiadmAnd then mount the block device on /mnt with the following command:
Block Device File
/dev/lofi/1 /export/home/techno/sol-10-ccd-GA-x86-iso.iso
# mount -F hsfs -o ro /dev/lofi/1 /mnt
Tip:
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` /mntOnce done using the files from CD image, unmount the lofi block device
# ls /mnt
components installer README volstart
# umount /mnt
Finally remove the association of loopback file device as follows:
# lofiadm -d /dev/lofi/1Resource:
# lofiadm
Block Device File
Solaris man page of lofiadm
0 comments:
Post a Comment