LVM(Logical Volume Manager) is a handy tool for handling storage at various levels. LVM functions by layering abstractions on top of physical storage devices, as mentioned below in the illustration.
Below is a simple diagrammatic expression of LVM
sda1 sdb1 (PV:s on partitions or whole disks) \ / \ / Vgmysql (VG) / | \ / | \ data log tmp (LV:s) | | | xfs ext4 xfs (filesystems)
LVM Striping is one feature that will write the data over multiple disks instead of constant writing on a single Physical volume.
Features of Striping
- Increase the performance of the disk.
- Saves hard write over and over to a single disk.
- Disk fill-up can be reduced using striping over multiple disks.
Procedure
Check disks attached to the system using the command lsblk.
#> lsblk
Create the Physical Volume (PV) using the command pvcreate /dev/sd[b-g].
#> pvcreate /dev/sd[b-g]
Confirm PV status using the command pvs.
#> pvs
Create the Volume Group (VG) using the command vgcreate -s 1M vgbz /dev/sd[b-g] -v.
#> vgcreate -s 1M vgbz /dev/sd[b-g] -v
Confirm Volume Group (VG) status using the command vgdisplay -v.
#> vgdisplay -v
Volume Group (VG) is now ready, it's time to create Logical Volume (VG) using the command lvcreate -L 11.46T -I 16k -i 6 -n storage vgbz.
#> lvcreate -L 11.46T -I 128k -i 6 -n storage vgbz
Check Logical Volume complete view using lvdisplay -m where you will see Stripes as 6, which is a total of 6 disks attached to Strip LVM along with a Strip size of 128 KB.
#> lvdisplay -m
Now, we can format the Logical Volume using the command mkfs.ext4for the ext4 partition.
#> mkfs.ext4 /dev/mapper/vgdisk-storage
Following mount point options can be used in /etc/fstab.
/dev/mapper/vgdisk-storage /storage ext4 defaults 1 2
We can check IO Benchmarks using the command fio.
#> fio --randrepeat=1 --name=randrw --rw=randrw --direct=1 --ioengine=libaio --bs=16k --numjobs=10 --size=512M --runtime=60 --time_based --iodepth=64 --group_reporting
DONE!!