Adding a new disk to LVM

Hi, in this tutorial i will be showing you how to add a new disk to your (solusvm) LVM pool.
First, run

lsblk

This will show the disks that Linux has found. If this does not contain your newly added disk make sure that it is connected correctly and added to the RAID configuration. For this tutorial, we will be using /dev/sdb1 as an example but this will differ per system, make sure that this is the new disk. We recommend using SSD or SAS drive if you are going to run a lot of VMs.

To turn the disk into a format that LVM can understand run

pvcreate /dev/sdb1

This might prompt if you want to remove the ext4 signature. If it does click “yes”. To add this disk to your LVM run:

vgextend openvz /dev/sdb1
lvextend /dev/openvz/vz /dev/sdb1

This will first add your disk to the new volume group and then to the actual logical volume. The space is already added but to make sure that it shows up correctly in your filesystem:

resize2fs /dev/openvz/vz

And voilá, your new disk is now added to your LVM pool and ready to be used.

If you have a dedicated server or colocation with Ferox Hosting you can also always ask our support and they will do this setup for you.

TIP: to create a thin pool, run

lvcreate -L 15G --thinpool thinpool vg0

TIP: Thin provisioning required thin-provisioning-tools