Brett Glass to the Rescue
 Solutions to your toughest technical problems.     http://www.brettglass.com


Links

 Back to the 
"Brett Glass to the Rescue" Index

Back to the
YMMV Home Page
 


Changing a Disk's Volume Serial Number
Q:  I just obtained a new hard drive, and would like to change the volume serial number on one of its partitions to be the same as that of the old drive. Do you know where I might obtain a utility to do this? I've gotten information on the interrupts used to do this but am not enough of a DOS programmer to put them to use. 

Gerald Lightsey 

A: Since many readers might not know what a volume serial number is or why it matters, I'll give some background information first and then describe how to solve your problem. 

The volume serial number was added to the standard format for IBM PC-compatible disks in 1987, when Microsoft and IBM were co-developing OS/2. They wanted the system to operate like the Macintosh, which automatically recognized which diskette (or removable disk cartridge) had been inserted in a drive. 

But there was a problem. Up to that point, the only identifying information on an IBM-compatible disk was its volume label -- a name given to the disk by the user. If the user declined to assign names to disks, or gave more than one disk the same name, there was no way to tell them apart. (I scrambled many a disk in those days when I inserted the wrong one at the wrong moment.) 

So, the two companies decided to change the disk formats for both MS-DOS and OS/2 to include a four-byte number called the "volume serial number." When a disk was formatted, it would be stamped with this number, which was constructed from the exact date and time the format operation was performed. (The odds of two disks getting the same number were virtually nil on the same machine, and were still small even if users exchanged disks with one another.) When a diskette was reproduced by the operating system's disk copying program (DISKCOPY), the program would make a faithful copy of every byte on the entire disk except for the volume serial number, which would be changed to something different than the one on the original diskette. 

This scheme worked well, but it wasn't long before some enterprising software vendors noticed that they could use the volume serial number to enforce a weak form of copy protection. They created programs that simply refused to run if the current disk had a volume serial number that was different from the number of the floppy disk on which the program was shipped -- or the hard disk on which it was first installed. Users who upgraded their systems, or who restored from backups after a disk crashed or was reformatted, found that the software wouldn't work. 

Luckily, no programming is needed to get around these problems. If you just need to make an exact copy of a disk, use a copying program other than the one included with the operating system. Most will gladly make a true copy of a disk -- VSN and all. If you need to change or remove a disk's VSN, use one of the DOS batch files published by Neil Rubenking in PC Magazine's User-to-User column. (Note: I published a similar one in the August 1994 edition of PC World's Star-dot-Star column. But the old Star-dot-Star tips aren't online anymore, and the ones Neil published are every bit as good.) 

There are several caveats about Neil's batch files, though. First, do not attempt to use them on disks or disk partitions which are formatted for the FAT32 file system. Readers report that FAT32 disks are structured differently from those formatted under earlier file systems, and the VSN is in a diferent place. The batch files were written before the FAT32 file system existed and do not take the differences into account. You could seriously damage your disk if you use these batch files on a FAT32 partition! 

Make sure that you boot the machine to DOS -- not Windows -- before running either batch file. (If you're running Windows 95, don't try to use a DOS session or the "Restart the computer in MS-DOS mode" shutdown option. Instead, shut the machine off altogether, do a cold boot, press F8 as soon as the system starts, and select "Command prompt only." This will leave you in "naked" DOS -- the only mode in which you want to do direct disk edits.) As a safety measure, you'll need to edit Neil's batch files -- removing some colons at the beginnings of lines -- before they'll work on hard disks.  Finally, if you have a virus checker on your system, turn it off before attempting to change a VSN. Otherwise, it'll holler. 

P.S. -- As mentioned above, the volume serial number of a disk is not the same as its volume label. The volume label is a short string of text that helps to identify a disk. It can be changed with the MS-DOS "LABEL" command.

 
© 1998 by Brett Glass. All rights reserved.  About us  |  Feedback Trademarks