다음을 통해 공유


Azure VM: Decrease The Disk size

 

Introduction

In this post we show how to scale down a managed data disk for an Azure VM. For the time being, Azure portal only supports increasing the size of the disks.

Decrease The Disk

Step 1 - Create a New Data Disk

First we create a new Data disk from the Azure portal. Select ‘Create disk‘ and follow the wizard to create a managed disk.

Step 2 - Configuration To VM

Next we have to RDP to the VM in order to initialize the new disk. Go to the Disk Management and assign a size and Drive letter for the new volume.

Step 3 - Moving The Files

Once the new volume is initialized, we have to move the files from the source disk to the new volume. This can be done using robocopy.

The command above will move all data from E: to F:. Copy will be optimized for large files (/J), and will affect all files and sub folders (/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 destination.

When the files are moved to the new volume, we can 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, we can assign its Drive letter to the new volume.