In this post, I will show you how to scale down a managed data disk for an Azure VM. For the time being, the Azure portal only supports increasing the size of the disks.
First, create a new Data disk from the Azure portal. Select ‘Create disk‘ and follow the wizard to create a managed disk.
Next, RDP to the VM in order to initialize the new disk. Go to Disk Management and assign a size and Drive letter for the new volume.
Once the new volume is initialized, move the files from the source disk to the new volume. This can be done using the robocopy.
The command above will move all data from F: to E:. A copy will be optimized for large files (/J), and will affect all files and subfolders (/e). Security information will be preserved (/sec). The copy will ignore system folders like “Sys Vol Info” and the recycle bin (/Xd). Option /Xo will not overwrite existing data unless the source copy is newer than the one possibly existing at the destination.
When the files are moved to the new volume, delete the source disk from the Azure portal. The disk has to be detached before we can delete it.
Once the source volume is deleted, assign its Drive letter to the new volume.