LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   edit volume serial number (VSN) on floppy disk (https://www.linuxquestions.org/questions/linux-hardware-18/edit-volume-serial-number-vsn-on-floppy-disk-340695/)

nvbauer 07-06-2005 02:46 PM

edit volume serial number (VSN) on floppy disk
 
OK, I have Googled till my fingers nearly fell off. I need to change the VSN on a floppy disk (not to be confused with the Volume Label). Does anyone have a clue as to how I can go about this?

Thanks,

Norm

archtoad6 07-08-2005 09:05 AM

Interesting problem, I did some Googling too ...

http://www.pcbuyerbeware.co.uk/Produ...tion.htm#oempa has some interesting background info. 11

If you're willing to use a free ($0) M$ based program, look into VolumeID from SysInternals: http://www.sysinternals.com/Utilities/VolumeId.html
There are several flaws to this:
* No source
* Access to an actual M$ box
* Use dosemu
* Use WINE

However, there is a GNU/Linux solution too. The key is to find out exactly where on the floppy the VSN is stored. I know it's somewhere in the boot record (BR) (the 1st sector), but which of the 512 bytes. I finally found the answer here: http://www.geocities.com/thestarman3/DOS/bd98/SD2.htm, look at the 2nd illustration (http://www.geocities.com/thestarman3...FAT12BRhex.gif). The site has bandwidth limits & sometimes is hard to display; but don't worry, I will duplicate it below.

Here is a list of the tools you will need:
* dd
* hd (hexdump)
* head
* hexedit
* mdir, from mtools -- semi-optional

Overview of the steps in the process:
* Prepare
* Examine
* Verify
* Extract
* Edit
* "Install"
* Verify


Prepare
---------
Read the rest of these instructions.
Install the tools you lack.
RTFM for the ones you are not familiar with.
My apologies if this seems too obvious to mention, I mean no insult.


Examine
---------
Code:

$ dd if=/dev/floppy bs=512 count=1 skip=0  | hd  | head -3
1+0 records in
1+0 records out
512 bytes transferred in 0.875321 seconds (585 bytes/sec)
00000000  eb 3e 90 2a 7a 58 2f 55  49 48 43 00 02 01 01 00  |>.*zX/UIHC.....|
00000010  02 e0 00 40 0b f0 09 00  12 00 02 00 00 00 00 00  |..@...........|
00000020  00 00 00 00 00 00 29 14  23 07 1b 4e 4f 20 4e 41  |......).#..NO NA|

Here is the prize "secret": the VSN is bytes 0000002A - 00000027. Notice that I show the locations backwards, that's because the order in the BR is reversed.

The raw VSN for my target floppy is 14 23 07 1b.


Verify
---------
Code:

$ mdir A:  | head -2
 Volume in drive A has no label
 Volume Serial Number is 1B07-2314

Notice that 1B07-2314 == 14 23 07 1b; except for order, case, & punctuation.


Extract
---------
Code:

$ dd if=/dev/floppy bs=1 count=4 skip=39  | hd
4+0 records in
4+0 records out
4 bytes transferred in 0.792846 seconds (5 bytes/sec)
00000000  14 23 07 1b                                      |.#..|
00000004

$ dd if=/dev/floppy bs=1 count=4 skip=39  > floppy.vsn
4+0 records in
4+0 records out
4 bytes transferred in 0.876638 seconds (5 bytes/sec)

What I did here was narrow the focus of my 'dd' command to just the VSN & put it in a file for editing. The 1st block of code is to verify that my new 'dd' parameters are doing what I intend. Obviously (again, no insult intended) 'floppy.vsn' is an arbitrary filename; you can use anything that makes sense to you.


Edit
---------
Code:

hexedit floppy.vsn
Edit away, here is a condensed view of the hexedit screen:
Code:

00000000  14 23 07 1B                                        .#..
00000010
                [snip/]  # empty rows omitted
00000190
000001A0
---  floppy.vsn      --0x0/0x4------------------------------------------------

The instructions for hexedit, although new to me, are fairly simply -- you shouldn't have any difficulty with this. One warning don't change the length of the file. If your new VSN is longer than the old, you will overwrite important data in the BR of your floppy in the next step.


