Jack Moore

Email: jack(at)jmoore53.com
Project Updates

Reducing the size of an LVM Disk

31 Jan 2022 » lvm, proxmox, qemu

Well, without paying attention I accidently increased the disk size of a disk to 80gb from 32gb. It wasn’t that the size was incorrect, I was doing this to the wrong VM.

To fix this I tried a few things, but unfortunately from the GUI I was unable to fix the problem. This meant I had to logon to the proxmox server to fix it.

From the command line this looked like:

# Finding the disk
lvdisplay | grep "LV Path\|LV Size"

# Resizing the disk down to 32GB (its original size)
lvreduce -L 32G /dev/pve/vm-103-disk-1

# Vim the node conf editing the disk size to the now 32gb drive
vim /etc/pve/nodes/proxmox-node/qemu-server/103.conf

Well…

So it turns out I got luck on the two I used lvreduce on. On the third server I attempted this on, things did not pan out so well. But, since this server was just a piece of cattle, I deleted it, reprovisioned another server and re-installed the tools.

Adding Disk Space

Expand the disk in Proxmox first, and then from there try gparted to expand/resize the disk.

Then once the logical volume is expanded try the following:

# To display the logical volume
vgdisplay

# To resize the logical volume
lvresize -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
© Jack Moore