What I learned about lofi today
By mgerdts on Dec 01, 2011
As I was digging into some other things today, I realized that lofiadm is not needed in common use cases. As mount(1M) says:
For file system types that support it, a file can be mounted directly as a file system by specifying the full path to the file as the special argument. In such a case, the nosuid option is enforced. If specific file system support for such loopback file mounts is not present, you can still use lofiadm(1M) to mount a file system image. In this case, no special options are enforced.
That is, you can do this:
root@global# lofiadm Block Device File Options root@global# mount -F hsfs `pwd`/sol-10-u9-ga-x86-dvd.iso /mnt root@global# df -h /mnt Filesystem Size Used Available Capacity Mounted on /ws/media/solaris/sol-10-u9-ga-x86-dvd.iso 2.0G 2.0G 0K 100% /mnt root@global# lofiadm Block Device File Options /dev/lofi/1 /ws/media/solaris/sol-10-u9-ga-x86-dvd.iso -
When I unmount it, the lofi device goes away as well.
root@global# umount /mnt root@global# lofiadm Block Device File Options
Note that this was on Solaris 11 - I don't believe that this feature was backported to Solaris 10.