Resizing VMs in Proxmox
What Cloud-Init does and how you can do it yourself
298 Words
2025-08-27
Today I wondered how the resizing of a VM works, when I increase the size of the logical volume of a VM. I typically do this using Proxmox and reboot the machine which automatically resizes the disk.
I wondered how I could do the same without rebooting.
After increasing the size of the block device in Proxmox using the UI and extend disk
I get the following view:
sda 8:0 0 64G 0 disk
├─sda1 8:1 0 31.9G 0 part /
├─sda14 8:14 0 3M 0 part
└─sda15 8:15 0 124M 0 part /boot/efi
So I do have 32GB in disk 1 but could increase to 64GB.
To do this, I need:
sudo growpart /dev/sda 1
to extend the partition to the 64G. After which I get:
sda 8:0 0 64G 0 disk
├─sda1 8:1 0 63.9G 0 part /
├─sda14 8:14 0 3M 0 part
└─sda15 8:15 0 124M 0 part /boot/efi
Yet, in df -h
the new amount is not visible.
For this, I also need to increase the file system size of the ext4 inside the partition
sudo resize2fs /dev/sda1
Now df -h
is empty again, and everything works as expected.
Conclusion
I did not know that you have to do this for the Block, the partition and the filesystem.
I tried to use resize2fs
directly, which fails, as the partition is not resized yet.
I always thought that the reason for this is that the sda14 and sda15 are directly behind the sda1 and we would have to move these as well (which is much more complicated).
However, using fdisk -l /dev/sda
I can see that the sda1
partition is actually at the end of the blockdevice.
Now I also know how to increase the filesystem without rebooting and letting cloud-init do its things.