ProxMox Drive Shrink

From Wiki.CoreyBlair.US
Revision as of 09:32, 24 November 2015 by Corey (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

If you are like me, you are anal about making sure that your share storage space is allocated correctly at all times. Hell it's to expensive not be. So without further ado. Lets say that you have a VM that you have recently changed its load and removed some applications or larger files that were stored on it and freed a lot of space. Well you dont want the disk image to hold on to all of that space do you? After all you could use it for a whole different VM.

  • First we want to get an iso ready to boot from because on most OS's it's not possible to resize a virtual disk on the fly. For these purposes I use GParted Live because it's the shit.
  • Next go ahead and shut that VM down like a big dog. Once you do, you will need to go in and set it to boot from your live disk management and if your cool you will of course be using GParted.
  • Once booted into the live enviornment be extremly careful that you don't screw things up. If your smart you will have a backup just in case. If your dumb then you probably shouldn't be doing this. From here find your virtual disk image and resize it to the amount that you think is sufficient for the VM.
  • From here you need to go to the console of your proxmox host and issue the following command

proxmox02:/mnt/data2/images/101# qemu-img resize vm-101-disk-1.raw -- -1G

Keep in mind that the path will be slightly different if you have shared storage and multiple hosts clustered. When in doubt start issueing the "ls" command to find out the proper path. Also be sure to be mindful of the VM id and dont resize lower than what you have allocated within the OS.
Original info found HERE