LVM (Logical Volume Manager) - LVM with RAID volumes

In this tutorial, we use an example where one solid state drive (SSD) and two hard disk drives (HDD) are connected. We will setup both hard disk drives /dev/sdb and /dev/sdc into a RAID array.


The fdisk command can be used to configure /dev/sdb1 and /dev/sdc1 with the RAID type. Once configured, the fdisk -l command can then be used to see that /dev/sdb1 and /dev/sdc1 are using the RAID system.

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   209715199   104856576   fd  Linux raid autodetect
/dev/sdc1            2048   209715199   104856576   fd  Linux raid autodetect


Use the vgdisplay command to get the name of the LVM volume group. In this example, the name of the volume group is vg001.

[root@server1 ~]# vgdisplay
--- Volume group ---
VG Name            vg001
VG Size            2.0 TiB
Alloc PE / Size    474623 / 2.0 TiB
Free PE / Size     0 / 0


Use the vgextend command to add /dev/sdb1 and /dev/sdc1 to the volume group.

vgextend vg001 /dev/sdb1
vgextend vg001 /dev/sdc1


Use the lvcreate command to create two logical volumes.

lvcreate --size 1G --name lv001 vg001
lvcreate --size 1G --name lv002 vg001


Configure each logical volume with the XFS file system.

mkfs.xfs /dev/vg001/lv001
mkfs.xfs /dev/vg001/lv002


/dev/sda (SSD), /dev/sdb (HDD1), and /dev/md0 (HDD2) are now members of volume group "centos." Now we move the /dev/sdb physical volume into /dev/md0, so that both /dev/sdb (HDD1) and /dev/sdc (HDD2) are part of /dev/md0.

[root@server1 ~]# pvmove /dev/sdb1 /dev/md0


Display information about the current logical volumes.

[root@server1 ~]# lvdisplay
--- Logical volume ---
LV Path        /dev/centos/root
LV Name        root
VG Name        centos
LV Size        2.0 TiB


The lvcreate command with the -n or --name and -L or --size can be used to create a new logical volume. In this example, a new 2TB logical volume named MyLogicalVolume is created in MyVolumeGroup.

[root@server1 ~]# lvcreate --name MyLogicalVolume --size 2TB MyVolumeGroup
--name mirror --
size 2TB MyLogicalVolume


lvscan shows a simple summary of the logical volumes.

[root@server1 ~]# lvscan
ACTIVE    /dev/centos
/root   [2.0 TiB] inherit
ACTIVE    /dev/centos
/mirror [2.0 TiB] inherit


There is now a logical volume /dev/centos/root which used 2TB of capacity from physical volume /dev/sdb. Also, there is a logical volume /dev/centos/mirror which uses 2TB of capacity from /dev/sdc.


Determine the file system type for the first HDD. In this example, the first HDD is using the ext4 filesystem.

[root@server1 ~]# df -T
/dev/mapper/centos-root     ext4


Use the same filesystem type for the second HDD.  In /dev/centos/mirror, "centos" is the name of the volume group, and "mirror" is the name of the logical volume.

[root@server1 ~]# mkfs.ext4 /dev/centos/mirror


fdisk -l should now have a listing for /dev/mapper/centos-mirror.


Add an entry to /etc/fstab.

/dev/mapper/centos-root    /            ext4    defaults  1 1
/dev/mapper/centos-mirror  /mnt/test    ext4    defaults  1 1


Reboot the OS.

[root@server1 ~]# reboot


Both the first HDD (/dev/mapper/centos-root) and second HDD (/dev/mapper/centos-mirror) should be listed in the output of the df -T command.

[root@server1 ~]# df -T
/dev/mapper/centos-root     ext4
/dev/mapper/centos-mirror   ext4



"A Beginner's Guide To LVM - Page 6 - Page 6." A Beginner's Guide To LVM - Page 6 - Page 6. HowtoForge, n.d. Web. 26 Mar. 2016. <>.



Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 80e49 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |