My old home server (a re-purposed desktop) used to occasionally put one of my Storage Spaces into an offline and/or read-only state despite its status as 'HEALTHY'; this seemed to happen randomly and was rather frustrating as the Storage Space is used as a general file server for media etc.

As my Storage Space needed to be be back up in a pinch, it’s usually easier to use Powershell rather than the GUI; however, when it first happened I used to keep forgetting the Powershell cmdlet to bring it back online.

In case anybody else experiences this issue or if they are migrating a Storage Space, here is some information about the cmdlets followed by the solution:

Getting Storage Space Information

The Get-VirtualDisk cmdlet is used to get Storage Space created disks.

Get-VirtualDisk

FriendlyName  ResiliencySettingName OperationalStatus HealthStatus IsManualAttach  Size
------------  --------------------- ----------------- ------------ --------------  ----
Data          Parity                OK                Healthy      False          20 TB

The problem when trying to set Storage Space properties

There is a Set-VirtualDisk cmdlet but unfortunately it does not have any properties, or any other way, to set the disk(s)’s online/writable states.

One must look to the Get-Disk/Set-Disk cmdlets to find such properties, which may act on all OS disks rather than just Storage Spaces. As shown below, the issue is that Get-Disk does not make it easy to identify which drives, if any, are Storage Spaces.

Get-Disk

Number Friendly Name Serial Number HealthStatus OperationalStatus Total Size Partition 
                                                                             Style
------ ------------- ------------- ------------ ----------------- ---------- ---------
0      OS            {Redacted}    Healthy      Online             447.13 GB GPT    
1      Data          {Redacted}    Healthy      Online                 20 TB GPT  

The Online and Writable properties

The two properties that control the online and writable states are IsOffline and IsReadOnly. Use the following to display those properties:

Get-Disk | Format-Table -AutoSize -Property FriendlyName, IsOffline, IsReadOnly

The Solution

Now that we know how to get Storage Spaces and Disks, the solution is rather easy.

  1. The Storage Space is identified by using any criteria (FriendlyName is the simplest with a small number of Spaces);

  2. the Storage Space is piped to the Get-Disk cmdlet to get the Virtual Disk that represents the Storage Space;

  3. this is finally piped to the Set-Disk cmdlet to set the property of the piped Disk to the value given.

Get-VirtualDisk -FriendlyName [*FriendlyName*] | Get-Disk | Set-Disk -[*Property*] $value
Making the Disk Online
Get-VirtualDisk -FriendlyName Data | Get-Disk | Set-Disk -IsOffline $false
Making the Disk Writable
GGet-VirtualDisk -FriendlyName Data | Get-Disk | Set-Disk -IsReadOnly $false