Striped Logical Volume in Logical volume management (LVM)
In our Logical volume management series, In our first logical volume setup, we have gone through setting up a linear logical volume. Now we are about to start with how to set up Striped Logical Volumes.
The linear logical volume will write the data to a single physical volume, Once the first disk’s physical extents are used it will start to write under the next disks this follows for all the disks one after another. Writing to a single physical volume constantly will not give good I/O performance.
The Striped logical volume will write the data equally across all the available physical volumes. We have four numbers of physical volumes. While writing data to a striped logical volume it will stripe the data across all the four disks which give more read and write (I/O) performance.
How it Works
Assume we are trying to write a 32 MB file. The first 4 MB (1 Extend) will write under the first disk /dev/sdb1 then the second 4 MB will be under 2nd disk /dev/sdc1, 3rd 4 MB on third disk /dev/sdd1 and fourth will be under 4th disk /dev/sde1, again the 5th one will start from 1st disk /dev/sdb1 this process will continue in a round-robin fashion again and again. So our striped LV holding disks are constantly getting read and write and provide more performance in I/O perspective. Moreover, the default minimum size of a single write can be started from 64k. In our setup, we are going to use 128k.
What is the use of Striped Logical volume?
- The Striped LV can be created to get more I/O performance by writing data equally across multiple disks.
- For a critical server receives a huge number of reading and write
Important Info
- The minimum number of disks allowed in stripe is 2.
- If you need to extend the striped logical volume we can’t extend only by adding 1 PV, It’s only possible to extend a striped logical volume by adding all numbers of the striped count. In our case, our stripe count is 4 (disks). So extending is only possible by adding 4 numbers of 100G disks this is one of the drawbacks in the striped logical volume.
Logical Volume Management Series
- Create Logical volume management LVM file-system in Linux
- Extend and Reduce LVM Logical Volume Management in Linux
- Shrink a Volume Group in Logical Volume Management (LVM)
- Creating Striped Logical Volumes in LVM
- Migrate from single-partition boot device to LVM in CentOS7
- Creating a Logical volume-based file system using Ansible
List and verify the Current Setup
Before starting with our setup let’s list out all the present block devices, physical volume, volume group and logical volumes.
Knowing much information about the current setup is important before preparing a new setup.
We have 4 numbers of disks in the above output.
Creating a Physical Volume
Start by creating the required physical volumes. As we said before, we have four numbers of 100 GB disks. Prepare the disk’s partition before starting with creating PV.
Using four disks create the Physical volume. Creating PV can be done in several ways by pointing to each disk are using a range of disks and their partition.
Use “-v” to print more information while creating the PV.
List the created Physical volumes.
Creating a Volume Group
Using created PV’s let’s create the volume group. As we have seen above step the same way we can follow for VG as well.
List the created Physical volumes.
Creating a Volume Group
Using created PV’s let’s create the volume group. As we have seen above step the same way we can follow for VG as well.
Run the command with the “-v” option to get verbose information.
After creating the Volume group display the VG to know more detailed information about the VG.
- Volume Group name
- The total size of Volume group
- Available physical extents (PE) in this VG.
- Allocated physical extents (PE).
- Available Free PE or size in Unit.
While using -v option the residing physical volume information will be print on the screen with details like Total PE, Free PE, PV device name, UUID and status.
Create a Striped Logical Volume
Creating a striped logical volume is similar to just creating a linear logical volume but additionally with only two options.
- lvcreate – command to create a logical volume.
- -L 100 G – Creating with Unit size.
- -i 4 – Number of Stripes (Disk need to be used for stripes)
- -I 128k – Size of a single stripe.
- -n – Naming the striped logical volume.
- lv_data – Name of the logical volume to be created.
- vg01_data – VG name which used for the logical volume.
Or refer below
- -L – –size (Unit size K,M,G,T,P)
- -i – –stripes Number
- -I – –stripesize (Size can be in Unit size)
- -n – –name | Logical Volume name
Print the created logical volume with the “-m or –maps” option to list all mapped Physical volumes.
- Name of the logical volume we created.
- Volume group used by the Logical volume.
- LM mode, whether it’s in reading/writing mode.
- Size of the striped logical volume.
- The total number of available extents (PE).
- The major and minor number of a block device.
- The type of logical volume.
- The number of stripes used for the logical volume.
- Stripe size used for creating the logical volume.
- Device name used for the striped logical volume.
- physical extents available under each disk.
- Each number of disks used for stripe.
Verify the Disks used under Stripe Volume
To know the Major and Minor number of underlying block devices we can use low-level logical volume management tool “dmsetup” else use the simple command “lsblk“.
However, to find the dependence of a logical volume the dmsetup command will help to print in a clear output.
Match the “dmsetup” and “lsblk” output it should match the disks we are referring.
Creating & mounting the filesystem
Create a filesystem under the created stripe volume.
Mount the created file system
Create a mount point and mount the file system.
That’s it, we have successfully created with a striped logical volume.
Conclusion
We have gone through how to create striped LV in logical volume management using multiple physical volumes. Let’s come-up with more LVM articles in future. Subscribe to the newsletter and stay closer. Your feedbacks are most welcome through below comment section.












