The Solaris Loop-back file system is a handy bit of software, allowing you to "mount" directories, files and, in particular, CD or DVD image files in ISO-9660 format.
To make it more user friendly, build 91 of ONV introduces the ability to the mount command to automatically create the loop-back devices for ISO images! The Changelog for NV 91 has got the following note:
Issues Resolved: PSARC case 2008/290 : lofi mount BUG/RFE:6384817Need persistent lofi based mounts and direct mount(1m) support for lofi
In older releases, it was necessary to run two commands to mount an ISO image file. The first to set up a virtual device for the ISO image:
# lofiadm -a /shared/Downloads/image.iso |
And then to mount it somewhere:
# mount -F hsfs -o ro /dev/lofi/1 /mnt |
Solaris uses hsfs to indicate the "High Sierra File System" driver used to mount ISO-9660 files. Specify "-o ro" to make it Read-only, though that is the default for hsfs file systems, at least lately (I seem to recall that at one point in the past it was mandatory to specify read-only mounting explicitly.
Looking at what has been happening here, we can see the Loop-back device by running lofiadm without any options:
# lofiadm |
And the mounted file system:
# df -k /mnt |
The new feature of the mount command requires a full path to the ISO file (Just like lofiadm does, at any rate it does for now)
# mount -F hsfs -o ro /shared/Downloads/image2.iso /mnt |
To check the status:
# df -k /mnt |
And when we run lofiadm we see it automatically created a new device, /dev/lofi/2:
# lofiadm |
Some of the other uses of the Loop-back file system:
You can mount any directory on any other directory:
# mkdir /mnt1 |
Note the use of lofs as the file system "type". This is a bit like a hard-link to a directory, and it can exist across file systems. These can be read-write or read-only.
You can also mount any individual file onto another file:
# mkdir /tmp/mnt |
The above feature incidentally inspired item nr 10 on my ZFS feature wish list.
This allows for a lot of flexibility. In deed this functionality is central to how file systems and disk space is provisioned in Solaris Zones. If you play around with it you will find plenty of uses for it!
1 comment:
A very nice article.
I make use quit a lot of this lofiadm mounting of ISO files. Everytime I luupgrade, i.e.
This new syntax was not known to me (yet).
Grtz, Dick
Post a Comment