Linux怎么删除LVM中PV物理卷(2)
Linux怎么删除LVM中PV物理卷
VG Name liuhg_disk
PV Size 603.98 MiB / not usable 3.98 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 150
Free PE 0
Allocated PE 150
PV UUID JlMIAF-A49n-M6HA-ZLXf-d8nS-pfZr-YeQsKT
--- Physical Segments ---
Physical extent 0 to 149:
Logical volume /dev/liuhg_disk/home
Logical extents 75 to 224
--- Physical volume ---
PV Name /dev/sda11
VG Name liuhg_disk
PV Size 478.47 MiB / not usable 2.47 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 119
Free PE 0
Allocated PE 119
PV UUID xnHJNA-tDVx-dryX-KM1x-g96Y-sptI-9iUOcU
--- Physical Segments ---
Physical extent 0 to 118:
Logical volume /dev/liuhg_disk/home
Logical extents 352 to 470
将sda6设置为离线状态:
pvchange -xn /dev/sda6
使用pvdisplay -m
显示如下:
……
--- Physical volume ---
PV Name /dev/sda6
VG Name liuhg_disk
PV Size 203.92 MiB / not usable 3.92 MiB
Allocatable NO 《-----表示已经关闭了该PV
PE Size 4.00 MiB
Total PE 50
Free PE 0
Allocated PE 50
PV UUID S2ane6-nlFG-uSNR-35NP-Yxa6-cXRb-r8E8mK
……
将sda6的数据移走:
pvmove -i 1 /dev/sda6
-i 1是每1秒钟报告一次数据迁移的进度。
[root@liuhg /]# pvmove -i 1 /dev/sda6
/dev/sda6: Moved: 38.0%
/dev/sda6: Moved: 84.0%
/dev/sda6: Moved: 100.0%
重新用pvdisplay -m
显示如下:
……
--- Physical volume ---
PV Name /dev/sda6
VG Name liuhg_disk
PV Size 203.92 MiB / not usable 3.92 MiB
Allocatable NO
PE Size 4.00 MiB
Total PE 50
Free PE 50 《----显示完全空闲和Total PE数一致
Allocated PE 0
PV UUID S2ane6-nlFG-uSNR-35NP-Yxa6-cXRb-r8E8mK
……
从卷组里把sda6删除:
[root@liuhg /]# vgreduce liuhg_disk /dev/sda6
Removed “/dev/sda6” from volume group “liuhg_disk”
pvdisplay -m再看看吧:
--- NEW Physical volume --- 《-----还告诉你这是一个新的PV ^_^
PV Name /dev/sda6
VG Name 《-----空了
PV Size 203.92 MiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID S2ane6-nlFG-uSNR-35NP-Yxa6-cXRb-r8E8mK
到此vgdisplay -v能看到已经没有了/dev/sda6了。重新挂载/home
[root@liuhg /]# mount /dev/liuhg_disk/home /home
[root@liuhg /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2.0G 546M 1.3G 30% /
tmpfs 504M 0 504M 0% /dev/shm
/dev/mapper/liuhg_disk-home
2.2G 1.8G 42M 98% /home
进去看看数据,一个都没丢。
上面就是Linux删除LVM中的PV物理卷(硬盘或分区)的介绍了,如果你在系统中安装了LCM,而又不知道如何删除其中的PV物理卷的话,可以试试文中介绍的方法。