LVM is normally easy to resize but on a VM you can also easily resize if you have EXT and no LVM.
There are a few steps as things are layered. Proxmox controls the VM has the OS has the disk partitions has the file system. The outline of the steps are:
- Resize disk in Proxmox
fdiskto learn current layout and if Proxmox resize worked
partedto fix the GPT PMBR size mismatch
partedto resize the correct partition number
- Use `resize2fs` to resize the actual file system
First resize the disk in Proxmox
Next use root to do this command sequence:
fdisk -l should show which disks are there. Typically
If you get this message which seems like an error, the resize in Proxmox worked:
GPT PMBR size mismatch (167772159 != 314572799) will be corrected by write. The backup GPT table is not on the end of the device. This problem will be corrected by write.
The example above is resizing from 80 GB to 150 GB.
Under some conditions you might now get the above warning. We have seen this on a secondary disk
/dev/sdb that was about to be resized. Everything was perfect in Proxmox with the resize, but that warning didn’t show.
Next use parted:
# parted /dev/sda
Then this command
Next you’ll get an Warning which allows you to “correct” the first error:
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 146800640 blocks) or continue with the current setting?
Fix it, do this:
Next you’ll see this output, it indiciated our 80 GB drive is to be enlarged and it’s partition # 1:
Disk Flags: Number Start End Size File system Name Flags 14 1049kB 5243kB 4194kB bios_grub 15 5243kB 116MB 111MB fat32 boot, esp 1 116MB 85.9GB 85.8GB ext4
Now resize the partition, still in parted:
(parted) resizepart 1
It will tell you the partition is in use. It’s safe to continue.
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue? Yes/No? y
Next tell the system to use all the new space by typing 100%
End? [85.9GB]? 100%
At this point you still have to resize the file system:
# resize2fs /dev/sda1 resize2fs 1.45.5 (07-Jan-2020) Filesystem at /dev/sda1 is mounted on /; on-line resizing required old_desc_blocks = 10, new_desc_blocks = 19 The filesystem on /dev/sda1 is now 39293179 (4k) blocks long.
Check if resize worked:
# df -h
Resize Proxmox Volume with LVM
Four utilities are required, but use
lsblk throughout to check progress. The following example assumes a Debian install with defaults, e.g. the LVM volume is called
- parted /dev/sdx
- print and Fix
- resizepart and choose correct partition and 100%FREE flag
- pvresize /dev/sdx
- lvextend -l +100%FREE /dev/mapper/pbs-root
- resize2fs /dev/mapper/pbs-root