Commands to Create Mount Points from Unallocated Hard Drives

Scenario: You added new Hard Drives into your Windows Servers and you wish to  quickly partition these disks to be used as mount points. You can use the commands below to script it.

Commands:  We will be using DiskPart in order to accomplish this.

1. Open DiskPart: 

From a command prompt or powershell, type in diskpart and press enter.  A new DiskPart window should open up.

2. Determine the Disk Numbers of the newly installed disks:

List Disk 

3. Use the Disk Number  and use the commands below.  We are going to use Disk Number 3 as the newly installed disk. You can copy all the commands below at once and paste the commands into the DiskPart command window.

Select Disk 3
Create Partition Primary
Select partition 1
format  quick fs=ntfs Label=”MountPoint1″
Assign Mount=C:MountPoint1

 

Rename Volume Labels by Powershell

To bulk rename Volume Labels for disks, use the following Powershell command:

get-ciminstance win32_Volume -filter “Label = ‘Old Label'” | set-ciminstance -Property @{Label =’New Label’}

If these volumes are mount points and you have to change the folder name as well, use the following Powershell command:

Rename-Item C:OldFolderName C:NewFolderName