Removing an LVM volume group

Taking down a Linux RAID array today and needed to look this up, so here it is.

I had an LVM volume group called vg1 on a Linux RAID array named /dev/md0. This was mounted as /data. In advance of trying to replace Linux with FreeBSD on the machine I thought it best if I took down the RAID array. Before I could do that the volume group had to go.

First to verify the names of all volume groups:

[root@bigserv ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg1" using metadata type lvm2
  Found volume group "bigserv" using metadata type lvm2

Next, unmount the volume:

[root@bigserv ~]# umount /data

Next, deactivate the vg1 group:

[root@bigserv ~]# vgchange -a n vg1
  0 logical volume(s) in volume group "vg1" now active

Remove the volume group:

[root@bigserv ~]# vgremove vg1
Do you really want to remove volume group "vg1" containing 1 logical volumes? [y/n]: y
  Logical volume "data" successfully removed
  Volume group "vg1" successfully removed

Once this was done I was able to proceed with stopping and dismantling the array, a process described in Removing a Linux software raid array.

This entry was posted in System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).