Monday, October 1, 2018

Basic DiskPart Commands, create volume, server core, diskpart - the media is write protected

This stuff is old news but just in case anyone is looking for a small guide to diskpart.
Scenario:

Existing Windows file server. File server is Windows 2016 core (or non-desktop experience as it is now called)
Server is VM on ESXi 5.5

1. in vSphere client, add new disk/vmdk to VM. That process is not covered in this guide.


2. in the GUEST - Windows 2016 core in this example, disk management (diskmgmt.msc) is not available. From command line, run diskpart

3. "list disk" to view your disks
4. "select disk 2" - or your disk number
5. "online disk" to bring the disk online
You should receive "DiskPart successfully onlined the selected disk"



6. "Create Partition Primary"
You may receive "DiskPart encountered an error: The media is write protected."
IF you receive the error move to step 6B.

6B. "attributes disk clear readonly"
Then try "Create partition primary" again. Additionally, if  you DO NOT specify a size, DiskPart creates a partition the full size of the disk. If you do want to specify a size the command would look like:
Create partition primary size=10000
the size is in MB (megabytes) so the previous example would be 10GB.


7. Format the drive

format FS=NTFS quick
(additionally you could add label=MyLabel)

8. Assign a drive letter
To assign the next available drive letter, just type "assign"
To Specify a drive letter use:

  1. assign letter=W
9. "list volume" to see your volume information. Verify the drive letter (E in my example) and verify the file system type (NTFS). EXIT to leave diskpart.
Additionally, I run a "net share" to see the the root of the drive is administratively shared (as all drives are by default in Windows, if you haven't turned this "feature" off).



No comments:

Post a Comment