Re: How to obtain the FAT serial number form a volume
Re: How to obtain the FAT serial number form a volume
- Subject: Re: How to obtain the FAT serial number form a volume
- From: Mark Day <email@hidden>
- Date: Wed, 29 Feb 2012 09:58:53 -0800
Chris,
Sorry, we don't provide any way to get the volume serial number for a mounted volume.
There are a couple of issues with the method you're using (even for an unmounted volume):
1. The volume serial number is optional. Your command line isn't checking for the presence of the extended boot signature before retrieving the volume serial number.
2. The offset you're using (67) is valid only for FAT32. The volume serial number is at a different offset for FAT12 and FAT16 volumes.
And if you're thinking that the volume serial number can be used as a unique ID, you're going to be disappointed. For pre-formatted media (SD cards, flash drives, etc.), the volume serial number is likely to be the same for all pieces of media from a given manufacturer (probably at least for a single production run, maybe for multiple production runs).
May I ask what you're trying to do with the serial number?
If you *really* need to get it for a mounted volume, and you're willing to put up with the various limitations, and you're willing to use an unsupported technique, you can read from the "raw" device (use "/dev/rdisk" instead of "/dev/disk"; so "/dev/rdisk4s1" in your example). Just beware that relying on this may break at any point, even in a software update.
-Mark
On Feb 28, 2012, at 7:50 PM, Chris Driggett <email@hidden> wrote:
> All,
>
> I would like to retrieve the FAT serial number from a volume mounted on Mac OS X from a C program. Here is how one can do it from the command line.
>
> dd if=/dev/disk4s1 skip=67 bs=1 count=4 | hexdump -v -e '1/1 "X" " "'
>
> I have not found how to do this with the CoreFoundation classes. I also need to find this information out as a regular user not a privileged user or root.
>
> If anybody can point me in the right direction I would appreciate it.
>
> Thanks,
> Chris
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Filesystem-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden