How To Manage Multiple LVM Disk Using Striping IO
To Manage Multiple Logical Volume Management Disks using Striping IO
Logical Volume Management Stripping allows to write data over multiple disk which in-turn increases the performance and efficiency of the disk. Managing Multiple LVM Disk Using Stripping IO is discussed in this manual.
Features
- Increase the performance of disk.
- Saves from hard write over to a single disk.
- Reduce disk fill-up using striping over multiple disk.
Manage Logical Volume using Striping I/O
We have totally 6 hard disk and sda hard disk is used by the system OS. Run the following command to list the devices as shown below.
[root@linuxhelp ~]# ls -l /dev | grep sd
brw-rw----. 1 root disk 8, 0 Apr 26 12:22 sda
brw-rw----. 1 root disk 8, 1 Apr 26 12:22 sda1
brw-rw----. 1 root disk 8, 2 Apr 26 12:22 sda2
brw-rw----. 1 root disk 8, 3 Apr 26 12:22 sda3
brw-rw----. 1 root disk 8, 16 Apr 26 12:25 sdb
brw-rw----. 1 root disk 8, 17 Apr 26 12:25 sdb1
brw-rw----. 1 root disk 8, 32 Apr 26 12:26 sdc
brw-rw----. 1 root disk 8, 33 Apr 26 12:26 sdc1
brw-rw----. 1 root disk 8, 48 Apr 26 12:26 sdd
brw-rw----. 1 root disk 8, 49 Apr 26 12:26 sdd1
brw-rw----. 1 root disk 8, 64 Apr 26 12:27 sde
brw-rw----. 1 root disk 8, 65 Apr 26 12:27 sde1
brw-rw----. 1 root disk 8, 80 Apr 26 12:28 sdf
brw-rw----. 1 root disk 8, 81 Apr 26 12:28 sdf1
We have created partitions for these 5 hard drives sdb, sdc, sdd, sde and sdf each of size 2 GB using ‘ fdisk‘ command.
[root@linuxhelp ~]# fdisk -l | grep sd
Disk /dev/sdd: 4294 MB, 4294967296 bytes, 8388608 sectors
/dev/sdd1 2048 4196351 2097152 8e Linux LVM
Disk /dev/sdc: 4294 MB, 4294967296 bytes, 8388608 sectors
/dev/sdc1 2048 4196351 2097152 8e Linux LVM
Disk /dev/sde: 4294 MB, 4294967296 bytes, 8388608 sectors
/dev/sde1 2048 4196351 2097152 8e Linux LVM
Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors
/dev/sda1 * 2048 616447 307200 83 Linux
/dev/sda2 616448 4810751 2097152 82 Linux swap / Solaris
/dev/sda3 4810752 35530751 15360000 83 Linux
Disk /dev/sdb: 4294 MB, 4294967296 bytes, 8388608 sectors
/dev/sdb1 2048 4196351 2097152 8e Linux LVM
Disk /dev/sdf: 4294 MB, 4294967296 bytes, 8388608 sectors
/dev/sdf1 2048 4196351 2097152 8e Linux LVM
For more information about the fdisk, use the following link.
www.linuxhelp.com/fdisk-command
To create Physical volumes
Use the following command to create physical volumes as shown below,
[root@linuxhelp ~]# pvcreate /dev/sd[b-f]1 -v
Set up physical volume for " /dev/sdb1" with 4194304 available sectors
Zeroing start of device /dev/sdb1
Writing physical volume data to disk " /dev/sdb1"
Physical volume " /dev/sdb1" successfully created
Set up physical volume for " /dev/sdc1" with 4194304 available sectors
Zeroing start of device /dev/sdc1
Writing physical volume data to disk " /dev/sdc1"
Physical volume " /dev/sdc1" successfully created
Set up physical volume for " /dev/sdd1" with 4194304 available sectors
Zeroing start of device /dev/sdd1
Writing physical volume data to disk " /dev/sdd1"
Physical volume " /dev/sdd1" successfully created
Set up physical volume for " /dev/sde1" with 4194304 available sectors
Zeroing start of device /dev/sde1
Writing physical volume data to disk " /dev/sde1"
Physical volume " /dev/sde1" successfully created
Set up physical volume for " /dev/sdf1" with 4194304 available sectors
Zeroing start of device /dev/sdf1
Writing physical volume data to disk " /dev/sdf1"
Physical volume " /dev/sdf1" successfully created
Run the following command to list the physical volumes that we have created.
[root@linuxhelp ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb1 lvm2 a-- 2.00g 2.00g
/dev/sdc1 lvm2 a-- 2.00g 2.00g
/dev/sdd1 lvm2 a-- 2.00g 2.00g
/dev/sde1 lvm2 a-- 2.00g 2.00g
/dev/sdf1 lvm2 a-- 2.00g 2.00g
Now create volume group using those 5 physical volumes by executing the following command.
[root@linuxhelp ~]# vgcreate -s 32M vg1 /dev/sd[b-f]1 -v
Adding physical volume ' /dev/sdb1' to volume group ' vg1'
Adding physical volume ' /dev/sdc1' to volume group ' vg1'
Adding physical volume ' /dev/sdd1' to volume group ' vg1'
Adding physical volume ' /dev/sde1' to volume group ' vg1'
Adding physical volume ' /dev/sdf1' to volume group ' vg1'
Archiving volume group " vg1" metadata (seqno 0).
Creating volume group backup " /etc/lvm/backup/vg1" (seqno 1).
Volume group " vg1" successfully created
Explanation
[b-e]1 &ndash It defines our hard drive names such as sdb1, sdc1, sdd1, sde1.
-s &ndash It defines our physical extent size.
-v &ndash verbose.
Use vgdisplay command to know more information about Volume Group ' vg1' .
[root@linuxhelp ~]# vgdisplay vg1 -v
Using volume group(s) on command line
Finding volume group " vg1"
--- Volume group ---
VG Name vg1
System ID
Format lvm2
Metadata Areas 5
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 5
Act PV 5
VG Size 9.84 GiB
PE Size 32.00 MiB
Total PE 315
Alloc PE / Size 0 / 0
Free PE / Size 315 / 9.84 GiB
VG UUID CEIF1J-mwTn-Rb0r-azea-q8dy-O4lL-VzhbBb
--- Physical volumes ---
PV Name /dev/sdb1
PV UUID y6agXC-Ug7z-1BOL-oo6T-KOjz-47Zd-gpSeBW
PV Status allocatable
Total PE / Free PE 63 / 63
PV Name /dev/sdc1
PV UUID R2pgW0-fpvg-hHS7-A3i2-VcGX-9WVc-7FBVOY
PV Status allocatable
Total PE / Free PE 63 / 63
PV Name /dev/sdd1
PV UUID 2N7Umt-kQNE-gVRU-Fywd-x3VP-PBkH-e9o7qB
PV Status allocatable
Total PE / Free PE 63 / 63
PV Name /dev/sde1
PV UUID B2vTHA-Ec1E-3xgs-VLdi-ew2d-9LbX-TqYWlL
PV Status allocatable
Total PE / Free PE 63 / 63
PV Name /dev/sdf1
PV UUID eCYQGq-WRco-I20r-mmVd-kBHL-MEBY-vd2rdm
PV Status allocatable
Total PE / Free PE 63 / 63
To Create Logical Volume
Create Logical volume, by defining the stripe value as shown below.
[root@linuxhelp ~]# lvcreate -L 1.5G -n lv1 -i5 vg1
Using default stripesize 64.00 KiB
Rounding size (48 extents) up to stripe boundary size (50 extents).
Logical volume " lv1" created
Explanation
-L is the logical volume size
-n is the logical volume name
-i is the stripes
The above output shows that the default stripe-size is 64 KB.
Run the following command to check the logical volumes.
[root@linuxhelp ~]# lvdisplay vg1/lv1 -m
--- Logical volume ---
LV Path /dev/vg1/lv1
LV Name lv1
VG Name vg1
LV UUID d1F6Fa-a6sd-8ydc-WufU-BWCu-t18c-FLdvS4
LV Write Access read/write
LV Creation host, time linuxhelp, 2016-04-26 12:50:48 +0530
LV Status available
# open 0
LV Size 1.56 GiB
Current LE 50
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1280
Block device 253:0
--- Segments ---
Logical extent 0 to 49:
Type striped
Stripes 5
Stripe size 64.00 KiB
Stripe 0:
Physical volume /dev/sdb1
Physical extents 0 to 9
Stripe 1:
Physical volume /dev/sdc1
Physical extents 0 to 9
Stripe 2:
Physical volume /dev/sdd1
Physical extents 0 to 9
Stripe 3:
Physical volume /dev/sde1
Physical extents 0 to 9
Stripe 4:
Physical volume /dev/sdf1
Physical extents 0 to 9
Now we will define a stripe with the customized size of 256 KB and logical volume of 2 GB using the following command.
[root@linuxhelp ~]# lvcreate -L 2G -i4 -I 256 -n lv2 vg1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Logical volume " lv2" created
The Logical volume was created. Lets display it by using the following command.
[root@linuxhelp ~]# lvdisplay vg1/lv2 -m
--- Logical volume ---
LV Path /dev/vg1/lv2
LV Name lv2
VG Name vg1
LV UUID Ypfe9c-pAu9-2rjy-0NE4-Rz87-hWJq-MNs26Z
LV Write Access read/write
LV Creation host, time linuxhelp, 2016-04-26 12:59:28 +0530
LV Status available
# open 0
LV Size 2.00 GiB
Current LE 64
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 4096
Block device 253:1
--- Segments ---
Logical extent 0 to 63:
Type striped
Stripes 4
Stripe size 256.00 KiB
Stripe 0:
Physical volume /dev/sdb1
Physical extents 10 to 25
Stripe 1:
Physical volume /dev/sdc1
Physical extents 10 to 25
Stripe 2:
Physical volume /dev/sdd1
Physical extents 10 to 25
Stripe 3:
Physical volume /dev/sde1
Physical extents 10 to 25
Check the dependency of the strips by using the following ' dmsetup' command.
[root@linuxhelp ~]# dmsetup deps /dev/vg1/lv[1-2]
/dev/vg1/lv1: 5 dependencies : (8, 81) (8, 65) (8, 49) (8, 33) (8, 17)
/dev/vg1/lv2: 4 dependencies : (8, 65) (8, 49) (8, 33) (8, 17)
The above result shows that stripe 1 depends on 5 drives and stripe 2 depends on 4 devices.
Comments ( 0 )
No comments available