LVM:删除物理卷

我想重新分区我的磁盘。 我目前的分区表如下:

Disk /dev/vda: 1 TiB, 1136018849792 bytes, 2218786816 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 Disklabel type: dos Disk identifier: 0x9039e337 Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 224610303 224608256 107,1G 8e Linux LVM /dev/vda2 224610304 226490367 1880064 918M 8e Linux LVM 

我想删除/ dev / vda2并将/ dev / vda1扩展到填满整个磁盘。 以下是我目前的物理卷状态:

 --- Physical volume --- PV Name /dev/vda1 VG Name vg0 PV Size 107,10 GiB / not usable 4,00 MiB Allocatable yes (but full) PE Size 4,00 MiB Total PE 27417 Free PE 0 Allocated PE 27417 PV UUID XKfnoJ-VBxR-reLg-eE5n-h2yM-W5wt-RTbEcK --- Physical volume --- PV Name /dev/vda2 VG Name vg0 PV Size 918,00 MiB / not usable 2,00 MiB Allocatable yes PE Size 4,00 MiB Total PE 229 Free PE 229 Allocated PE 0 PV UUID 2xT1xt-wYCF-fDzm-f36Q-zeIc-xR0Y-Mf3sCo 

如果我说我可以安全的话,我是否正确?

 vgreduce vg0 /dev/vda2 

事先没有使用pvmove-ing / dev / vda2,因为那个物理卷没有被使用?

pvmove将PV分配给PE。 / dev / vda2上没有分配的PE,所以没有任何可移动的东西。 是的,您可以安全地运行vgreduce命令。

您只能从组中删除未使用的物理卷。 如果你不把pvmovelvremove所有的lvs, vgreduce只会返回一个错误信息。