Get the App
SLTechnology News&Howtos  ›  Development  › 

How to create LVM stripe volume in Centos8

Shulou Source: shulou.com Published: 2022-06-01 16:49:58 10月02日 Update

This article introduces the relevant knowledge of "how to create LVM stripe volumes in Centos8". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

working principle

Suppose we are going to write a 32MB file. The first 4 MB (default 1 PE (physical extension) = 4m) will be written to the first disk / dev/sdb1, then the second 4 MB will be written to the second disk / dev/sdc1, the third 4 MB will be written to the third disk / dev/sdd1, the fourth 4 MB will be written to the fourth disk / dev/sde1, and the fifth will start from the first disk / dev/sdb1. This process will be repeated in a circular manner. It provides higher performance from the point of view of Icano. In addition, the default minimum size for a single write can start at 64k. In our setup, we will use 128k. The minimum number of disks allowed in the stripe is 2.

Add 4 hard drives and create physical volumes

Four 20GB hard drives have been added to the system:

Create the physical volume below:

[root@localhost] # pvcreate / dev/sd [Amurd] Physical volume "/ dev/sda" successfully created. Physical volume "/ dev/sdb" successfully created. Physical volume "/ dev/sdc" successfully created. Physical volume "/ dev/sdd" successfully created. Create a volume group [root@localhost ~] # vgcreate vg01_data / dev/sd [amurd] Volume group "vg01_data" successfully created [root@localhost ~] # vgs VG # PV # LV # SN Attr VSize VFree cl 120 wz--n- create a stripe volume [root@localhost ~] # lvcreate-L 20G-I 4-I 128k-n lv_data vg01_data / dev/sd [Amurd] Logical volume "lv_ Data "created.-i 4 stripes-I 128k the size of a single stripe. / dev/sd [aMurd] disk as a stripe volume, / dev/sda,/dev/sdb,/dev/sdc,/dev/sdd

Use the-m option to list the logical volumes created and the physical volumes to which the logical volumes are mapped.

[root@localhost ~] # lvdisplay / dev/vg01_data/lv_data-m verify the disk used by the stripe volume

Use the dmsetup command to refer to the Major and Minor numbers on the disks listed by lsblk to compare whether the disks used are consistent:

[root@localhost ~] # dmsetup deps / dev/vg01_data/lv_data4 dependencies: (8,48) (8,32) (8,16) (8,0) [root@localhost ~] # lsblk format and mount stripe volume

Format the stripe volume and mount it to the / data directory:

[root@localhost ~] # mkdir / data [root@localhost ~] # mkfs.xfs-f / dev/vg01_data/lv_datameta-data=/dev/vg01_data/lv_data isize=512 agcount=16, agsize=327648 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1data = bsize=4096 blocks=5242368 Imaxpct=25 = sunit=32 swidth=128 blksnaming = version 2 bsize=4096 ascii-ci=0, ftype=1log = internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1realtime = none extsz=4096 blocks=0 Rtextents=0 [root@localhost ~] # mount / dev/vg01_data/lv_data / data/ "how to create LVM stripe volumes in Centos8" ends here Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Stripe disk physics minimum three content size more format knowledge hard disk process logic practical consistent learned and then single principle command Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Tech Info Apple macOS Microsoft