Jump to content

Recommended Posts

Posted

One of the little nuiances you may have experienced after reformatting and using your brand new UA CD is that Windows re-assigns your drive letters if you have multiple drives that have been re-assigned previously. Ive seen a few people ask around lately about how to accomplish this and spent some time looking around myself, until I combined a couple methods to get this working pretty seemlessly and more importantly... easily.

Now first off, lets give credit where credits due, the method Im about to outline is in no way my own, but a combination of a couple methods; the first by mdes who has a pretty nifty script which does this and then some as well as baliktad, which as youll see is where I got most of the process for this.

This is in no way intended to trash on their methods, they simply seemed a bit complex to me and I figured it may to others as well...

So, that said, lets get started...

The Problem

As you see here, I have a few drives, one split into a couple partitions, as well as a couple cd-rom drives. As you can see, my drive letter configuration is obviously not the default...

hardrive2.JPG

Now after a reformat and reinstall of Windows XP, my drive letters are reassigned to the following:

C: stays C:

D: stays D:

P: becomes E:

E: becomes F:

I: becomes G:

J: becomes H:

As you can see, Windows simply assigns the letters in order from 1st logical drive, 1st Partition, all the way down to last drive, last partition and then finally the CD-ROM Drives in order of master to slave.

The Solution

To accomplish what want to do, we're going to use a nifty little Windows tool called DISKPART.

1. Configure you disks how you want them, like I did above using Computer Management. (Reboot)

2. Open a Command Prompt and type 'diskpart'

3. At the 'DISKPART>' prompt, type 'list volume'. This will list the follow information in regards to all of your drives.

diskpart1.JPG

4. Write down each of your drive letters and their corrisponding Volume ###. (IE: My 'C' drive is 'Volume 2').

These volume numbers for each of your drive/partitions do not change after a reformat, so since we know this is how we want our configuration to be after the install, we can use these volume numbers to reference during the re-assigning process.

5. Create a text file with the commands DISKPART uses to reassign drive letters. The following is an example of my text file:

select volume 0
 assign letter=I noerr
select volume 1
 assign letter=J noerr
select volume 4
 assign letter=P noerr
select volume 3
 assign letter=D noerr
select volume 5
 assign letter=E noerr

Obviously, replace the volume number and drive letter with the corrisponding values you wrote down in step 4. (Note: the indents on the 'assign' line is for aesthetics only, its not required you indent any lines) Save the file, you can call it whatever you want.

6. Now we use the following to apply these changes.

DISKPART /s scriptfile.txt

As far as implementation goes, I recommend creating a batch file that CD's to the path where you scriptfile.txt resides then runs this command. The following is an example of the batch file I use:

CMDOW @ /HID
@echo off

for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\WIN51 set CDROM=%%a:

CD /D %CDROM%\Custom\System

DISKPART /s drives.txt

LABEL C: System

EXIT

As you can see, this batch file changes directories to my CDROM\Custom\System folder, which is where my scriptfile (called drives.txt in this example) resides. Ive played around with this alot and got the best results when placing this in my cmdlines.txt as the 1st thing to run.

One last little useful tidbit.. as you probably noticed, there was an additional line in my batch file: "LABEL C: System". The LABEL command is a very simple way to label your drives. In case its not obvious to you, the syntax is

LABEL <driveletter:> <DriveLabel>

Well, that pretty much covers it. A couple other notes... I havent tested this with removable drives plugged in, so I would recommend removing them during your install. Also, keep in mind that your DISKPART values will most likely change if you add/remove disks and/or partitions.

Anyway, again, hope nobody feels as though Im stepping on anyones toes. Like the saying goes, theres more than one way to skin a cat.. heres the method that was the least confusing to me.

Hope this helps and feel free to post any questions / comments!


Posted

When you execute:

select volume 0
assign letter=I noerr
select volume 1
assign letter=J noerr
select volume 4
assign letter=P noerr
select volume 3
assign letter=D noerr
select volume 5
assign letter=E noerr

if the letter I: is already assigned to a partition, the Volume 0 will not be reassigned to I:; that's why, in my MapDrive.cmd, I first deassign some partitions before reassigning them :P

Furthermore, if you put your drives.txt on the CD, you will have to recreate if if you changed the letters assignments :( That's why I prefer to have a CD content independent from the assignments.

Without resentment :)

Posted
When you execute:
select volume 0
assign letter=I noerr
select volume 1
assign letter=J noerr
select volume 4
assign letter=P noerr
select volume 3
assign letter=D noerr
select volume 5
assign letter=E noerr

if the letter I: is already assigned to a partition, the Volume 0 will not be reassigned to I:

You're correct, and normally if DISKPART comes across a drive thats already assigned, it doesnt complete the script and none of your other drives are assigned. Thats what the 'noerr' parameter is for.. if it encounters a drive thats already assigned, it will leave it and move on to the next one.

Furthermore, if you put your drives.txt on the CD, you will have to recreate if if you changed the letters assignments.

You can get around this one pretty easy as well. Toss it on any one of your hard-drives and make a little modification to the script to find it.

ie:

CMDOW @ /HID
@echo off

for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\DDrive set DRIVE=%%a:

CD /D %DRIVE%\Custom\System

DISKPART /s drives.txt

EXIT

This assumes that you have a file called 'DDrive' in the root of the drive which holds the folder 'Custom\System' and 'drives.txt' is inside of this folder. Obviously you cant change the names of any of these folders or files, so long as you make the change in the batch file. Besides, I dont know about you, but I dont add/remove drives or have any need for that matter to assign different drive letters on a regular basis.

Thanks for the feedback! Hope this helps others who have thought about these issue as well.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...