Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Nov 2003 14:17:58 -0500 (EST)
From:      Abhishek Rai <abba@cs.sunysb.edu>
To:        freebsd-fs@freebsd.org
Subject:   question regarding fsid
Message-ID:  <Pine.GSO.4.53.0311101406250.5667@compserv2>

next in thread | raw e-mail | index | archive | help
hi,
i was trying to understand the nfs server code in freebsd-5.1 when i
stumbled into something strange. These are the filesystem ids that were
revealed by both statfs and dumps of the nfs traffic.

fs: /
fsid[0] = 3f607f14
fsid[1] = 1c47f86e

fs: /tmp
fsid[0] = 3f607f14
fsid[1] = 1b067190

fs: /usr
fsid[0] = 3f607f14
fsid[1] = 6f1b0cb8

fs: /var
fsid[0] = 3f607f14
fsid[1] = c591f34d

All these have identical first four bytes. but differ arbitrarily in the
other 4. So, I looked up file system mounting code in the freebsd5.1
kernel to look for where do fsids come from.
During a disk-based filesystem mounting, the kernel starts by getting the
fsid from the disk. However if the fsid value is
trivial(zero) or there is already a mounted-fs with the same fsid value,
then vfs_getnewfsid() allocates a new fsid. however there are reasons
which tell me that at least in the case i've presented above, the fsid is
NOT coming from vfs_getnewfsid() => it IS coming from the disk.

I looked into the mkfs/newfs code but didn't find anything that sets the
fsid on the disk at the time of fs creation. So who and when puts the fsid
field on the disk ? And how is this fsid value chosen ?

thanks a lot!
abhishek



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.53.0311101406250.5667>