Back to home

Resize a partition after a diskupgrade

This manual only applies to VServers that are configured with LVM (nine.ch uses LVM on Ubuntu 14.04). 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.

It is needed to resize the partitions /dev/vda2 and /dev/vda5. This must be done with parted because fdisk is not compatible with the default partition table in use.

root@server:~ # parted /dev/vda

After pressing p this command shows the size of the physical disk. Usually it is visible at the part “Disk /dev/vda”. In this case it will be assumed that the disks size is 215GB. Then both partitions can be resized using parted:

(parted) resizepart 2 215GB
(parted) resizepart 5 215GB

Pressing p shows the partition table. parted can be closed by pressing q.

Now the LVM needs to be enlarged on /dev/vda5. For this purpose, first the PV has to be increased:

root@server:~ # pvresize /dev/vda5

After that, the size of the LV has to be increased too. For this, the correct name of the partition to be enlarged can be found with the command lvs. As an example the root partiton will be used:

root@server:~ # lvextend -l +100%FREE /dev/vg0/root

For the last step the filesystem has to be extended to consume the whole diskspace left:

root@server:~ # resize2fs /dev/vg0/root

Didn't find what you were looking for?

Contact our support:

+41 44 637 40 40 support@nine.ch