Automation of space increase

XN-Matt

Well-Known Member
Aug 21, 2017
90
7
48
42
Looking through most recent threads on resizing, I can see wiki links on how to do this via commands within the VM but nothing specific outside of the VM.

We want to automate this so if an order comes in for an increase it can happen without user involvement or needing to get in to the VM itself.

Our images are set with one partition (/dev/vda1) making the process as easy as it can be.

Has anyone achieved this by stopping their VM, mounting the space on the hostnode doing the resize and then booting again?
 
Maybe one to be worked on. Hooks would be nice to be able to run at any point on the hostnode via the API? ;)

Code:
lvchange -ay /dev/vg-1/vm-xxx-disk-1
losetup -f (get next loop device)
losetup /dev/loop0 /dev/vg-1/vm-xxx-disk-1
kpartx -av /dev/loop0
parted /dev/loop0 resizepart 1 100% (resize first/only partition)
e2fsck -f /dev/mapper/loop0p1
resize2fs /dev/mapper/loop0p1
sync
kpartx -dv /dev/loop0
losetup -d /dev/loop0
lvchange -an /dev/vg-1/vm-xxx-disk-1

And then start again and all increased.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!