Striped Logical Volumes - Overview
When we create a Linear logical volume, the LVM assigns a range of physical extents to an area of a logical volume in order. It could be a single disk or more. However, we can control the way the data is written to the physical volumes by creating a striped logical volume.
The benefits of using LVM Striping features are;
- Striping enhances performance of disks by increasing I/O. For large sequential reads and writes, this can improve the efficiency of the data I/O.
- With striping, I/O can be done in parallel. Reduces Disk IO Wait by writing data over multiple disks simultaneously.
- We can manage the disk space issues by creating striping over multiple disks. This can help to reduce the Disk fill-up issue.
Lab Environment and Requirements
Root access to a Linux System of any distribution with two or more number of Additional Disks attached are required. We have used 4x10GB of additional disks which will use for different sections during the course of this tutorial for testing.
Before learning the Striped Volumes, We need to have a basic understanding of the Logical Volume Manager and knowledge in creating basic linear logical volumes. Please refer the following articles for more information about LVM :
Beginners guide to how LVM works in Linux
(architecture)
Manage
Logical Volume in Linux – One STOP Solution
Note: Change the device names as it is in your system. You can change the Volume group name or Logical volume names as per your understanding
Create Striped Logical Volumes
Once you have added the disks to your Linux server, you can proceed with the following steps to create striped logical volumes:
Step 1. Create Device Partition
In the initial step let us create disk partitions. We are using only 2x10GB drives here.
We can use parted or fdisk for partitioning. In the example, we have
used parted utility. fdisk to create disk
partitions:
[root@lvm-setup ~]# parted --script /dev/sdb "mklabel gpt"
[root@lvm-setup ~]# parted --script /dev/sdb "mkpart 'LVM2' 0% 100%"
[root@lvm-setup ~]# parted --script /dev/sdb "set 1 lvm on"
[root@lvm-setup ~]# parted --script /dev/sdc "mklabel gpt"
[root@lvm-setup ~]# parted --script /dev/sdc "mkpart 'LVM2' 0% 100%"
[root@lvm-setup ~]# parted --script /dev/sdc "set 1 lvm on"
Step 2. Create Physical Volume
Now let’s create the Physical volumes using partitions /dev/sdb1 and
/dev/sdc1
[root@lvm-setup ~]# pvcreate /dev/sdb1 /dev/sdc1
Sample Output:
![Create & Manage Striped Logical Volumes Linux [Step-by-Step]](/striped-logical-volume-linux/lvm-7.webp)
Step 3. Create Volume Group
In the example, we have created a VG named volgroup_striped from the
PVs /dev/sdb1 and /dev/sdc1. We will be using this VG
volgroup_striped across these tutorials.
[root@lvm-setup ~]# vgcreate volgroup_striped /dev/sdb1 /dev/sdc1
Volume group "volgroup_striped" successfully created
Step 4. Creating a Striped Logical Volume
Here is an example to create a striped volume lv_striped using VG
volgroup_striped :
[root@lvm-setup ~]# lvcreate -i2 -I64 -L2G -n lv_striped volgroup_striped
Logical volume "lv_striped" created.
From the above example
- -i2 means the
number of stripesthat need to be created. Here we are using 2 disks, so 2 stripes. - -I64 means the
stripesizein KB. The stripe size used was 64 KB (the default). - -L2G is the
size of the Logical volume. We have used 2GB of size. - -n for the
nameof the volume.
Let’s check the created striped volume using lvs command. From the
output, we can confirm the volume is created using /dev/sdb1 and
/dev/sdc1
[root@lvm-setup ~]# lvs -a -o +devices -o +segtype
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices Type
lv_striped volgroup_striped -wi-a----- 2.00g /dev/sdb1(0),/dev/sdc1(0) striped
Step 5. Create filesystem and mount the striped volume
Here we are creating ext4 filesystem and mount the striped volume. Please refer for more information: Create file systems and mount the Logical Volumes
[root@lvm-setup ~]# mkfs.ext4 /dev/volgroup_striped/lv_striped
Sample Output:
![Create & Manage Striped Logical Volumes Linux [Step-by-Step]](/striped-logical-volume-linux/lvm-8.webp)
Mount this Logical Volume temporarily to /mnt. You can use any mount
points to mount it.
[root@lvm-setup ~]# mount /dev/volgroup_striped/lv_striped /mnt
[root@lvm-setup ~]# df -h /mnt
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/volgroup_striped-lv_striped 2.0G 6.0M 1.8G 1% /mnt
Step 6. Create some test files under striped volume
Now you can go ahead and access your striped logical volume and store data. Here just for demonstration we have created some files and directories on our striped LVM.
[root@lvm-setup ~]# cd /mnt
[root@lvm-setup mnt]# touch testfile.txt
[root@lvm-setup mnt]# ls -al
total 16
drwx------ 2 root root 16384 Aug 11 11:44 lost+found
-rw-r--r-- 1 root root 0 Aug 11 11:49 testfile.txt
[root@lvm-setup mnt]# ls -l
total 16
drwx------ 2 root root 16384 Aug 13 10:51 lost+found
-rw-r--r-- 1 root root 0 Aug 13 10:52 teststripe.txt
Convert existing Striped Logical Volume to a Linear Logical Volume
There is no direct command to convert striped LV to Linear. First, we need to convert the striped into a mirrored logical volumeand convert the mirrored volume back to linear. Let us discuss this in the following steps.
Step 1. Add a new drive to the Volume Group
As discussed, we need to create the partitions for the new drive and
create PV. When you are adding a new drive, you need to make sure that
the new drive has enough space to hold the data from the striped
volumes. Then we need to add the new drive to our existing VG
volgroup_striped
In the example, I am adding a new drive /dev/sdd1 to the VG
volgroup_striped
[root@lvm-setup ~]# parted --script /dev/sdd "mklabel gpt"
[root@lvm-setup ~]# parted --script /dev/sdd "mkpart 'LVM2' 0% 100%"
[root@lvm-setup ~]# parted --script /dev/sdd "set 1 lvm on"
[root@lvm-setup ~]# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created.
[root@lvm-setup ~]# vgextend volgroup_striped /dev/sdd1
Volume group "volgroup_striped" successfully extended
Step 2. Convert striped volume into mirrored logical volume
Let us convert the striped volume lv_striped to mirrored volume. The
mirror will be created under the new disk /dev/sdd1.
When you are using huge size disks the process will take hours to
complete. You need to run these commands in the screen. In the below
command with option --mirrorlog core. I have kept the logs in the system
memory. We can also add another physical device to the Volume group
so that the logs can be kept on the disk and then try to run the
lvconvert command. -m1 is used for one mirror.
[root@lvm-setup ~]# lvconvert -m1 --type mirror --corelog /dev/volgroup_striped/lv_striped /dev/sdd1
Logical volume volgroup_striped/lv_striped being converted.
volgroup_striped/lv_striped: Converted: 0.00%
volgroup_striped/lv_striped: Converted: 13.67%
volgroup_striped/lv_striped: Converted: 27.34%
volgroup_striped/lv_striped: Converted: 41.41%
volgroup_striped/lv_striped: Converted: 54.10%
volgroup_striped/lv_striped: Converted: 66.60%
volgroup_striped/lv_striped: Converted: 79.69%
volgroup_striped/lv_striped: Converted: 92.97%
volgroup_striped/lv_striped: Converted: 100.00%
The below output shows that the striped volume is also mirrored.
[root@lvm-setup ~]# lvs -a -o +segtype
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Type
lv_striped volgroup_striped mwi-a-m--- 2.00g 100.00 mirror
[lv_striped_mimage_0] volgroup_striped iwi-aom--- 2.00g striped
[lv_striped_mimage_1] volgroup_striped iwi-aom--- 2.00g linear
Step 3. Convert mirrored volume into Linear volume
Here we are converting the mirrored volume into a Linear volume by
removing the PVs /dev/sdb1 and /dev/sdc1. If you remember, these two
physical volumes are used to create a striped volume. So, we are
removing those as we have a mirrored copy in /dev/sdd1. -m0 is used
for zero mirrors.
[root@lvm-setup ~]# lvconvert -m 0 /dev/volgroup_striped/lv_striped /dev/sdb1 /dev/sdc1
Logical volume volgroup_striped/lv_striped converted.
We are safely converted our striped logical volume to linear. The below
output shows the volume is now existing only in /dev/sdd1 as linear.
[root@lvm-setup ~]# lvs -a -o +devices -o +segtype
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices Type
lv_striped volgroup_striped -wi-ao---- 2.00g /dev/sdd1(0) linear
We can also confirm the data we stored under the mounted volume. Which will remain safe.
Convert existing Linear Logical Volume to a Striped Logical Volumes
As same as in the above section, there is no direct command to convert Linear LV to Striped Logical Volume. We need to convert the Linear LV to mirrored LV with stripes(Mirroring using 2 drives). Then we can convert it into Striped LV by removing the existing device (One drive mirror).
Let us find the physical volume(s) that hold a logical volume using
lvs command as below. In the example, the linear logical volume is
under PV /dev/sdd1.
[root@lvm-setup ~]# lvs -a -o +devices -o +segtype
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices Type
lv_striped volgroup_striped -wi-ao---- 2.00g /dev/sdd1(0) linear
Step 1: Attach additional disks.
In the example we already have 2 additional PV /dev/sdb1 and
/dev/sdc1. If you do not have the ones; need to re-add the drives.
Refer Managing LVM Physical
Volumes
Also, the PVs are already added to the VG volgroup_striped. If not,
need to add those Add Physical Volumes to a Volume
Group
[root@lvm-setup ~]# pvs
Sample Output:
![Create & Manage Striped Logical Volumes Linux [Step-by-Step]](/striped-logical-volume-linux/lvm-9.webp)
Step 2. Create a mirror of the current data
Let us create a mirror of the current
data /dev/volgroup_striped/lv_striped to the additional available
devices /dev/sdb1 and /dev/sdc1. In the below example we have
created a mirror And make it stripe (--stripes <number of disks>).
Depending on the size of the conversion this will take time. Do this in a screen if the size of the data is large.
[root@lvm-setup ~]# lvconvert --mirrors 1 /dev/volgroup_striped/lv_striped --mirrorlog core --type mirror --stripes 2
Using default stripesize 64.00 KiB.
Logical volume volgroup_striped/lv_striped being converted.
volgroup_striped/lv_striped: Converted: 0.00%
volgroup_striped/lv_striped: Converted: 12.30%
volgroup_striped/lv_striped: Converted: 24.02%
volgroup_striped/lv_striped: Converted: 36.13%
volgroup_striped/lv_striped: Converted: 48.63%
volgroup_striped/lv_striped: Converted: 60.35%
volgroup_striped/lv_striped: Converted: 72.46%
volgroup_striped/lv_striped: Converted: 84.57%
volgroup_striped/lv_striped: Converted: 96.48%
volgroup_striped/lv_striped: Converted: 100.00%
Once it’s converted, you will see the below results. Where the the disk
/dev/sdd1 is mirrored by stripes /dev/sdb1 and /dev/sdc1.
[root@lvm-setup ~]# lvs -a -o +devices -o +segtype
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices Type
lv_striped volgroup_striped mwi-aom--- 2.00g 100.00 lv_striped_mimage_0(0),lv_striped_mimage_1(0) mirror
[lv_striped_mimage_0] volgroup_striped iwi-aom--- 2.00g /dev/sdd1(0) linear
[lv_striped_mimage_1] volgroup_striped iwi-aom--- 2.00g /dev/sdb1(0),/dev/sdc1(0) striped
Step 3. Remove the mirror
In this step let us remove the mirror. -m0 will set the volume with No
mirror. In the example, we are removing the original drive
/dev/sdd1.
[root@lvm-setup ~]# lvconvert -m0 /dev/volgroup_striped/lv_striped /dev/sdd1
Logical volume volgroup_striped/lv_striped converted.
Now the volume has been converted into striped volume with stripes /dev/sdb1 and /dev/sdc1.
[root@lvm-setup ~]# lvs -a -o +devices -o +segtype
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices Type
lv_striped volgroup_striped -wi-ao---- 2.00g /dev/sdb1(0),/dev/sdc1(0) striped
Extend Striped volume by adding new Disks
In order to increase the size of a striped logical volume, there must be enough free space on the underlying physical volumes that make up the volume group to support the stripe. For example, if you have a two-way stripe that uses up an entire volume group, adding a single physical volume to the volume group will not enable you to extend the stripe. Instead, you must add at least two physical volumes to the volume group.
In the below example the striped volume is using /dev/sdb1 and
/dev/sdc1. We can extend the volume up to 20GB. However, if you try to
extend up to the VG size 29.99G, the volume group will not enable
you to extend the stripe. Instead it will use a single additional disk
to act as a linear volume.
The below commands list the current status of the striped logical volume.
# LV status
[root@lvm-setup ~]# lvs -a -o +devices -o +segtype
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices Type
lv_striped volgroup_striped -wi-a----- 2.00g /dev/sdb1(0),/dev/sdc1(0) striped
# PV status
[root@lvm-setup ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 volgroup_striped lvm2 a-- <10.00g <9.00g
/dev/sdc1 volgroup_striped lvm2 a-- <10.00g <9.00g
/dev/sdd1 volgroup_striped lvm2 a-- <10.00g <10.00g
# VG status
[root@lvm-setup ~]# vgs
VG #PV #LV #SN Attr VSize VFree
volgroup_striped 3 1 0 wz--n- <29.99g <27.99g
When we try to extend the striped volume to 29GB, you will get the
below error;
[root@lvm-setup ~]# lvextend /dev/volgroup_striped/lv_striped -L 29G
Using stripesize of last segment 64.00 KiB
Insufficient suitable allocatable extents for logical volume lv_striped: 2306 more required
However, it is possible to extend the volume anyway if it does not
matter that the extension is not striped, which may result in an
uneven performance. The following example extends the existing
striped logical volume to use the remaining free space in VG
volgroup_striped after the initial <tt>lvextend</tt> command fails.
We are not trying this command as we are extending striped volume with another additional disk in the next step.
[root@lvm-setup ~]# lvextend -iL -l+100%FREE vg/stripe1
Step 1: Add Additional disks to Volume Group
As discussed, we have a two-way stripe that uses up an entire volume group. We must add at least two physical volumes to the volume group to extend with stripes.
In the example we are extending the VG with another disk /dev/sde1 .
Now we have a total of 4x10GB drives. Refer the article for more
information about partitioning and extending volume
groups.
[root@lvm-setup ~]# pvcreate /dev/sde1
Physical volume "/dev/sde1" successfully created.
[root@lvm-setup ~]# vgextend volgroup_striped /dev/sde1
Volume group "volgroup_striped" successfully extended
[root@lvm-setup ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 volgroup_striped lvm2 a-- <10.00g <9.00g
/dev/sdc1 volgroup_striped lvm2 a-- <10.00g <9.00g
/dev/sdd1 volgroup_striped lvm2 a-- <10.00g <10.00g
/dev/sde1 volgroup_striped lvm2 a-- <10.00g <10.00g
Once the VG is extended we have 4 PVs with around 40GB of free space.
[root@lvm-setup ~]# vgs
VG #PV #LV #SN Attr VSize VFree
volgroup_striped 4 1 0 wz--n- 39.98g 37.98g
Step 2 : Extend the Striped volume with additional disks
Now, if we try to extend the volume with the available 39GB space, it will extend without any errors.
[root@lvm-setup ~]# lvextend /dev/volgroup_striped/lv_striped -L 39G
Using stripesize of last segment 64.00 KiB
Size of logical volume volgroup_striped/lv_striped changed from 2.00 GiB (512 extents) to 39.00 GiB (9984 extents).
Logical volume volgroup_striped/lv_striped successfully resized.
We can confirm the striped volumes in the below lvs output. It has
created two-way striping with 2 PVs each.
[root@lvm-setup ~]# lvs -a -o +devices -o +segtype
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices Type
lv_striped volgroup_striped -wi-a----- 39.00g /dev/sdb1(0),/dev/sdc1(0) striped
lv_striped volgroup_striped -wi-a----- 39.00g /dev/sdd1(0),/dev/sde1(0) striped
Step 2: Extend the filesystem
Once the Logical volume is extended, we also need to extend the filesystem. Before extending the filesystem, it will show up only existing disk space.
[root@lvm-setup ~]# df -h /mnt
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/volgroup_striped-lv_striped 2.0G 6.0M 1.8G 1% /mnt
To extend the ext filesystems use resize2fs. Once the resize2fs is
finished, the mounted filesystem will show the proper size. For more
info refer : Create file systems and mount the Logical
Volumes
[root@lvm-setup ~]# resize2fs /dev/mapper/volgroup_striped-lv_striped
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/mapper/volgroup_striped-lv_striped is mounted on /mnt; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 5
The filesystem on /dev/mapper/volgroup_striped-lv_striped is now 10223616 (4k) blocks long.
[root@lvm-setup ~]# df -h /mnt
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/volgroup_striped-lv_striped 39G 12M 37G 1% /mnt
Summary
In this article we covered following topics:
- How to create striped logical volume
- How to convert striped to linear logical volume and vice versa
- How to extend the size of existing striped logical volume
References
CREATING A STRIPED LOGICAL VOLUME
Setting up LVM on three SCSI disks with
striping

![Create & Manage Striped Logical Volume Linux [Step-by-Step]](/striped-logical-volume-linux/striped_lvm.jpg)
