I want to repartition my disk. My current partition table is as follows:
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
I want to remove /dev/vda2 and extend /dev/vda1 up to fill the whole disk. Here is my current physical volumes status:
--- 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
Am I correct if I say that I can safely
vgreduce vg0 /dev/vda2
without pvmove-ing /dev/vda2 beforehand, because that physical volume is not being used?
You can remove only unused physical volumes from a group. If you don't
pvmove
orlvremove
all of the lvs on it, thevgreduce
will give back only an error message.pvmove
moves allocated PEs off a PV. There are no allocated PEs on /dev/vda2 so there is nothing to move. Yes you can safely run thevgreduce
command.