Windows PowerShell change Hard Drive/Media type for Windows Server Storage Space / Storage Pool

1 List all physical disks

Get-PhysicalDisk
Microsoft PowerShell - Get-PhysicalDisk
Microsoft PowerShell – Get-PhysicalDisk

2 If you have multiple physical disks with same name use following command

Get-PhysicalDisk | Select-Object SerialNumber,UniqueId, FriendlyName
Microsodr PowerShell - Get-PhysicalDisk | Select-Object SerialNumber,UniqueId, FriendlyName
Microsodr PowerShell – Get-PhysicalDisk | Select-Object SerialNumber,UniqueId, FriendlyName

3 Find the right “UniqueId” for the physical disk which you want to changedrive/media type for

4 Change the hard drive/media type

For systems with physical disks without same name

Set-PhysicalDisk –FriendlyName "PhysicalDisk6" -MediaType SSD

For systems with physical disks with same name

Set-PhysicalDisk –UniqueId "{016ag017-1cd2-81-mugf-26j28503l5vb}" -MediaType SSD

Bonus

-MediaType: Accepted values: HDD, SSD, SCM

Extra Reading

Set-PhysicalDisk

Use PowerShell to Create Virtual Disk on Windows Storage Pool/Storage Space with specific number of columns

PowerShell

New-VirtualDisk -StoragePoolFriendlyName "Existing Pool Name" -FriendlyName "Name for new virtual disk" -ResiliencySettingName Mirror -Size 10TB -ProvisioningType Fixed -NumberOfColumns 2
ParamaterDescription
-StoragePoolFriendlyNameYour existing pool’s friendly name which you want to create virtual disk on
-FriendlyNameA friendly name you want to give for new virtual disk
-ResiliencySettingNameResiliency type to use: Simple, Mirror, Parity
-SizeSize you want to assign to the new virtual disk
-ProvisioningTypeFixed or Thin
-NumberOfColumnsNumber of columns

Generally, Mirror has better performance than Parity but least storage efficient, Simple has best performance but no redundancy at all. If you have enough physical disks in the storage pool, 2 – 4 columns will give you great performance. Keep in mind that when increasing pool capacity, you can usually achieve optimal pool capacity utilization when you add disks in multiples of the number of disks the storage space needs.

Controlling the Number of Columns

Controlling the Number of Columns
Controlling the Number of Columns

Extended reading:

New-VirtualDisk

Controlling the number of columns


Windows Server Storage Space/Storage Pool Reattach straightway after physical disk retired

Only reattach if you are sure the physical is in good working condition, if not, you really should replace the physical disk for the Storage Pool

See this guide for replacing disk: How to fix: Windows Storage Space/Storage Pool physical disk lost communication, replace dead physical disk

1 Launch PowerShell in admin mode

2 Use “Get-PhysicalDisk” to list all physical disks

Get-PhysicalDisk

3 Use “Get-PhysicalDisk | Select-Object SerialNumber,UniqueID” to get serial number of the physical disk (It’s very useful when you have multiple physical disks with same name)

Get-PhysicalDisk | Select-Object SerialNumber,UniqueID

4 Use “Set-PhysicalDisk -UniqueID “{SerialNumber}” -Usage AutoSelect” to reattach the physical disk

Set-PhysicalDisk -UniqueID "{4a5bbag5-cc77-01ab-a8ba-520c1af8885b}" -Usage AutoSelect

5 Use “Repair-VirtualDisk -FriendlyName ‘Name of the virtual disk within the pool'” to repair the virtual disk

Repair-VirtualDisk -FriendlyName 'Name of the virtual disk within the pool'

6 Use “Optimize-StoragePool -FriendlyName “Pool Name”” to optimize the storage pool

Optimize-StoragePool -FriendlyName "Pool Name"

How to fix: Windows Storage Space/Storage Pool, Virtual Disk not attaching automatically on reboot

1 Launch PowerShell from start menu or “Run” window with admin privilege

2 Use following command to check “-IsManualAttach” attribute

