Skip to content

Increase disk size

On our set up of PC we use the LVM functionalities inside Proxmox.

LVM have several good built in features but in our case the principal feature who will receive our interest is the hot-resizing.

In my case the output from lsblk.

root@host$ lsblk

sda                  8:0    0   40G  0 disk
├─sda1               8:1    0  487M  0 part /boot
├─sda2               8:2    0    1K  0 part
└─sda5               8:5    0 34.5G  0 part
  ├─systemdeb-swap 254:0    0  952M  0 lvm  [SWAP]
  ├─systemdeb-root 254:1    0  9.3G  0 lvm  /
  ├─systemdeb-tmp  254:2    0  4.2G  0 lvm  /tmp
  └─systemdeb-var  254:3    0 20.1G  0 lvm  /var

So we will see during this doc how to get the same structure with LVM system.

Prepare the disk

We use parted to grow the part of the disk who contain our extended partition.

parted /dev/sda

We list the partitions in parted by typing print.

print

We grow the extended partition (part 2 in our case).

resizepart 2 100%

When is done we must grow the logical volume part (part 5 in our case).

resizepart 5 100%

We print our partition list

print2

We must grow the VolumeGroup now

pvresize /dev/sda5

And finally we finish by growing the desired logical volume.

 lvresize --extents +100%FREE /dev/systemdeb/var

Resizing the filesystem

At this time we have resize our disk and set up LVM for using the new space.

Now we must resize our filesystem if we want use this space.

Resizing with EXT2/EXT3/EXT4

resize2fs /dev/systemdeb/var

Resizing with XFS ( used in this case )

xfs_growfs /dev/systemdeb/var

And finaly the new structure with 5Gio in more.

root@host$ lsblk
NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                  8:0    0   40G  0 disk
├─sda1               8:1    0  487M  0 part /boot
└─sda5               8:5    0 39.5G  0 part
  ├─systemdeb-swap 254:0    0  952M  0 lvm  [SWAP]
  ├─systemdeb-root 254:1    0  9.3G  0 lvm  /
  ├─systemdeb-tmp  254:2    0  4.2G  0 lvm  /tmp
  └─systemdeb-var  254:3    0 25.1G  0 lvm  /var