LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Floppy serial number (https://www.linuxquestions.org/questions/linux-general-1/floppy-serial-number-24621/)

k__ 06-29-2002 04:50 PM

Floppy serial number
 
Does anybody know how to get volume serial number of a floppy disc? I'm writing a C program that is supposed to run under linux and I can't find the proper library... also a linux command will do.

Thx

Excalibur 06-29-2002 10:29 PM

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!


All times are GMT -5. The time now is 12:24 AM.