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.