restore azure vm os disk to smaller disk and swap OS disk

chad whittington 1 Reputation point
2021-10-06T15:34:25.927+00:00

i see in the azure VM under disks i can "swap OS disk". question is, my VM disk is way to big and i would like to reduce costs. when i setup, i saw there was option to re-size but didn't realize it was only larger.

so, i want to create a new smaller disk and restore my VM OS disk on the smaller disk and "swap os disk" to be new. will this work?

otherwise can i create a new disk that is basically a blank os with same users and swap and then re-install apps?

i'm at 1tb (users use onedrive and email and i couldn't get a good estimate of space required before hand) and i really only need 256 assuming i can increase with no problems....

Azure Backup
Azure Backup
An Azure backup service that provides built-in management at scale.
1,182 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Alan Kinane 16,811 Reputation points MVP
    2021-10-06T18:51:46.62+00:00

    There isn't an easy way unfortunately. When swapping the OS disk, it must be swapped for an OS disk of the same size so you won't be able to swap for a smaller one. There is a possible solution here but not straightforward: https://jrudlin.github.io/2019-08-27-shrink-azure-vm-osdisk/

    0 comments No comments

  2. SadiqhAhmed-MSFT 40,911 Reputation points Microsoft Employee
    2021-10-08T11:48:42.367+00:00

    @chad whittington There may be a workaround, but I cannot find one in Microsoft Documentation. There is the Important note in Expand the OS drive of a Windows VM in an Azure - Azure Virtual Machines | Microsoft Learn:

    138982-image.png

    My suggestion would be to make a support request to Azure VM team as the ask here is primarily about decreasing the size of an existing disk. However, the doc above states it isn’t supported, so they will either confirm the same or maybe help with an undocumented workaround. Restoring a disk is done from a snapshot of the original disk, so the restore portion of this ask shouldn’t be considered here.

    Hope that helps. Please share any further questions on this.

    ----------------------------------------------------------------------------------------------------------------------

    If the response helped, do "Accept Answer" and up-vote it

    0 comments No comments