How to Remove a Physical Disk from Windows Storage Spaces using PowerShell

Having my latest server build running on the Windows Server platform, there are a number of things that I have found to become a bit more difficult than I am used to. Not only have I switched to Windows as the platform, I am using Storage Spaces. This in itself is a departure from my comfort zone and has presented some scenarios that I wasn’t quite prepared for. Like trying to remove a disk that Windows, for some reason, wants to keep.

Let’s start off with a little background. I created a number of storage spaces to segregate data that is used differently. This allows me to make sure that volumes that will have a lot of data read from them will be separate from volumes that will have less read than written. The setup was a breeze and things were humming along nicely until I started replacing disks. For the most part, the GUI made things easy. I would add a disk to the pool, then retire the disk I wanted to replace, and remove it. At that point, I would rebuild, wait for the process to finish, then start again when I was ready to replace another disk.

In my last go around, Windows took the disk I added but did not want to release the one I wanted to remove. Instead, she (Windows) would present me with a popup telling me that “The selected physical disk cannot be removed” and that “Before removing a physical disk, you must add a replacement physical disk to the storage pool.” Annoyingly, this had been done, but Windows will not agree.

Alas, back to the familiar command line to try to figure out a solution. In this case, PowerShell would the be the method.

The first thing I did was to list out the physical disks

Get-PhysicalDisk

With the list of disks I can determine, by friendly name, which of them I wanted to retire, then remove. With that information in hand, I can pick the virtual disk that the disk belongs to. In my case, I wanted to remove the HGST HDS724040ALE640 drive from the pool.

Set-PhysicalDisk -FriendlyName 'HGST HDS724040ALE640' -Usage Retired

In order to remove the disk, a repair must be completed. However, if you have more than one virtual disk, you must figure out which you are repairing. In my case, the virtual disk is MDATA

Get-VirtualDisk

Kicking off the repair:

Repair-VirtualDisk -FriendlyName 'MDATA'

Monitor the Repair progress

Get-StorageJob

When the repair has completed, it will most likely take a long time, you can remove the disk from the pool.

Remove-PhysicalDisk -FriendlyName 'HGST HDS724040ALE640'

There you have it. A disk gone through PowerShell that Windows GUI wouldn’t release.

About Joe D

I have always had a passion for everything computing. In early 2000, I decided to take my passion to the web. Thus, C.O.D. was born. Through the years we have made many great friends at C.O.D. and hope to continue our journey for years to come.

Check Also

Can’t Remove a Partition? Use DiskPart

If you have ever removed a hard drive from a system and installed it in another, you may have run into a situation before where you are unable to delete some of the partitions on the drive. This usually happens when you remove the hard drive from a system made by Dell, Acer, Samsung, etc. The partitions you are unable to remove are designated for system restore and the like. Well, getting rid of those partitions is easier than you think. All you need is a command line and a cup of coffee.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.