From owner-freebsd-fs@FreeBSD.ORG Mon Nov 10 11:19:04 2003 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8009316A4CE for ; Mon, 10 Nov 2003 11:19:04 -0800 (PST) Received: from sbcs.cs.sunysb.edu (sbcs.sunysb.edu [130.245.1.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id C620443F93 for ; Mon, 10 Nov 2003 11:19:03 -0800 (PST) (envelope-from abba@cs.sunysb.edu) Received: from compserv2 (compserv2 [130.245.1.58]) by sbcs.cs.sunysb.edu (8.12.3/8.12.3) with ESMTP id hAAJHuLL005524 for ; Mon, 10 Nov 2003 14:17:56 -0500 (EST) Date: Mon, 10 Nov 2003 14:17:58 -0500 (EST) From: Abhishek Rai X-X-Sender: abba@compserv2 To: freebsd-fs@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: question regarding fsid X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Nov 2003 19:19:04 -0000 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