Thursday Dec 01, 2011

What I learned about lofi today

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.

About

I'm a Principal Software Engineer in the Solaris Zones team. In this blog, I'll talk about zones, how they interact with other parts of Solaris, and related topics.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today