Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Feb 2006 06:40:41 -0600 (CST)
From:      Sergey Babkin <babkin@verizon.net>
To:        andrew clarke <mail@ozzmosis.com>, freebsd-hackers@freebsd.org
Subject:   Re: volume serial number + volume label
Message-ID:  <2491743.1140698441482.JavaMail.root@vms070.mailsrvcs.net>

next in thread | raw e-mail | index | archive | help
>From: andrew clarke <mail@ozzmosis.com>
>
>How can I programmatically retrieve the "volume serial number" and
>"volume label" of a removable disc in FreeBSD?  This is the same
>information that's presented by issuing a "dir" command in Windows:
>
> Volume in drive D is FooBar
> Volume Serial Number is 58BB-96AA

I've been reading on the Windows filesystems recently,
so here is the quick answer:

The serial number is contained in DOS/Windows
partition's boot block, 8 bytes at offset 0x48.

For the label you have to parse the DOS/Windows
filseystem format. On FAT it's the name of the file
in the root directory with the special attribute
(VOL or LABEL - something like this, can't remember 
now). On NTFS it's stored I think as the attribute
$VOLUME_NAME of the system file $Volume contained in the
inode 3 of the Master File Table.

-SB



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2491743.1140698441482.JavaMail.root>