20141103 removing an lvm volume group - plembo/onemoretech GitHub Wiki

title: Removing an LVM volume group link: https://onemoretech.wordpress.com/2014/11/03/removing-an-lvm-volume-group/ author: phil2nc description: post_id: 8754 created: 2014/11/03 10:22:17 created_gmt: 2014/11/03 15:22:17 comment_status: closed post_name: removing-an-lvm-volume-group status: publish post_type: post

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.

Copyright 2004-2019 Phil Lembo