Child pages
  • Fixed drive letters on Windows
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

For our off-site off-line scenario I was planning to reuse a bunch of 1TB 3.5 inch SATA hard disks that previously made up a RAID array in a recently retired server.
To conveniently swap backup disks I've set-up an eSATA dock to the computer that makes backups.
I want to copy all our VMs to a hard disk, and then have someone take that disk home at regular intervals.
I created a single primary partition on each hard disk and formatted it as NTFS.
The batch file I had scripted together seems to work fine. So far so good.
The script uses drive letter W:, and because that does not appear to be consistent for all the drives, the script would only work for one disk.

There is an easy way to have a partition always use the same letter, and that is by manually changing it with diskmgmt.msc.
But I needed all my partitions to show up as the same letter.

After some experiments I found that the assigned drive letter is tied to the Volume id or Volume Serial Number of an NTFS partition.
This is a 32 bit ID that you might have seen before, because it's listed in the output of the dir command:

 Volume in drive C has no label.
 Volume Serial Number is 16D0-F449

 Directory of C:\Users\visser

2011-12-14  11:58    <DIR>          .
2011-12-14  11:58    <DIR>          ..
2011-11-21  11:37    <DIR>          .asdm
2011-05-14  19:12    <DIR>          .GalleryRemote
2011-05-14  19:12    <DIR>          .ssh
2011-10-31  12:54    <DIR>          .thinupload
2011-11-02  09:39    <DIR>          Contacts
2011-12-15  11:39    <DIR>          Desktop
etc etc

Those IDs are automatically generated when the filesystem is created, and the versions of Windows that we use (Windows 7, and Windows Server 2008R2) do not offer a way to change it.
The Sysinternals collection however contains the volumeid.exe tool that does the trick. It can be downloaded for free at

I set the ID to the same value (CAFE-BABE) for all the NTFS partitions on my disks.
After that I used diskmgmt.msc to change the drive letter to W:.

At this moment my Windows system will always use W: for partitions with ID CAFE-BABE.
So it does not matter which of the hard disks I connect to the computer, it will always look like this:

 Volume in drive W is TERENA
 Volume Serial Number is CAFE-BABE

 Directory of W:\

2011-11-30  12:46   999,653,638,144
               1 File(s) 999,653,638,144 bytes
               0 Dir(s)     423,763,968 bytes free

Note that the VolumeID-driveletter mapping is fixed but limited to a specific Windows computer.
So all the CAFE-BABE partitions will likely show up as a different letter on another Windows computer.
But the good thing is that that letter will be the same again for all partitions.

  • No labels