Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on Server 2012 which doesn't have a GUI. For now, I have two hard disks. My first one is already formatted and I see it as C:

Now, I'd like to format my second hard drive and create a D: partition.

Are there any ideas how could I achieve this through command-line (like cmd or powershell)?

share|improve this question

migrated from Nov 15 '12 at 20:50

This question came from our site for computer enthusiasts and power users.

up vote 10 down vote accepted

You probably want to use the diskpart.exe tool.


DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           60 GB     0 B
  Disk 1    Online          200 GB   200 GB

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> create partition primary

DISKPART> list partition

DISKPART> select partition 1

DISKPART> format fs=NTFS quick

DISKPART> assign letter=D


share|improve this answer
You might need to run a few commands to bring the disk online and make it writable prior to creating the partition. If you get a "Media is write protected" exception when running create primary partition run these steps. – smaclell Jul 17 '15 at 19:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.