how to get the UFSID of a mounted filesystem ?

Dan Nelson dnelson at allantgroup.com
Mon Nov 30 00:23:48 UTC 2009


In the last episode (Nov 30), Pete French said:
> I observer that when I mount a UFS filesystem using the device name then
> the entry vanishes from /dev/ufsid, and glabel list no longer shows the
> device.  Which begs the question, how do I find out the ufsid of a mountde
> filesystem (e.g.  '/' so that I can change it's fstab entry for the next
> reboot?)
> 
> Am slightly embarassed to have to ask for help! Am sure this was easy and
> in dmesg last time I did this...

Easiest way is to run dumpfs on the device you currently have mounted.  The
fsid will be on the 2nd line of the output:

(root at studio) /root># dumpfs /dev/da2s1a | head -2
magic   19540119 (UFS2) time    Sun Nov 29 18:19:39 2009
superblock location     65536   id      [ 49b21fba 667e8575 ]

Next easiest is to run "mount -v" as root, which will give you the fsid, but
byte-swapped so you have to mess with it to get a value that matches what
glabel expects:

/dev/ufsid/49b21fba667e8575 on /tmp/z (ufs, local, soft-updates, fsid ba1fb24975857e66)

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-stable mailing list