Resize C:\\ drive on Microsoft Azure Virtual Serve

2019-06-09 18:29发布

问题:

We have a Virtual Server on Microsoft Azure which needs its C:\ Drive resized. While new VMs can be created with 120GB drives, old VMs were created with only 30GB for the C drive, and even after cleaning the drive from downloads and unnecessary files, the VM is running very low on space.

In short, we to resize the C drive of this VM to 120GB.

I have found this post but it feels far too complex (and maybe outdated?) for us to implement.

Isn't there any easier method to do it?


Solved

After much troubles, here is a working solution (at list worked for me)

  1. shut down your VM (with Azure powershell if you need to keep the IP using -StayProvisioned)
  2. Use Cloud Storage Studio (sorry i can't post 2 links yet... too young on StackOverflow, but google is your friend) to duplicate the VHDs (as the name will stay the same, you need to copy them to another container)
  3. rename the new VHD
  4. use the only known way to do the resize (you can go down to the end of the post for the "fast solution", it is even mentionned by Microsoft staff on MSDN forums...)
  5. Create a new disk wusing the newly created VHD
  6. create a new VM using this resized disk
  7. RDP to the new VM
  8. Use the management console to access the drives. you can then "extend" the partition (you should see some unallocated space for your C drive)
  9. that's it (!)

well that's it but it took me quite some sweat to get it right... However I now have 2 copies of my initial server, both with 100GB C drive

Of course, all credits go to Maarten Balliauw as he is the one who created the core piece.

回答1:

You have already find most of the possible ways to resize a disk.

One more option, which I would test (never tried so far tough, but should go fine) is the following procedure:

  1. Shutdown the VM (to make sure disk is consistent)
  2. Copy the VHD blob to a new blob for a back up situation.
  3. Start the VM
  4. Run SYSPREP on the OS given it is Windows (let SYSPREP shut down the VM when ready)
  5. Shutdown the VM in case SYSPREP didn't shut it down
  6. Create IMAGE based on the VM (when you create the image the VM will be deleted)
  7. Go to Create New VM -> From Gallery -> find your image -> chose appropriate VM size.
  8. The new VM shall be with the new HDD size.

If this doesn't work, then only the two other options are available for you.