Sunday, 6 September 2015

How to force deactivate a volume group

I use external harddisks a lot and most of them have PVs/VGs/LVs in them
If by chance the USB connection severs, the lvs go into state that every time you say lvscan or lvs, you see an IO error
How to get rid if that remenant activated vg
Remember: This is *NOT* for vgs with lvs which are currently active and mounted.

Safe way:

    Tryunmouting (force) all the open volumes mounted from that VG. After this issue the command

    vgchange -a n <vg name>

 
That may not work all the time.

Force it :
    example: my vg nameis vg001
    #   cd /dev/mapper
   #   for f in vg001-*; do dmsetup remove $f; done



This will remove the vg and will not be showing up as errors when doing any of the lvm related commands

No comments:

Post a Comment