"Install"
---------
(If someone has a better name for this step, please let me know.)
Code:

$ dd of=/dev/floppy bs=1 count=4 skip=39  < floppy.vsn
This is just the reverse of the Extract step: We output to, instead of input from, the floppy (if => of); & we redirect from (<) instead of into (>) our edit file.


Verify
---------
Code:

$ mdir A:  | head -2
You should now see your new VSN in place.


Warning
---------
All of the code except the last 2 steps was copied from the terminal window(s) where I tested/developed it. I did NOT actually go through with changing the VSN on my target floppy -- it has important data on it & was write protected throughout the process. However, I think I have enough experience with 'dd' to believe that it will work as intended. I suggest you play with this on a "throw-down" floppy, perhaps several times, before you risk an important one. As always, a backup is strongly recommended. Again, as always: "If it breaks, you get to keep the pieces."

Copyright (c) 2005 F. A. Archibald III, All rights reserved

vimico 07-08-2005 05:01 PM

Just for your information:

If you needn't preserve the content of the floppy, you can set the volume-id during formatting using the option -i of mkdosfs .

archtoad6 07-08-2005 06:46 PM

Thanks. I didn't know that. Of course, I assume when someone says "edit" ...

ubuntu-norm 08-01-2005 12:13 PM

Thanks
 
archtoad6

I just wanted to thank you for posting this. It was great. I did try it, though I was insuccessfull at updateing the MBR When I got to

Code:


dd of=/dev/fd0 bs=1 count=4 skip=39 < floppy.vsa


It did not update the VSN in the MBR. That being said, it introduced a lot of new concepts that are just too cool. I again thank you for your time. I am still looking for the right answer and you have lead me down that direction.

Best regards,

Norm

PS: I had to start a new account. I used to be nvbauer and before that Norman-drake9. :)

I am not a :newbie:

archtoad6 08-03-2005 08:04 AM

Damn, right where I didn't dare do a live test.

I assume your floppy wasn't write protected.

Was there any interesting output? or did it just fail the verify step?

ubuntu-norm 08-03-2005 08:18 AM

Quote:

Originally posted by archtoad6
Damn, right where I didn't dare do a live test.

I assume your floppy wasn't write protected.

Was there any interesting output? or did it just fail the verify step?

You are correct. It is not write protected. And it did not give any errors, it just did not work. Acted like it worked, but when I verified it, same old VSN.

archtoad6 08-03-2005 08:38 AM

Any chance of a failure in the edit of "floppy.vsa"?

I notice that you show "floppy.vsa", where I had "floppy.vsn"; any chance the problem is a typo?

ubuntu-norm 08-03-2005 08:48 AM

Quote:

Originally posted by archtoad6
Any chance of a failure in the edit of "floppy.vsa"?

I notice that you show "floppy.vsa", where I had "floppy.vsn"; any chance the problem is a typo?

No, I actualy used just "vsn" as the file. As what to name the file really does not matter, the shorter the better. :)

archtoad6 08-03-2005 09:13 AM

I'm going to a Linux workshop tonight, I'll try to remember to ask there.

ubuntu-norm 08-11-2005 03:19 PM

Interstingly enough. I googled the heck out of this and ran across a nice little utility that is 1. Open Source 2. written in C++ 3. written for MS of alll things. Its called VolumeSerial.exe http://www.codeproject.com/system/change_drive_sn.asp its a great little tutoruial if your into C++ .

It worked like a charm. Except that I still can't fool the application that I was trying to fool, into believeing that it's the real master disk. Which I'm not entirely sure why not yet. I now have a bit by bit duplicate, right down to the VSN.

Something else I dont understand. The master disk in which the license key came on can not even be seen under Windows. Acts as though the floppy has not been formated. How ever I can mount the FS in Linux and everything is there.

Can anyone 'splain that one. And even better how to reair the original disk????

Norm

ubuntu-norm 08-12-2005 07:44 AM

Forgot to mention that I get a Cyclical Redundency Check error in Windows. I did my searching on that as well, so I know what it is, but don't know how to correct it.


All times are GMT -5. The time now is 02:42 AM.