Articles on: Virtual Machine

Conversion of Azure HDD to SSD

Prerequisites

To get the hassle-free migration of HDD to SSD drive done, you need to get the important prerequisites checked first. These prerequisites are mentioned below.

You should first check whether the SSD is available in the destination region.

Your Drive should be a Managed Disk.

Your Size of VM should support Premium SSD if you wish to migrate to it.

You should schedule the migration of your disk’s storage during a pre-existing maintenance window, as the conversion requires a restart of the VM.

Precaution



Coming to the procedures conducted in PowerShell. You should be very careful when running the below mentioned commands to generate effectiveness, otherwise, you may end up making the whole procedure a liability.

Steps



You need to run Connect-AzureRmAccount in PowerShell with Azure RM module included in it to create a connection with Azure.

The following example shows how to switch a single disk of a VM from standard HDD to standard SSD, and vice versa.

the name of the disk you want to convert



$diskName = 'yourDiskName'

resource group that contains the managed disk



$rgName = 'yourResourceGroupName'

Choose between Standard_LRS and StandardSSD_LRS based on your scenario



$storageType = 'StandardSSD_LRS'

$disk = Get-AzureRmDisk -DiskName $diskName -ResourceGroupName $rgName

Get parent VM resource



$vmResource = Get-AzureRmResource -ResourceId $disk.ManagedBy

Stop and deallocate the VM before changing the storage type



Stop-AzureRmVM -ResourceGroupName $vmResource.ResourceGroupName -Name $vmResource.Name -Force

$vm = Get-AzureRmVM $vmResource.ResourceGroupName -Name $vmResource.ResourceName

Update the storage type



$diskUpdateConfig = New-AzureRmDiskUpdateConfig -AccountType $storageType -DiskSizeGB $disk.DiskSizeGB

Update-AzureRmDisk -DiskUpdate $diskUpdateConfig -ResourceGroupName $rgName ` -DiskName $disk.Name

Starting the Vm after successful conversion



Start-AzureRmVM -ResourceGroupName $vm.ResourceGroupName -Name $vm.Name

Updated on: 31/01/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!