LVM逻辑卷
LVM技术是在硬盘分区和文件系统之间添加了一个逻辑层,它提供了一个抽象的卷组,可以把多块硬盘进行卷组合并。这样一来,用户不必关心物理硬盘设备的底层架构和布局,就可以实现对硬盘分区的动态调整。
物理卷:Physical Volume,PV
卷组:Volume Group,VG
逻辑卷:Logical Volume,LV
基本单元:Physical Extent,PE,PE大小一般为4M。
注意:逻辑卷的大小一定是PE的倍数,即逻辑卷是由若干个PE组成。
部署逻辑卷
常用的LVM部署命令
功能/命令 | 物理卷管理 | 卷组管理 | 逻辑卷管理 |
扫描 | pvscan | vgscan | lvscan |
建立 | pvcreate | vgcreate | lvcreate |
显示 | pvdisplay | vgdisplay | lvdisplay |
删除 | pvremove | vgremove | lvremove |
扩展 | vgextend | lvextend | |
缩小 | vgreduce | lvreduce |
1.创建物理卷
[root@superwu10 ~]# pvcreate /dev/sdb /dev/sdc //对硬盘创建物理卷 Physical volume "/dev/sdb" successfully created. Physical volume "/dev/sdc" successfully created.
2.创建卷组
[root@superwu10 ~]# vgcreate hehe /dev/sdb /dev/sdc //创建卷组hehe,并将硬盘加入卷组 Volume group "hehe" successfully created
[root@superwu10 ~]# ls -ld /dev/hehe //卷组会自动在/dev目录中创建
drwxr-xr-x. 2 root root 80 Feb 10 06:58 /dev/hehe
[root@superwu10 ~]# vgdisplay //查看卷组信息 --- Volume group --- VG Name hehe System ID Format lvm2 Metadata Areas 2 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 2 Act PV 2 VG Size 39.99 GiB PE Size 4.00 MiB Total PE 10238 Alloc PE / Size 0 / 0 Free PE / Size 10238 / 39.99 GiB VG UUID Cma6sp-KXTQ-SoVz-xQ5c-rXCt-IrhY-nPdrVc --- Volume group --- VG Name rhel System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size <19.00 GiB PE Size 4.00 MiB Total PE 4863 Alloc PE / Size 4863 / <19.00 GiB Free PE / Size 0 / 0 VG UUID oMDZ59-DQqg-ok7A-YJMV-vXBO-KU5L-Slk8pe
3.创建逻辑卷
[root@superwu10 ~]# lvcreate -n juan1 -l 30 hehe //-n 表示创建逻辑卷的名称,-l 表示逻辑卷的大小为30个PE。在hehe卷组上创建逻辑卷juan1,大小为30*4M. Logical volume "juan1" created. [root@superwu10 ~]# lvdisplay //查看逻辑卷信息 --- Logical volume --- LV Path /dev/hehe/juan1 //逻辑卷存在与卷组下 LV Name juan1 VG Name hehe LV UUID 9e0cRI-T9RO-PbBC-zQWd-Bfi2-rVUx-MPnrIW LV Write Access read/write LV Creation host, time superwu10.10, 2022-02-10 06:57:31 +0800 LV Status available # open 0 LV Size 120.00 MiB //30个PE 30*4M=120M. Current LE 30 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:2 --- Logical volume --- LV Path /dev/rhel/swap LV Name swap VG Name rhel LV UUID 620uVZ-3mFM-BfSd-G2D7-H6QI-JmZi-nfEeWg LV Write Access read/write LV Creation host, time superwu10.10, 2022-01-10 03:42:19 +0800 LV Status available # open 2 LV Size 2.00 GiB Current LE 512 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:1 --- Logical volume --- LV Path /dev/rhel/root LV Name root VG Name rhel LV UUID T0O43Y-pZqz-pKJH-BTI7-lChV-0RMU-iXS0UC LV Write Access read/write LV Creation host, time superwu10.10, 2022-01-10 03:42:19 +0800 LV Status available # open 1 LV Size <17.00 GiB Current LE 4351 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0 [root@superwu10 ~]# lvcreate -n ceshi2 -L 150M hehe //-L参数可直接指定创建卷的大小 Rounding up size to full physical extent 152.00 MiB //卷大小如果不是4M的倍数,会自动微调为4的倍数。 Logical volume "ceshi2" created. [root@superwu10 ~]# lvdisplay --- Logical volume --- LV Path /dev/hehe/juan1 LV Name juan1 VG Name hehe LV UUID 9e0cRI-T9RO-PbBC-zQWd-Bfi2-rVUx-MPnrIW LV Write Access read/write LV Creation host, time superwu10.10, 2022-02-10 06:57:31 +0800 LV Status available # open 0 LV Size 120.00 MiB Current LE 30 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:2 --- Logical volume --- LV Path /dev/hehe/ceshi2 LV Name ceshi2 VG Name hehe LV UUID k5jQcY-vC37-24XV-CtT5-28H4-zH6Z-ResmXr LV Write Access read/write LV Creation host, time superwu10.10, 2022-02-10 06:58:56 +0800 LV Status available # open 0 LV Size 152.00 MiB Current LE 38 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:3 --- Logical volume --- LV Path /dev/rhel/swap LV Name swap VG Name rhel LV UUID 620uVZ-3mFM-BfSd-G2D7-H6QI-JmZi-nfEeWg LV Write Access read/write LV Creation host, time superwu10.10, 2022-01-10 03:42:19 +0800 LV Status available # open 2 LV Size 2.00 GiB Current LE 512 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:1 --- Logical volume --- LV Path /dev/rhel/root LV Name root VG Name rhel LV UUID T0O43Y-pZqz-pKJH-BTI7-lChV-0RMU-iXS0UC LV Write Access read/write LV Creation host, time superwu10.10, 2022-01-10 03:42:19 +0800 LV Status available # open 1 LV Size <17.00 GiB Current LE 4351 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0
4.格式化逻辑卷
如果使用了逻辑卷管理器,则不建议用XFS文件系统,因为XFS文件系统自身就可以使用xfs_growfs命令进行磁盘扩容。这虽然不比LVM灵活,但起码也够用。
[root@superwu10 ~]# mkfs.ext4 /dev/hehe/juan1 mke2fs 1.44.3 (10-July-2018) Creating filesystem with 122880 1k blocks and 30720 inodes Filesystem UUID: 76a02fab-9c6c-4416-a82d-82f0d8e681a5 Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Allocating group tables: done Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done
5.挂载使用
[root@superwu10 ~]# mkdir /opt/juan [root@superwu10 ~]# mount /dev/hehe/juan1 /opt/juan/ [root@superwu10 ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 969M 0 969M 0% /dev tmpfs 984M 0 984M 0% /dev/shm tmpfs 984M 9.6M 974M 1% /run tmpfs 984M 0 984M 0% /sys/fs/cgroup /dev/mapper/rhel-root 17G 4.2G 13G 25% / /dev/sr0 6.7G 6.7G 0 100% /media/cdrom /dev/sda1 1014M 153M 862M 15% /boot tmpfs 197M 16K 197M 1% /run/user/42 tmpfs 197M 3.5M 194M 2% /run/user/0 /dev/mapper/hehe-juan1 113M 1.6M 103M 2% /opt/juan [root@superwu10 ~]# echo "/dev/hehe/juan1 /opt/juan ext4 defaults 0 0" >> /etc/fstab
[root@superwu10 ~]# cd /opt/juan/ [root@superwu10 juan]# ll total 12 drwx------. 2 root root 12288 Feb 10 07:13 lost+found [root@superwu10 juan]# touch test.txt [root@superwu10 juan]# ll total 13 drwx------. 2 root root 12288 Feb 10 07:13 lost+found -rw-r--r--. 1 root root 0 Feb 10 07:19 test.txt
扩容逻辑卷
用户在使用存储设备时感知不到设备底层的架构和布局,更不用关心底层是由多少块硬盘组成的,只要卷组中有足够的资源,就可以一直为逻辑卷扩容。扩容前请一定要记得卸载设备和挂载点的关联。
1.卸载设备
[root@superwu ~]# umount /opt/data1 [root@superwu ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 969M 0 969M 0% /dev tmpfs 984M 0 984M 0% /dev/shm tmpfs 984M 9.6M 974M 1% /run tmpfs 984M 0 984M 0% /sys/fs/cgroup /dev/mapper/rhel-root 17G 3.9G 14G 23% / /dev/sr0 6.7G 6.7G 0 100% /media/cdrom /dev/sda1 1014M 152M 863M 15% /boot tmpfs 197M 16K 197M 1% /run/user/42 tmpfs 197M 3.5M 194M 2% /run/user/0
2.扩容逻辑卷
[root@superwu ~]# lvextend -L 250M /dev/hehe/juan1 //扩容逻辑卷至250M Rounding size to boundary between physical extents: 252.00 MiB. Size of logical volume hehe/juan1 changed from 120.00 MiB (30 extents) to 252.00 MiB (63 extents). Logical volume hehe/juan1 successfully resized.
3.检查硬盘的完整性,确认目录结构、内容和文件内容没有丢失。没有报错,为正常情况。
[root@superwu ~]# e2fsck -f /dev/hehe/juan1 e2fsck 1.44.3 (10-July-2018) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/hehe/juan1: 12/30720 files (0.0% non-contiguous), 9530/122880 blocks
4.重置设备在系统中的容量。刚刚是对LV(逻辑卷)设备进行了扩容操作,但系统内核还没有同步到这部分新修改的信息,需要手动进行同步。
[root@superwu ~]# resize2fs /dev/hehe/juan1 resize2fs 1.44.3 (10-July-2018) Resizing the filesystem on /dev/hehe/juan1 to 258048 (1k) blocks. The filesystem on /dev/hehe/juan1 is now 258048 (1k) blocks long.
5.重新挂载设备
[root@superwu ~]# mount -a [root@superwu ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 969M 0 969M 0% /dev tmpfs 984M 0 984M 0% /dev/shm tmpfs 984M 9.6M 974M 1% /run tmpfs 984M 0 984M 0% /sys/fs/cgroup /dev/mapper/rhel-root 17G 3.9G 14G 23% / /dev/sr0 6.7G 6.7G 0 100% /media/cdrom /dev/sda1 1014M 152M 863M 15% /boot tmpfs 197M 16K 197M 1% /run/user/42 tmpfs 197M 3.5M 194M 2% /run/user/0 /dev/mapper/hehe-juan1 240M 2.1M 222M 1% /opt/data1 [root@superwu ~]# lvdisplay --- Logical volume --- LV Path /dev/hehe/juan1 LV Name juan1 VG Name hehe LV UUID KvHDJu-CMPo-uMwK-56B0-dMWB-hONK-OvhUxH LV Write Access read/write LV Creation host, time superwu.10, 2022-02-10 16:42:58 +0800 LV Status available # open 1 LV Size 252.00 MiB //已经扩容至252M Current LE 63 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:2 --- Logical volume --- LV Path /dev/rhel/swap LV Name swap VG Name rhel LV UUID 5r17mN-Xzxt-YbDv-fg9m-9JT1-AtsD-K6h5yZ LV Write Access read/write LV Creation host, time superwu.10, 2022-01-11 16:26:54 +0800 LV Status available # open 2 LV Size 2.00 GiB Current LE 512 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:1 --- Logical volume --- LV Path /dev/rhel/root LV Name root VG Name rhel LV UUID Ng4387-Ok4t-nWlF-zhtl-ahge-12Le-sk4mri LV Write Access read/write LV Creation host, time superwu.10, 2022-01-11 16:26:54 +0800 LV Status available # open 1 LV Size <17.00 GiB Current LE 4351 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0
缩小逻辑卷
缩容操作,有数据丢失风险,建议先备份数据再进行缩容。
在对LVM逻辑卷缩容前,首先要检查文件系统的完整性。
1.卸载LVM逻辑卷设备
[root@superwu ~]# umount /opt/data1 [root@superwu ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 969M 0 969M 0% /dev tmpfs 984M 0 984M 0% /dev/shm tmpfs 984M 9.6M 974M 1% /run tmpfs 984M 0 984M 0% /sys/fs/cgroup /dev/mapper/rhel-root 17G 3.9G 14G 23% / /dev/sr0 6.7G 6.7G 0 100% /media/cdrom /dev/sda1 1014M 152M 863M 15% /boot tmpfs 197M 16K 197M 1% /run/user/42 tmpfs 197M 3.5M 194M 2% /run/user/0
2.检查文件系统完整性
[root@superwu ~]# e2fsck -f /dev/hehe/juan1 e2fsck 1.44.3 (10-July-2018) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/hehe/juan1: 12/65536 files (0.0% non-contiguous), 14432/258048 blocks
3.通知内核缩减逻辑卷后的大小
[root@superwu ~]# resize2fs /dev/hehe/juan1 150M //将LVM逻辑卷缩减到150M resize2fs 1.44.3 (10-July-2018) Resizing the filesystem on /dev/hehe/juan1 to 153600 (1k) blocks. The filesystem on /dev/hehe/juan1 is now 153600 (1k) blocks long.
4.缩减LVM逻辑卷容量
[root@superwu ~]# lvreduce -L 150M /dev/hehe/juan1 //注意:缩减逻辑卷的大小应与通知内核时的大小相同。 Rounding size to boundary between physical extents: 152.00 MiB. WARNING: Reducing active logical volume to 152.00 MiB. THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce hehe/juan1? [y/n]: y //需要二次确认 Size of logical volume hehe/juan1 changed from 252.00 MiB (63 extents) to 152.00 MiB (38 extents). Logical volume hehe/juan1 successfully resized.
5.挂载并使用LVM逻辑卷
[root@superwu ~]# mount -a [root@superwu ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 969M 0 969M 0% /dev tmpfs 984M 0 984M 0% /dev/shm tmpfs 984M 9.6M 974M 1% /run tmpfs 984M 0 984M 0% /sys/fs/cgroup /dev/mapper/rhel-root 17G 3.9G 14G 23% / /dev/sr0 6.7G 6.7G 0 100% /media/cdrom /dev/sda1 1014M 152M 863M 15% /boot tmpfs 197M 16K 197M 1% /run/user/42 tmpfs 197M 3.5M 194M 2% /run/user/0 /dev/mapper/hehe-juan1 142M 1.6M 130M 2% /opt/data1 [root@superwu ~]# lvdisplay --- Logical volume --- LV Path /dev/hehe/juan1 LV Name juan1 VG Name hehe LV UUID KvHDJu-CMPo-uMwK-56B0-dMWB-hONK-OvhUxH LV Write Access read/write LV Creation host, time superwu.10, 2022-02-10 16:42:58 +0800 LV Status available # open 1 LV Size 152.00 MiB //已经将逻辑卷缩小到150M Current LE 38 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:2
逻辑卷快照
LVM还具备有“快照卷”功能,该功能类似于虚拟机软件的还原时间点功能。例如,对某一个逻辑卷设备做一次快照,如果日后发现数据被改错了,就可以利用之前做好的快照卷进行覆盖还原。LVM的快照卷功能有两个特点:
快照卷的容量必须等同于逻辑卷的容量;
快照卷仅一次有效,一旦执行还原操作后则会被立即自动删除。
1.查看要备份的LVM逻辑卷的大小、卷组的大小是否够用。
[root@superwu ~]# lvdisplay --- Logical volume --- LV Path /dev/hehe/juan1 LV Name juan1 VG Name hehe LV UUID KvHDJu-CMPo-uMwK-56B0-dMWB-hONK-OvhUxH LV Write Access read/write LV Creation host, time superwu.10, 2022-02-10 16:42:58 +0800 LV Status available # open 1 LV Size 152.00 MiB Current LE 38 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:2 [root@superwu data1]# vgdisplay --- Volume group --- VG Name hehe System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 2 Act PV 2 VG Size 39.99 GiB PE Size 4.00 MiB Total PE 10238 Alloc PE / Size 38 / 152.00 MiB Free PE / Size 10200 / 39.84 GiB VG UUID jW63WM-Xw4t-dMIc-if0Y-6oPN-Rdbh-qloflg
2.创建快照
[root@superwu data1]# lvcreate -s -n hehekuaizhao -L 150M /dev/hehe/juan1 //-s参数表示创建快照(对juan1逻辑卷创建快照),快照大小等于LVM逻辑卷。 Rounding up size to full physical extent 152.00 MiB Logical volume "hehekuaizhao" created. [root@superwu data1]# lvdisplay --- Logical volume --- LV Path /dev/hehe/juan1 LV Name juan1 VG Name hehe LV UUID KvHDJu-CMPo-uMwK-56B0-dMWB-hONK-OvhUxH LV Write Access read/write LV Creation host, time superwu.10, 2022-02-10 16:42:58 +0800 LV snapshot status source of hehekuaizhao [active] //此处可看到此逻辑卷已经被创建了快照hehekuaizhao LV Status available # open 1 LV Size 152.00 MiB Current LE 38 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:2 --- Logical volume --- LV Path /dev/hehe/hehekuaizhao LV Name hehekuaizhao VG Name hehe LV UUID qfyr6Y-lg1h-9Hs1-G5VQ-9svJ-kDie-NS1v67 LV Write Access read/write LV Creation host, time superwu.10, 2022-02-10 17:33:12 +0800 LV snapshot status active destination for juan1 //此处可看到本快照是基于juan1创建的 LV Status available # open 0 LV Size 152.00 MiB Current LE 38 COW-table size 152.00 MiB COW-table LE 38 Allocated to snapshot 0.01% Snapshot chunk size 4.00 KiB Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:5
3.还原快照
lvconvert命令用于管理逻辑卷的快照,语法格式为“lvconvert [参数]快照卷名称”。
[root@superwu ~]#cd /opt/data1 //修改LVM逻辑卷中的内容 [root@superwu data1]# touch ceshi1 [root@superwu data1]# touch ceshi2 [root@superwu data1]# touch ceshi3 [root@superwu data1]# ll total 17 -rw-r--r--. 1 root root 0 Feb 10 17:36 ceshi1 -rw-r--r--. 1 root root 0 Feb 10 17:36 ceshi2 -rw-r--r--. 1 root root 0 Feb 10 17:36 ceshi3 -rw-r--r--. 1 root root 10 Feb 10 17:30 hehe drwx------. 2 root root 12288 Feb 10 16:44 lost+found [root@superwu data1]cd ~
还原快照需要先卸载LVM逻辑卷设备 [root@superwu ~]# umount /opt/data1 //卸载逻辑卷 [root@superwu ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 969M 0 969M 0% /dev tmpfs 984M 0 984M 0% /dev/shm tmpfs 984M 9.6M 974M 1% /run tmpfs 984M 0 984M 0% /sys/fs/cgroup /dev/mapper/rhel-root 17G 3.9G 14G 23% / /dev/sr0 6.7G 6.7G 0 100% /media/cdrom /dev/sda1 1014M 152M 863M 15% /boot tmpfs 197M 16K 197M 1% /run/user/42 tmpfs 197M 3.5M 194M 2% /run/user/0 [root@superwu ~]# lvconvert --merge /dev/hehe/hehekuaizhao //将逻辑卷恢复到hehekuaizhao快照 Merging of volume hehe/hehekuaizhao started. hehe/juan1: Merged: 100.00% [root@superwu ~]# mount -a //挂载逻辑卷 [root@superwu ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 969M 0 969M 0% /dev tmpfs 984M 0 984M 0% /dev/shm tmpfs 984M 9.6M 974M 1% /run tmpfs 984M 0 984M 0% /sys/fs/cgroup /dev/mapper/rhel-root 17G 3.9G 14G 23% / /dev/sr0 6.7G 6.7G 0 100% /media/cdrom /dev/sda1 1014M 152M 863M 15% /boot tmpfs 197M 16K 197M 1% /run/user/42 tmpfs 197M 3.5M 194M 2% /run/user/0 /dev/mapper/hehe-juan1 142M 1.6M 130M 2% /opt/data1 [root@superwu ~]# cd /opt/data1/ [root@superwu data1]# ll total 14 -rw-r--r--. 1 root root 10 Feb 10 17:30 hehe //快照已恢复 drwx------. 2 root root 12288 Feb 10 16:44 lost+found
[root@superwu data1]# lvdisplay //快照被恢复后会自动删除,即快照只一次有效 --- Logical volume --- LV Path /dev/hehe/juan1 LV Name juan1 VG Name hehe LV UUID KvHDJu-CMPo-uMwK-56B0-dMWB-hONK-OvhUxH LV Write Access read/write LV Creation host, time superwu.10, 2022-02-10 16:42:58 +0800 LV Status available # open 1 LV Size 152.00 MiB Current LE 38 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:2
删除逻辑卷
删除逻辑卷需要执行严格的操作步骤,不能颠倒顺序。删除逻辑卷 --> 卷组 --> 物理卷设备。
1.卸载逻辑卷,删除开机自动挂载
[root@superwu ~]# umount /opt/data1 [root@superwu ~]# vim /etc/fstab [root@superwu ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Tue Jan 11 03:26:57 2022 # # 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. # # After editing this file, run 'systemctl daemon-reload' to update systemd # units generated from this file. # /dev/mapper/rhel-root / xfs defaults 0 0 UUID=d7f53471-c95f-44f2-aafe-f86bd5ecebd7 /boot xfs defaults 0 0 /dev/mapper/rhel-swap swap swap defaults 0 0 /dev/cdrom /media/cdrom iso9660 defaults 0 0
2.删除逻辑卷
[root@superwu ~]# lvremove /dev/hehe/juan1 Do you really want to remove active logical volume hehe/juan1? [y/n]: y //需要二次确认 Logical volume "juan1" successfully removed
3.删除卷组
[root@superwu ~]# vgremove hehe //直接写卷组名称即可,不需要写完整路径 Volume group "hehe" successfully removed
4.删除物理卷
[root@superwu ~]# pvremove /dev/sdb /dev/sdc Labels on physical volume "/dev/sdb" successfully wiped. Labels on physical volume "/dev/sdc" successfully wiped.
删除后,可执行lvdisplay、vgdisplay、pvdisplay命令查看删除是否成功。