- ·上一篇文章:Linux/Unix使用md5sum命令比较文件md5值的方法
- ·下一篇文章:RAID磁盘阵列下搭建Linux系统的方法
Linux删除LVM中PV物理卷的技巧
LVM通常用于装备大量磁盘的系统,具有良好的可伸缩性,可对卷组、逻辑卷的大小进行调整,今天华军小编要给大家介绍的是Linux如何删除LVM中的PV物理卷(硬盘或分区),一起来学习下吧。希望小编的总结能帮助到大家! 一、由于硬盘或者分区的操作方式其实都一样,所以我这里就以分区为例。 二、/home分区2.6G,由如下pv组成: /dev/sda5 100M /dev/sda6 200M /dev/sda7 300M /dev/sda8 400M /dev/sda9 500M /dev/sda10 600M /dev/sda11 500M 很碎对吧?^_^因为测试。 三、随机写了一堆文件进去,用量达到了2G,空闲500M 四、准备将sda6这个200M的PV卸掉(卸掉的容量必须小于空闲容量) 好了开始具体操作了。 卸载分区(缩小操作必须卸载才能进行): umount /home 缩小分区: e2fsck -f /dev/liuhg_disk/home resize2fs /dev/liuhg_disk/home 2200M 首先将分区缩小到2200M这是为了给sda6腾出空间,sda6为200M,而我腾出了400M,因此应该是足够的。 缩小逻辑卷: lvreduce -L 2200M /dev/liuhg_disk/home 分区缩小了用到的逻辑卷也要随着缩小,并查看PV使用的状态: pvdisplay -m 显示如下: --- Physical volume --- PV Name /dev/sda5 VG Name liuhg_disk PV Size 103.26 MiB / not usable 3.26 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 25 Free PE 0 Allocated PE 25 PV UUID 5lnx52-b4jc-OOfZ-f2QA-ttdQ-DZeD-Ce3rb3 --- Physical Segments --- Physical extent 0 to 24: Logical volume /dev/liuhg_disk/home Logical extents 0 to 24 --- Physical volume --- PV Name /dev/sda6 VG Name liuhg_disk PV Size 203.92 MiB / not usable 3.92 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 50 Free PE 0 《-----太悲剧了,sda6里写满了数据一点不剩 Allocated PE 50 《-----这50PE的数据要挪走才行,否则数据就丢了,并且存放的地方也必须是连续的至少50PE PV UUID S2ane6-nlFG-uSNR-35NP-Yxa6-cXRb-r8E8mK --- Physical Segments --- Physical extent 0 to 49: Logical volume /dev/liuhg_disk/home Logical extents 25 to 74 --- Physical volume --- PV Name /dev/sda7 VG Name liuhg_disk PV Size 305.89 MiB / not usable 1.89 MiB Allocatable yes PE Size 4.00 MiB Total PE 76 Free PE 76 《---这个分区有76个空余,因此预计装那50个是不会有问题的 Allocated PE 0 PV UUID 9CFnlx-CAEw-CSul-Rig9-FiCN-zK0a-oGmTEP --- Physical Segments --- Physical extent 0 to 75: FREE --- Physical volume --- PV Name /dev/sda8 VG Name liuhg_disk PV Size 407.87 MiB / not usable 3.87 MiB Allocatable yes PE Size 4.00 MiB Total PE 101 Free PE 60 Allocated PE 41 PV UUID X0I8p0-x2xr-2xLG-QQD4-jbtS-3C4i-xPn4Bl --- Physical Segments --- Physical extent 0 to 40: Logical volume /dev/liuhg_disk/home Logical extents 471 to 511 以上就是小编总结的Linux删除LVM中PV物理卷的技巧,希望能帮助到大家,了解更多资讯尽在华军软件园!
Linux删除LVM中PV物理卷的技巧