LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   LVM2: Renaming VGs and LVs, combining VGs (https://www.linuxquestions.org/questions/linux-software-2/lvm2-renaming-vgs-and-lvs-combining-vgs-419204/)

haertig 02-24-2006 03:43 PM

LVM2: Renaming VGs and LVs, combining VGs
 
My system has been running well for a long while, so I figure it's time to hose it up with another dumb experiment!

Anyone know how to rename LVM2 volume groups? Rename logical volumes? And the biggie: combine two different VGs into a single VG without losing any existing LVs or data? The LVM HowTo doesn't appear to broach these subjects (maybe because they're impossible/not_recommended?) I know I could backup existing stuff, recreate VGs and LVs from scratch, and restore. But that's cheating. Is there a way to rename and combine?

I would like to attempt:
Code:

CURRENT:
vg0->lv00
vg0->lv01
vg1->lv10
vg1->lv11

Code:

FUTURE:
new_vg2->old_lv00
new_vg2->old_lv01
new_vg2->old_lv10
new_vg2->old_lv11


uselpa 02-24-2006 04:59 PM

On renaming: I did that with vgrename and lvrename. The only trick there was is that beforehand you have to set them unavailable (vgchange -a n / lvchange -a n) and available again afterwards.

On combining two VGs into one: I think you can't.

haertig 02-25-2006 08:19 PM

Thanks for the reply.

Well, it looks like my original question qualifies as the "bonehead question of the year". I'm very familiar with the LVM HowTo, so that's the first place I looked to find out how to do what I wanted. No mention of renaming or merging commands that I can remember. So I assumed no such commands existed (I know, I know, an assumption is the first step towards a screw-up!)

But head on over to the /sbin directory, snoop around and what do you find? vgrename, lvrename, vgmerge ...

Gee, I wonder what those commands do?! :rolleyes:

:study: :study: :study:

uselpa 02-26-2006 08:12 AM

I can understand your assumption that when it's not in the HOWTO, it can't be done. But it turns out that those HOWTOs often get you started, but rarely aim at being complete. And very often you have the answer to your questions on your own machine. For example, in a shell, press "lv<tab><tab>" and start discovering.
Good lock, and be careful. LVM commands are very powerful :-)

bgoodr 06-29-2007 09:52 PM

Quote:

Originally Posted by uselpa
On renaming: I did that with vgrename and lvrename. The only trick there was is that beforehand you have to set them unavailable (vgchange -a n / lvchange -a n) and available again afterwards.

On combining two VGs into one: I think you can't.

I'm having similar difficulties, but I don't want to combine VG's. I just want to rename one of the two volume groups that have the same name so that I can get access to the data. Can you describe why you say "The only trick there was is that beforehand you have to set them unavailable (vgchange -a n / lvchange -a n) and available again afterwards"? Other posts seem to indicate that you have to execute this command, but do not explain why:
Code:

vgrename -a y
Namely, what is the significance of a Volume Group being "active"?
Thanks,
bgoodr

uselpa 06-30-2007 12:33 PM

What I meant is that you need to do, in that order
1) vgchange -a n
2) vgrename
3) vgchange -a y

and the same for lv*

My vgrename does not have a -a option anyway.

According to `man vgchange`, -a "makes the volumes known or unknown to the kernel".

Did you try to rename a VG or LV? Did you have any problem?

bgoodr 06-30-2007 02:02 PM

Quote:

Originally Posted by uselpa
What I meant is that you need to do, in that order
1) vgchange -a n
2) vgrename
3) vgchange -a y

and the same for lv*

My vgrename does not have a -a option anyway.

According to `man vgchange`, -a "makes the volumes known or unknown to the kernel".

Did you try to rename a VG or LV? Did you have any problem?

Not yet, I am doing a lot of things with some help on my thread at FedoraForum.

I'm after understanding the answer to why to do those things, not just to do them, as I'm not convinced they are safe to do on my drive... at least, not yet. :)

Thanks,
bgoodr


All times are GMT -5. The time now is 05:54 AM.