TechDocs/TechnicalProcesses/IncreaseDiskSpace

Increase Disk Space of VM

This page has been moved to docs.fsfe.org with the rest of the sysadmin documentation.

Sometimes it's necessary to increase the disk space of a VM. Here is how to do it:

  1. In Proxmox, go to the VM, enter the "Hardware" tab and resize the disk.
  2. Now, we do the rest on the VM. Enter it and install parted

  3. Find out the disk and partition you would like to extend. Let's say, it's /dev/sda5 which is an logical partition on the extended partition /dev/sda2.

  4. Increase both sda2 and sda5 to the maximum amount: parted -s /dev/sda resizepart 2 '100%' and parted -s /dev/sda resizepart 5 '100%'

  5. If LVM is used, find out the PV's and VG's name (pvs and vgs), in this example /dev/sda5 and volgroup.

    1. Make the PV use all the space on the partition: pvresize /dev/sda5

    2. Now vgs (or vgdisplay more verbosely) should show free space

    3. Then you can increase the size of the LVs, e.g.: lvextend -l +95%FREE /dev/mapper/volgroup-root or lvextend -L +10G /dev/volgroup/var (both paths work)

  6. The filesystem also has to be increased: resize2fs -p /dev/volgroup/root

Check whether it worked with df -H. In rare cases, you may have to run partprobe or reboot.

TechDocs/TechnicalProcesses/IncreaseDiskSpace (last edited 2023-01-18 12:54:21 by tobiasd)