Articles on: Virtual Machine

Conversion of Azure HDD to SSDthe name of the disk you want to convertresource group that contains the managed diskChoose between Standard_LRS and StandardSSD_LRS based on your scenarioGet p

Articles on: Virtual Machine

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.



$diskName = 'yourDiskName'



$rgName = 'yourResourceGroupName'



$storageType = 'StandardSSD_LRS'

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



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



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

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



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

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



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

Updated on: 31/01/2023

Updated on: 01/07/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!