Configuring disk partitions from the command line

26 Mar

Yet another command line post. Basically, after configuring the Raid array on my DL380 G5, running Hyper-V I needed to create the data drive to hold all the VHD’s.

From the command prompt, typing:

C:\>d:

Gave the error:

The device is not ready

Of course it wasn’t ready, I hadn’t set the partition – doh! Pretty simple to do though, just run:

diskpart

PS, at this point, don’t panic that there is ‘0 B Free’, this simply means that there is 0B of unassigned drive space, i.e. you have assigned it all to c: for example.

Then:

list disk

Then select the disk you want to create the partition on (in my case, disk 1)

select disk 1

then you need to create the primary partition by typing:

create partition primary

Then you need to assign it a drive letter by typing:

assign letter=D

Then you can exit by typing:

exit

And finally, you will need to format the drive so that you can use it by typing:

format d: /q

Once done, you should be able to navigate to it by typing:

d:

Simples.