Skip to main content

Resize a partition after a diskupgrade

Important: This tutorial only applies to VServers that are configured with LVM. It is assumed that the partition scheme is left unaltered after the initial delivery of your VServer. Therefore, depending on the configuration, some values may differ.

The changes do not have to be done in a rescue system since LVM allows it to do it live.

The disc can be named /dev/sda or /dev/vda depending on the server generation. The following command covers both variants automatically.

  1. Resize the partitions /dev/vda2 and /dev/vda5.
$ growpart /dev/[sv]da 2
$ growpart /dev/[sv]da 5
  1. Resize the PV:
$ pvresize /dev/[sv]da5
  1. Extend the LV. lvs shows you all available volumes. In the following example the root partiton and the filesystem will be increased:
$ lvextend -l +100%FREE /dev/vg0/root --resizefs