在 CentOS Linux 7 上使用多块磁盘配置 LVM 条带化逻辑卷

什么是条带化:

当多个进程同时访问一个磁盘时,可能会出现磁盘冲突。磁盘系统对访问次数(每秒的 I / O 操作,IOPS )和数据传输速率(读写速率,TPS )有限制。当达到这些限制时,后面需要访问磁盘的进程就需要挂起等待,这就是磁盘冲突。避免磁盘冲突是优化 I / O 性能的一个重要目标。

条带化技术是一种自动的将 I / O 负载均衡到多个物理磁盘上的技术。条带化技术将一块连续的数据分成很多小部分,并把他们分别存储到不同的磁盘上去。这样就能使多个进程同时访问数据的多个不同部分而不会造成磁盘冲突,最大化 I / O 性能。

LVM 的条带化:为了性能考虑,将数据跨越多个磁盘存储,即把 LV 上连续的数据分成大小相同的块,然后依次存储在各个物理磁盘 PV 上,类似于 RAID0 的数据存放形式,实现数据读写的并发;管理员依据自己的数据需求,定义数据分块大小,自行设置 PV 物理磁盘个数,从而实现读写性能最佳化。

粗略来讲,条带化 strip 就是 RAID0 。

LVM
LVM

部署:

1、当前服务器的操作系统版本为:

[root@host ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core)

2、先关掉这台服务器,接着往这台服务器插入三块 1 TB SATA 的物理磁盘,然后开机。

3、yum 安装 lvm2 :

[root@host ~]# yum install -y lvm2
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * elrepo: hkg.mirror.rackspace.com
Package 7:lvm2-2.02.177-4.el7.x86_64 already installed and latest version
Nothing to do
[root@root ~]#
[root@host ~]# yum update -y lvm2
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * elrepo: hkg.mirror.rackspace.com
No packages marked for update
[root@root ~]#
[root@host ~]# rpm -qa|grep lvm
lvm2-libs-2.02.177-4.el7.x86_64
lvm2-2.02.177-4.el7.x86_64
[root@root ~]#

4、使用 lsblk 和 fdisk -l 命令来查看当前服务器上插入磁盘的情况:

[root@host ~]# lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdd      8:48   0 931.5G  0 disk 
└─sdd1   8:49   0   200M  0 part 
sdb      8:16   0 931.5G  0 disk 
└─sdb1   8:17   0  39.1G  0 part 
sr0     11:0    1  1024M  0 rom  
sdc      8:32   0 931.5G  0 disk 
sda      8:0    0 465.8G  0 disk 
├─sda4   8:4    0     1K  0 part 
├─sda2   8:2    0    20G  0 part /
├─sda5   8:5    0 429.2G  0 part /www
├─sda3   8:3    0  16.4G  0 part [SWAP]
└─sda1   8:1    0   200M  0 part /boot
[root@host ~]#
[root@host ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0001ddca

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
/dev/sda2          411648    42354687    20971520   83  Linux
/dev/sda3        42354688    76695551    17170432   82  Linux swap / Solaris
/dev/sda4        76695552   976773119   450038784    5  Extended
/dev/sda5        76697600   976773119   450037760   83  Linux

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00071efa

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048      411647      204800   83  Linux

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xde5178ac

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63    81915434    40957686    7  HPFS/NTFS/exFAT
[root@host ~]#

可以看到当前服务器上一共插入了四块物理磁盘,一块是之前插入的 500 GB SATA 物理磁盘( /dev/sda ),还有刚刚插入的三块 1 TB SATA 物理磁盘( /dev/sdb 、/dev/sdc 和 /dev/sdd )。

5、因为刚刚插入的三块 1 TB SATA 物理磁盘( /dev/sdb 、/dev/sdc 和 /dev/sdd )都是被使用过的硬盘,通过上面的 lsblk 和 fdisk -l 命令可以看到 /dev/sdb 和 /dev/sdd 这两款物理磁盘还存在一些分区,现在使用 fdisk 命令删除这些分区:

( 1 )/dev/sdb :

[root@host ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xde5178ac

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63    81915434    40957686    7  HPFS/NTFS/exFAT

Command (m for help): d
Selected partition 1
Partition 1 is deleted

Command (m for help): p

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xde5178ac

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@host ~]#

( 2 )/dev/sdd :

[root@host ~]# fdisk /dev/sdd
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00071efa

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048      411647      204800   83  Linux

Command (m for help): d
Selected partition 1
Partition 1 is deleted

Command (m for help): p

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00071efa

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@host ~]#

