Score:1

Storage Spaces with Azure Disk: how can we extend virtual disks?

ca flag

We have on Azure several Windows Server 2019 virtual machines whose data disks are configured with Storage Spaces.

How can we extend a virtual disk configured for simple redundancy (NumberOfDataCopies is set to 1) on those machines without wasting physical storage?

Score:1
ca flag

You may follow this process, but please be careful, as mistakes may lead to data loss:

  1. The first step is to add a new disk (or more new disks, depending from your scenario) to the virtual machine from the Portal.
  2. Once the new disks are attached, login to the virtual machine, go on Server Manager\File and Storage Services\Volumes\Storage Pools, right click on the Storage Pool you would like to increase, the one providing the resources for the virtual disk you would like to extend, then add the new disks to that pool.
  3. Do not extend the virtual disk straight away, and if you really have to do it (e.g. if your virtual disk is full and you need some storage to restart a depending service), leave at least 2 GB per disk from the target. E.g. if the sum of the target physical disks is 512 GB and that is reached with 2 disks, extend max to 508 GB, that's it:

available physical storage (512 GB) - ( disks (2) * 2 GB)

  1. Find the UniqueId of the disk to retire using this command on a elevated PowerShell prompt:

Get-PhysicalDisk | select DeviceId, FriendlyName, UniqueId, Size, PhysicalLocation

  1. Look on the Azure portal on which LUN the disk has been attached, match that with the LUN reported on PhysicLocation (towards the end of the report, please don't mix it with the DeviceId at the beginning). You need the UniqueId, which is an hexadecimal number that looks like 6002243673DD16EBB4CF0579AE3A7647.

  2. Give a friendly name to the disk to retire you have identified on the previous step:

Set-PhysicalDisk -UniqueId 6002243673DD16EBB4CF0579AE3A7647 -NewFriendlyName ToRetire

  1. Retire the disk identified in step 5:

Set-PhysicalDisk -FriendlyName ToRetire -Usage Retired

  1. being careful to choose the correct storage pool, start the repair job for the virtual disk, to move all the data from the disk to retire to the newly added disk(s):

Get-StoragePool –FriendlyName SQLVMStoragePool1 | Get-Virtualdisk | Repair-VirtualDisk -Asjob

  1. You may check storage job, probably multiple times, until its completion, with the following command:

Get-StorageJob

  1. Once the storage jobs are completed, it is possible to remove the retired and drained disk(s) from the GUI under Server Manager\File and Storage Services\Volumes\Storage Pools, then Physical Disks. Before removing the disk(s) I usually look at their properties, to ensure that used space should be less than 1 GB (around 750 MB to 850 MB). The corresponding cmdlet is Remove-PhysicalDisk. Please be careful, as per the relevant documentation if sufficient space does not exist in the storage pool to tolerate this removal, this can result in a data loss. In this scenario both the GUI and the cmdlet will warn you. Please read carefully before proceeding.

  2. Once the disk is removed, you can unattach it from the Azure Portal. To find out the LUN of the removed disk run the following command:

Get-PhysicalDisk | where CanPool -eq $true | select DeviceId, FriendlyName, UniqueId, Size, PhysicalLocation | ft

  1. At the same time, once the disk is removed, feel free to extend the virtual disk to the max (which is a bit more than what calculated above).

If you don't need to retire the pre-existing disk(s), you may follow a shorter and simpler process:

  1. The first step is to add a new disk (or more new disks, depending from your scenario) to the virtual machine from the Portal.
  2. Once the new disks are attached, login to the virtual machine, go on Server Manager\File and Storage Services\Volumes\Storage Pools, right click on the Storage Pool you would like to increase, the one providing the resources for the virtual disk you would like to extend, then add the new disks to that pool.
  3. Extend the virtual disk to the max (or to what you need) consuming the storage added in the storage pool in the previous step.
  4. being careful to choose the correct storage pool, optionally, you may try to run the repair job for the virtual disk, to attempt to spread the data from the old disk(s) to the newly added disk(s):

Get-StoragePool –FriendlyName SQLVMStoragePool1 | Get-Virtualdisk | Repair-VirtualDisk -Asjob

  1. You may check storage job, probably multiple times, until its completion, with the following command:

Get-StorageJob

You may find here the full documentation for all Windows Storage Management-specific cmdlets.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.