It sounds like you are referring to the FAT file system from DOS. That number I believe is generated when the disk is formatted and it changes when the disk is formatted again. I do not know of a Linux command to do it. Perhaps there is a lib call, you might review some of the source files for the DOS utils in the /sbin directory, like mkdosfs. The man page (man 8 mkdosfs) reports an option for a 32 bit hex number that defaults to the file system creation time.
I would suppose it to be written in the first block of the disk. You could use something like:
dd if=/dev/fd0 of=dosdisk.id count=1
That would read the first block of the disk into the file named dosdisk.id. You could then us "vi" to view the file. The command vi normally points to elvis and it will display the file in a hex style similar to the DOS debug program.
For your program, then create a function that would perform a direct read of the first block into a buffer and parse out the number desired.
Perhaps another LQ viewer will have a more elegant solution.
Good luck!
|