6、现在这三块 1 TB SATA 物理磁盘( /dev/sdb 、/dev/sdc 和 /dev/sdd )下面都没有分区了:

[root@host ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0001ddca

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
/dev/sda2          411648    42354687    20971520   83  Linux
/dev/sda3        42354688    76695551    17170432   82  Linux swap / Solaris
/dev/sda4        76695552   976773119   450038784    5  Extended
/dev/sda5        76697600   976773119   450037760   83  Linux

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00071efa

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xde5178ac

   Device Boot      Start         End      Blocks   Id  System
[root@host ~]#

7、使用 pvcreate 命令创建物理卷:

[root@host ~]# pvcreate /dev/sdb /dev/sdc /dev/sdd
WARNING: dos signature detected on /dev/sdb at offset 510. Wipe it? [y/n]: y
  Wiping dos signature on /dev/sdb.
WARNING: ddf_raid_member signature detected on /dev/sdd at offset 1000204885504. Wipe it? [y/n]: y
  Wiping ddf_raid_member signature on /dev/sdd.
WARNING: dos signature detected on /dev/sdd at offset 510. Wipe it? [y/n]: y
  Wiping dos signature on /dev/sdd.
  Physical volume "/dev/sdb" successfully created.
  Physical volume "/dev/sdc" successfully created.
  Physical volume "/dev/sdd" successfully created.
[root@host ~]#

8、使用 vgcreate 命令创建卷组(卷组名设置为 www2 ):

[root@host ~]# vgcreate www2 /dev/sdb /dev/sdc /dev/sdd
  Volume group "www2" successfully created
[root@host ~]#

9、使用 vgdisplay 命令可以查看卷组的详细信息:

[root@host ~]# vgdisplay
  --- Volume group ---
  VG Name               www2
  System ID             
  Format                lvm2
  Metadata Areas        3
  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                3
  Act PV                3
  VG Size               <2.73 TiB
  PE Size               4.00 MiB
  Total PE              715401
  Alloc PE / Size       0 / 0   
  Free  PE / Size       715401 / <2.73 TiB
  VG UUID               yNvgeT-xxxx-xxxx-xxxx-xxxx-xxxx-0NHexc
   
[root@host ~]#

10、使用 lvcreate 命令创建条带化的逻辑卷:

[root@host ~]# lvcreate -L 2780G -i3 -I 64 -n striped www2
  Rounding size 2.71 TiB (711680 extents) up to stripe boundary size 2.71 TiB(711681 extents).
  Logical volume "striped" created.
[root@host ~]#

lvcreate 命令参数说明:

  • -i :指定跨 PV 的个数(目前有三块物理磁盘,故该参数设置为 3 );
  • -I :指定条带单元的大小,对应于 I / O 中数据单元块的大小(数值必须为 2 的幂,单位是 KB );
  • -n :制定卷的名称;
  • -L :卷的大小 。

11、如果需要删除逻辑卷请使用 lvremove 命令:

[root@host ~]# lvremove /dev/www2/striped
Do you really want to remove active logical volume www2/striped? [y/n]: y
  Logical volume "striped" successfully removed
[root@host ~]#

12、如果创建的逻辑卷的容量大小大于卷组的容量则会报以下错误:

[root@host ~]# lvcreate -L 2800G -i3 -I 64 -n striped www2
  Rounding size 2.73 TiB (716800 extents) up to stripe boundary size 2.73 TiB(716802 extents).
  Volume group "www2" has insufficient free space (715401 extents): 716802 required.
[root@host ~]#

13、因为第 11 步已经把创建好的逻辑卷删除了,现在我们把逻辑卷重新创建回来:

[root@host ~]# lvcreate -L 2790G -i3 -I 64 -n striped www2
  Logical volume "striped" created.
[root@host ~]#

14、使用 lvdisplay 命令可以查看逻辑卷的详细信息:

[root@host ~]# lvdisplay /dev/www2/striped
  --- Logical volume ---
  LV Path                /dev/www2/striped
  LV Name                striped
  VG Name                www2
  LV UUID                uWK0wS-AiFr-5rIb-g0ar-Ts5Z-PtfD-9bYdHq
  LV Write Access        read/write
  LV Creation host, time host, 2018-07-11 16:11:44 +0800
  LV Status              available
  # open                 0
  LV Size                2.72 TiB
  Current LE             714240
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     768
  Block device           253:0
   
[root@host ~]#

15、现在使用 fdisk -l 和 df -h 命令来查看当前磁盘和分区的情况:

[root@host ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0001ddca

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
/dev/sda2          411648    42354687    20971520   83  Linux
/dev/sda3        42354688    76695551    17170432   82  Linux swap / Solaris
/dev/sda4        76695552   976773119   450038784    5  Extended
/dev/sda5        76697600   976773119   450037760   83  Linux

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/www2-striped: 2995.7 GB, 2995739688960 bytes, 5851054080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 196608 bytes

[root@host ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs         12G     0   12G   0% /dev
tmpfs            12G     0   12G   0% /dev/shm
tmpfs            12G  8.6M   12G   1% /run
tmpfs            12G     0   12G   0% /sys/fs/cgroup
/dev/sda2        20G  3.1G   17G  16% /
/dev/sda5       429G  359G   71G  84% /www
/dev/sda1       197M  150M   48M  76% /boot
tmpfs           2.4G     0  2.4G   0% /run/user/0
tmpfs           2.4G     0  2.4G   0% /run/user/2032
[root@host ~]#

如上所示,现在可以在 fdisk -l 命令的输出结果中看到逻辑卷( /dev/mapper/www2-striped )了,现在我们还需要格式化 /dev/mapper/www2-striped ,再将 /dev/mapper/www2-striped 挂载到 /www 。

注意:在 CentOS Linux 里 /dev/www2/striped 和 /dev/mapper/www2-striped 是一个东西,都可当作同一个分区来对待。

16、将 /dev/mapper/www2-striped 格式化成 xfs 文件系统:

[root@host ~]# mkfs -t xfs /dev/mapper/www2-striped
meta-data=/dev/mapper/www2-striped isize=512    agcount=32, agsize=22855664 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=731381248, imaxpct=5
         =                       sunit=16     swidth=48 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=357120, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

[root@host ~]#

此时 fdisk -l 命令的输出结果(应该是没啥变化):

[root@host ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0001ddca

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
/dev/sda2          411648    42354687    20971520   83  Linux
/dev/sda3        42354688    76695551    17170432   82  Linux swap / Solaris
/dev/sda4        76695552   976773119   450038784    5  Extended
/dev/sda5        76697600   976773119   450037760   83  Linux

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/www2-striped: 2995.7 GB, 2995739688960 bytes, 5851054080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 65536 bytes / 196608 bytes

[root@host ~]#

17、因为已经有分区( /dev/sda5 )挂载到了 /www 目录,所以我们先卸载掉这个挂载,然后将分区 /dev/sda5 挂载到 /www2 :

( 1 )先创建 /www2 文件夹:

[root@host ~]# mkdir /www2

( 2 )然后卸载掉 /www 这个挂载,这里需要注意的是卸载前请先关闭运行在 /www 里的所有程序,否则会报以下错误:

[root@host ~]# umount /www
umount: /www: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[root@host ~]#

可使用 lsof 命令来查看当前有哪些程序正在使用 /www 这个目录:

[root@host ~]# lsof | grep www
nginx     25245    root  cwd       DIR                8,2      4096     134852 /www/www.test.com/file
nginx     25245    root   15w      REG                8,2     22029     399660 /www/accesslog/access.log
nginx     25532  nobody  cwd       DIR                8,2      4096     134852 /www/www.test.com/file
nginx     25532  nobody   15w      REG                8,2     22029     399660 /www/accesslog/access.log
nginx     25533  nobody  cwd       DIR                8,2      4096     134852 /www/www.test.com/file
nginx     25533  nobody   15w      REG                8,2     22029     399660 /www/accesslog/access.log
nginx     25534  nobody  cwd       DIR                8,2      4096     134852 /www/www.test.com/file
nginx     25534  nobody   15w      REG                8,2     22029     399660 /www/accesslog/access.log
nginx     25535  nobody  cwd       DIR                8,2      4096     134852 /www/www.test.com/file
nginx     25535  nobody   15w      REG                8,2     22029     399660 /www/accesslog/access.log
bash      26812    root  cwd       DIR                8,2      4096     131775 /www
lsof      26827    root  cwd       DIR                8,2      4096     131775 /www
grep      26828    root  cwd       DIR                8,2      4096     131775 /www
lsof      26829    root  cwd       DIR                8,2      4096     131775 /www
[root@host ~]#

卸载成功是没有提示的:

[root@host ~]# umount /www
[root@host ~]#

18、将分区 /dev/sda5 挂载到 /www2 ,再将分区 /dev/mapper/www2-striped 挂载到 /www :

[root@host ~]# mount /dev/sda5 /www2
[root@host ~]# mount /dev/mapper/www2-striped /www
[root@host ~]#

19、此时还要修改 /etc/fstab 文件,这样下次开机时 CentOS Linux 才能自动地将相应的分区挂载到对应的目录:

( 1 )先查看分区 /dev/mapper/www2-striped 的 UUID :

[root@host ~]# blkid /dev/mapper/www2-striped
/dev/mapper/www2-striped: UUID="ea2aa55d-xxxx-xxxx-xxxx-xxxxd8ad93a0" TYPE="xfs" 
[root@host ~]#

记录下这个值:ea2aa55d-xxxx-xxxx-xxxx-xxxxd8ad93a0

( 2 )在命令行界面输入:

[root@host ~]# vi /etc/fstab

#
# /etc/fstab
# Created by anaconda on Wed Apr  4 13:57:00 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=63be06ea-zzzz-zzzz-zzzz-zzzzb42001a1 /                       xfs     defaults        0 0
UUID=d6a35b10-zzzz-zzzz-zzzz-zzzza170bbc0 /boot                   xfs     defaults        0 0
UUID=6782acf9-yyyy-yyyy-yyyy-yyyy27aaec82 /www                    xfs     defaults        0 0
UUID=f1f7ae41-zzzz-zzzz-zzzz-zzzz82dbcc1b swap                    swap    defaults        0 0

键入小写字母 i ,进入编辑模式,再将文件改成如下的格式:

[root@host ~]# vi /etc/fstab

#
# /etc/fstab
# Created by anaconda on Wed Apr  4 13:57:00 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=63be06ea-zzzz-zzzz-zzzz-zzzzb42001a1 /                       xfs     defaults        0 0
UUID=d6a35b10-zzzz-zzzz-zzzz-zzzza170bbc0 /boot                   xfs     defaults        0 0
UUID=ea2aa55d-xxxx-xxxx-xxxx-xxxxd8ad93a0 /www                    xfs     defaults        0 0
UUID=6782acf9-yyyy-yyyy-yyyy-yyyy27aaec82 /www2                   xfs     defaults        0 0
UUID=f1f7ae41-zzzz-zzzz-zzzz-zzzz82dbcc1b swap                    swap    defaults        0 0

按一次 ESC 键退出编辑模式,然后键入 “ :wq ” 保存并退出。

20、使用 df -h 命令查看当前分区的挂载情况:

[root@host ~]# df -h
Filesystem                Size  Used Avail Use% Mounted on
devtmpfs                   12G     0   12G   0% /dev
tmpfs                      12G     0   12G   0% /dev/shm
tmpfs                      12G  8.6M   12G   1% /run
tmpfs                      12G     0   12G   0% /sys/fs/cgroup
/dev/sda2                  20G  3.1G   17G  16% /
/dev/mapper/www2-striped  2.8T   34M  2.8T   1% /www
/dev/sda5                 429G  359G   71G  84% /www2
/dev/sda1                 197M  150M   48M  76% /boot
tmpfs                     2.4G     0  2.4G   0% /run/user/0
tmpfs                     2.4G     0  2.4G   0% /run/user/2032
[root@host ~]#

重启服务器后也是没有问题的(如果不方便可以暂时不用重启服务器)。

测试:

Ricky 这里没有进行相关的测试,以下测试数据来源于其他博主:

1、条带化后的逻辑卷:

# dd bs=64k count=4k if=/dev/zero of=test conv=fsync
4096+0 records in
4096+0 records out
268435456 bytes (268 MB) copied, 3.58631 s, 74.8 MB/s

2、镜像化后的逻辑卷:

# dd bs=64k count=4k if=/dev/zero of=test conv=fsync
4096+0 records in
4096+0 records out
268435456 bytes (268 MB) copied, 6.99957 s, 38.4 MB/s

优缺点:

优点:读写性能非常优秀,有时候甚至与单块 SSD 固态硬盘相当但又比 SSD 固态硬盘更耐用。

缺点:一块物理磁盘损坏会造成整个分区的数据丢失,建议对重要数据进行定时备份操作。

 

本文部分信息参考自:https://blog.csdn.net/wylfengyujiancheng/article/details/54577008

这篇文章对你有帮助吗?

相关文章

发表评论?

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据