How do you remove a PV from a VG?
Here’s what I’ve tried:
# vgreduce vg_iscsi /dev/sdb1 Physical volume "/dev/sdb1" still in use # lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root centos -wi-ao---- 6.67g swap centos -wi-ao---- 820.00m lvm02 vg2 -wi-a----- 800.00m lv_iscsi_1 vg_iscsi -wi-ao---- 52.00m
# lvremove -f vg_iscsi/lv_iscsi_1 Logical volume vg_iscsi/lv_iscsi_1 in use.
# fuser -kuc /dev/vg_iscsi/lv_iscsi_1 /dev/dm-3: 1558(root)
I tried to
kill -9 this but the process seemed to have disappeared by the time I issued the
However, now I get this:
# vgreduce vg_iscsi /dev/sdb1 Can't remove final physical volume "/dev/sdb1" from volume group "vg_iscsi"
vgreduce command is correct, but you can’t remove a physical volume from the volume group until it’s empty. That is what the error message that you received means.
As the man page states:
To move all Physical Extents that are used by simple Logical Volumes on /dev/sdb1 to free Physical Extents elsewhere in the Volume Group use: pvmove /dev/sdb1
Once the PV is empty, you can then repeat the
vgreduce command to remove it.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.