Rename LVM volume group
Posted: Thu Nov 03, 2011 12:42 pm
[PROBLEM]
Since I've been following instructions on how to setup LVMs on my machines, each LVM on each different computer had the same volume group name: "lvmvolume".
So far so good, but one day I had to mount an LVM partition from another machine, and suddenly "pvscan" showed me 2 LVM volume groups - BUT: both had the same name "lvmvolume"
Now "lvscan" (and any other tool accessing the logical volumes) only accessed the first volume group, and it was impossible for the system to distinguish them.
[SOLUTION]
You have to rename the volume group of any of those LVMs in order to be able to distinguishably address them.
Problem: It's hard, dangerous (and maybe impossible) to do so on a machine with the same volume group name in use.
So, I've mounted one of the drives on another computer which did *not* have any LVM configured, and did the following to rename the volume group:
Run "pvscan" to see if the LVM volume group shows up:
Then use "vgrename" to do the actual name change:
In my case, I chose to use some sort of ID for the new name to avoid future conflicts with other LVMs:
("160" for the size in GB - and "PC1" for the server name. However, that naming is completely arbitrary)
Since I've been following instructions on how to setup LVMs on my machines, each LVM on each different computer had the same volume group name: "lvmvolume".
So far so good, but one day I had to mount an LVM partition from another machine, and suddenly "pvscan" showed me 2 LVM volume groups - BUT: both had the same name "lvmvolume"
Now "lvscan" (and any other tool accessing the logical volumes) only accessed the first volume group, and it was impossible for the system to distinguish them.
[SOLUTION]
You have to rename the volume group of any of those LVMs in order to be able to distinguishably address them.
Problem: It's hard, dangerous (and maybe impossible) to do so on a machine with the same volume group name in use.
So, I've mounted one of the drives on another computer which did *not* have any LVM configured, and did the following to rename the volume group:
Run "pvscan" to see if the LVM volume group shows up:
The result in my case looked like this:sudo pvscan
Now, make sure that that all logical volumes in that group are inactive, by disabling them:PV /dev/sdc2 VG lvmvolume lvm2 [148.94 GB / 0 free]
Total: 1 [148.94 GB] / in use: 1 [148.94 GB] / in no VG: 0 [0 ]
Code: Select all
sudo lvchange -an lvmvolume
Code: Select all
sudo vgrename <old_name> <new_name>
Code: Select all
sudo vgrename lvmvolume lvm_160_pc1