Get-VirtualDisk | Select-Object IsManualAttach

Or use following command to show all virtual disks with “IsManualAttach” attributes

Get-VirtualDisk | Where-Object {$_.IsManualAttach –eq $True}
Windows PowerShell -  Get-VirtualDisk | Select-Object IsManualAttach
Windows PowerShell – Get-VirtualDisk | Select-Object IsManualAttach

3 Use following command to set “IsManualAttach” to false, so that it will attach on reboot

Set-VirtualDisk -FriendlyName "virtual disk name" -IsManualAttach 0

e.g.

Set-VirtualDisk -FriendlyName "my virtual disk" -IsManualAttach 0

Or to use following command to change all virtual disks to auto attach on reboot

Get-VirtualDisk | Where-Object {$_.IsManualAttach –eq $True} | Set-VirtualDisk –IsManualAttach $False

How to: Check Windows Storage Space, Storage pool virtual disk Columns

Using PowerShell

Get-VirtualDisk "name of the virtual disk" | Select-Object *

To get general information, use following command instead

Get-VirtualDisk "name of the virtual disk"

Using Server Manager

1 Launch Windows “Server Manager”

2 In Windows Server 2019, navigate to “Server Manager -> File and Storage Services -> Storage Pools -> Virtual Disks”

3 Right click on the virtual disk, select “Property”

4 Click on “Details”

5 Select “NumberOfColumns” from “Property:”

6 The number of columns will be displayed underneath.

Note

If after rebooting, virtual disks are not attaching automatically, follow this guide to make them auto attach on reboot.

How to fix: Windows Storage Space/Storage Pool physical disk lost communication, replace dead physical disk

Keywords: Windows Server, Windows Server 2019, Windows Server Storage Space, Windows Server Storage Pool, physical disk, lost communication, Warning, Error, replace, replace disk

If you are running Windows Storage Space on USB disks, when you change disk cache settings, or accidentally disconnected one of the USB disk from Windows Storage Space (With minimum 1 disk fault tolerance, e.g. Parity, Mirror), or due to other reasons that caused one of the physical disk showing error or warning from Windows Server Manager

For simply reattaching the physical disk, check our this guide: Windows Server Storage Space/Storage Pool Reattach straightway after physical disk retired

Warning: Always backup all data on the storage pool if possible or at least important data

Replace the physical disk

1 Launch “Windows PowerShell” in admin mode

2 Use following command to list all physical disks

Get-PhysicalDisk
Windows PowerShell - Get-PhysicalDisk
Windows PowerShell – Get-PhysicalDisk

3 If you have multiple physical disks with same name, use following command to distinguish among them, you probably can find serial number on the label from hard drive

Get-PhysicalDisk | select-object serialnumber, uniqueid, friendlyname, operationstatus, healthstatus
Windows PowerShell - Get-PhysicalDisk | select-object serialnumber, uniqueid, friendlyname, operationstatus, healthstatus
Windows PowerShell – Get-PhysicalDisk | select-object serialnumber, uniqueid, friendlyname, operationstatus, healthstatus

(Before mark the physical disk as retired you might want to check which virtual disks will be affected, you can use following command to check virtual disks)

Get-Virtual-Disk

4 Mark the disk we want to remove as “retired”

  • Using Friendly Name
Set-PhysicalDisk -FriendlyName 'PhysicalDiskName' -Usage Retired

e.g.

 Set-PhysicalDisk -FriendlyName 'Contoso Disk' -Usage Retired 
  • Using Serial Number
Set-PhysicalDisk -uniqueid 'Serial Number' -Usage Retired

e.g.

Set-PhysicalDisk -uniqueid '{29e928d2-2793-11ea-a6db-000c29b85813}' -Usage Retired
Windows PowerShell - Set-PhysicalDisk -uniqueid 'Serial Number' -Usage Retired
Windows PowerShell – Set-PhysicalDisk -uniqueid ‘Serial Number’ -Usage Retired

5 Once the disk is marked to be removed.  We need to rebuild each of our virtual disks

