Logical Volume Manager or LVM is great tool for managing your scalable cloud storage. It’s simple yet powerful. You can use it to setup a single volume like we’ll show you in this article, but you can also make far more complex structure combining multiple storage drives, adding redundancy or just scaling out your storage on the fly.
In this tutorial we’ll start with an easy setup. We’ll create a single logical volume from one physical drive – /dev/sdb.
Let’s start by creating an LVM physical volume from /dev/sdb:
pvcreate /dev/sdb
Using the physical volume we’ll create the volume group data01. Although it currently consists of only one physical volume, physical groups let us easily add more drives on a later stage and expand the logical volume.
vgcreate data01 /dev/sdb
And the third and final step creating the logical volume data-vol01. We create it using 100% of the space available in the volume group data01.
lvcreate -l 100%FREE -n data-vol1 data01 /dev/sdb
Once we have a logical volume it’s just a step before we can start keeping data on it, so let’s add an file system and mount it in the /media directory just to check it:
mkfs.ext4 /dev/data01/data-vol1
mount /dev/data01/data-vol1 /media
This simple LVM setup shows that it’s quick and easy to start managing your additional storage drives. By adding more storage to your servers LVM will be one of your best friends to manage and keep your data. Keep an eye on CloudBalkan Blog for more articles related to LVM.