Different filesystem counts between mount(8) and lsvfs(1)

Aaron LI aly at aaronly.me
Fri Jun 8 08:40:25 PDT 2018


On Fri, 8 Jun 2018 23:29:07 +0800, Aaron LI <aly at aaronly.me> wrote:
>
> For example, on my box (encrypted root and chrooted from initrd):
> -------------------------------------------------------------------
> # mount
> /dev/mapper/root at DATA on / (hammer2, local)
> /dev on /dev (null, local)
> /dev/vbd0s1a on /boot (ufs, local)
> /build/usr.obj on /usr/obj (null)
> /build/var.crash on /var/crash (null)
> /build/var.cache on /var/cache (null)
> /build/var.spool on /var/spool (null)
> /build/var.log on /var/log (null)
> /build/var.tmp on /var/tmp (null)
> procfs on /proc (procfs, local)
> -------------------------------------------------------------------
> # lsvfs
> Filesystem                              Num  Refs  Flags
> -------------------------------- ---------- -----  ---------------
> nfs                              0x00000001     0  network
> msdos                            0x00000002     0  
> cd9660                           0x00000003     0  read-only
> devfs                            0x00000004     2  synthetic
> ufs                              0x00000005     2  
> procfs                           0x00000006     1  synthetic
> hammer                           0x00000007     0  
> tmpfs                            0x00000008     1  
> mfs                              0x00000009     0  
> null                             0x0000000a     7  loopback
> hammer2                          0x0000000b     1
> -------------------------------------------------------------------
> 
> So lsvfs(1) gives: 1 more tmpfs, 1 more ufs, and 2 more devfs.  I observed
> this mismatch sometime before, and discussed with Sascha Wildner.  But we
> can only explain 3 of the 4 more filesystems:
> 
> * 1 tmpfs: mount of the initrd image (it's a memory disk)
> * 1 ufs: the temporary root (UFS) mounted from the initrd image (Sascha
>   already updated the lsvfs.1 man page about this)
> * 1 devfs: the actually devfs is mounted at /dev of the temporary root,
> which is then null-mounted to /new_root/dev, as you can see from mount(8): 
>   "/dev on /dev (null, local)".
> 
> But there still remains 1 mysterious devfs... anyone have more ideas?

Without using initrd, lsvfs(1) will still report *2 devfs*, so this
mysterious devfs reference isn't caused by the initrd and chroot.

In addition, getfsstat(NULL, 0, 0) will report *one less* filesystem count as
lsvfs(1), i.e., getfsstat() returns 13, while lsvfs(1) returns 14 references
in total.  So getfstat() doesn't count the mysterious devfs.


Cheers,
-- 
Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20180608/e626695f/attachment-0002.bin>


More information about the Users mailing list