Repair-VirtualDisk -FriendlyName 'Name of the virtual disk within the pool'

e.g.

Repair-VirtualDisk -FriendlyName 'my disk on pool'

6 We can monitor the repairing progress

Get-StorageJob
Windows PowerShell - Get-StorageJob
Windows PowerShell – Get-StorageJob

7 Once everything is done, we can remove the disk from the pool

Remove-PhysicalDisk -FriendlyName 'PhysicalDiskName'

Note: If you have many physical disks with same name we can use “Server Manager” to remove it, follow step 7.1 to

7.1 Launch “Server Manager”

Windows Server 2019 - Server Manager - Dashboard
Windows Server 2019 – Server Manager – Dashboard

7.2 Find the disk with exclamation mark and showing “Retired” as operational Status

Windows Server 2019 - Server Manager -> File and Storage Services -> Storage Pools -> Physical Disks
Windows Server 2019 – Server Manager -> File and Storage Services -> Storage Pools -> Physical Disks

7.3 Right click on the disk then click on “Remove Disk”, you will see following window

Windows Server 2019 - Server Manager -> File and Storage Services -> Storage Pools -> Physical Disks -> Remove Disk
Windows Server 2019 – Server Manager -> File and Storage Services -> Storage Pools -> Physical Disks -> Remove Disk

7.4 When it’s done, following windows will appear

Windows Server 2019 - Server Manager -> File and Storage Services -> Storage Pools -> Physical Disks -> Remove Disk
Windows Server 2019 – Server Manager -> File and Storage Services -> Storage Pools -> Physical Disks -> Remove Disk

8 Now we can attache our new physical disk then add it to the pool from “Server Manager” Window

Re-attach the physical disk

In case of human error caused the physical to be recognised as faulty but you are sure that the physical disk is in prefect condition, we need to re-attach the physical disk

(You might get “suspended 0” from “Get-StorageJob” just continue with the guide, usually the “suspended” will not resolve itself if we don’t do anything…)

2.1 Try to follow step 1 to 8, ignore errors if there is any

2.2 Try to “Reset Disk” if the exclamation mark is gone, try to repair the virtual disk, if it is still there after Reset, continue with step 2.3

Windows Server 2019 - Server Manager -> File and Storage Services -> Storage Pools -> Physical Disks -> Remove Disk
Windows Server 2019 – Server Manager -> File and Storage Services -> Storage Pools -> Physical Disks -> Remove Disk

2.3 Try to follow step 1 – 3 to find out the “serial number” or “friendly name” of the disk which we want to re-attach, then using following command to change the disk state from “Retired” to “Auto”

Set-PhysicalDisk -UniqueID "{3b3bbdf4-cc77-13bd-a8ba-429c9ce9957a}" -Usage AutoSelect

2.4 Now we can follow step 5 to repair the virtual disk in degraded mode (We can right click the virtual disk from “Server Manager” then select “Repair Virtual Disk” as well)

Bonus

Other useful commands

# Optimise the Storage Pool 
Get-StoragePool "pool name" | Optimize-StoragePool
# Update Storage Pool to latest version
Update-StoragePool -FriendlyName "pool name"

Quick steps from Microsoft technet (Not suitable for systems with physical disks with same names)

  1. Open PowerShell in admin mode (PowerShell ISE is better)
  2. To get the names of the disks, type the following command:
    Get-PhysicalDisk
  3. To get the names of the virtual disks, type the following command:
    Get-Virtual-Disk
  4. First mark the disk you want to remove as “retired” by the following command:
    Set-PhysicalDisk -FriendlyName ‘PhysicalDiskXX’ -Usage Retired
  5. Now your disk is mark to be removed.  You need to rebuild each of your virtual disks with the following command:
    Repair-VirtualDisk -FriendlyName ‘My Virtual Disk’
  6. You can monitor the progression of the process by typing the following command:
    Get-StorageJob
  7. Once everything is done, just remove the disk from the pool with this command:
    Remove-PhysicalDisk -FriendlyName ‘PhysicalDiskXX’
  8. That’s it!