LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-11-2006, 04:56 AM   #1
binary_0011
Member
 
Registered: Apr 2006
Location: Singapore
Distribution: RHEL4,FC4,FC5
Posts: 89

Rep: Reputation: 15
How to rename a vol group?


[root@localhost dev]# vgrename stuff store
Volume group "stuff" still has active LVs

as you can see, the LVs are still active and I can't change the name.

How do I stop it so that I can change the name of the VG?

Thanks.
 
Old 04-11-2006, 10:07 AM   #2
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
IIRC I did `lvchange -an` the logical volumes first, then `vgrename`, then `lvchange -ay` again.
 
1 members found this post helpful.
Old 04-11-2006, 10:37 AM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,030

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
uselpa listed the correct procedure. You will probably need to unmount any mounted logical volumes before these commands will work however. I usually do this type of low level stuff from runlevel 1, so filesystem unmounting is easier (no pesky users or processes holding the filesystems open). Also, as opposed to running "lvchange -an" on each logical volume, you can do "vgchange -an" on the volume group and hit all the logical volumes at once. Then after you've renamed, run "vgchange -ay" to activate all the logical volumes with one command.

Don't forget to modify your /etc/fstab entries to reflect the new name of the volume group.
 
Old 04-12-2006, 02:23 AM   #4
binary_0011
Member
 
Registered: Apr 2006
Location: Singapore
Distribution: RHEL4,FC4,FC5
Posts: 89

Original Poster
Rep: Reputation: 15
Thanks, it worked.
 
Old 08-22-2007, 01:32 AM   #5
fenerli
LQ Newbie
 
Registered: Aug 2007
Distribution: Fedora Core 7
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by haertig View Post
uselpa listed the correct procedure. You will probably need to unmount any mounted logical volumes before these commands will work however. I usually do this type of low level stuff from runlevel 1, so filesystem unmounting is easier (no pesky users or processes holding the filesystems open). Also, as opposed to running "lvchange -an" on each logical volume, you can do "vgchange -an" on the volume group and hit all the logical volumes at once. Then after you've renamed, run "vgchange -ay" to activate all the logical volumes with one command.

Don't forget to modify your /etc/fstab entries to reflect the new name of the volume group.
I did go to runlevel 1, and still cannot unmount the logical volumes. When I say 'umount -a' it says 'umount: /: device is busy' and of course, as you mentioned, when I try to do vgchange -an w/o unmounting, it complains. Can you please help with this?

Thanks.
 
Old 08-22-2007, 01:37 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,424

Rep: Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054
Do your work from a liveCD that has LVM support.
 
Old 08-22-2007, 01:52 AM   #7
fenerli
LQ Newbie
 
Registered: Aug 2007
Distribution: Fedora Core 7
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
Do your work from a liveCD that has LVM support.
Ok, I will try this. Thank you.
 
Old 08-23-2007, 01:14 AM   #8
fenerli
LQ Newbie
 
Registered: Aug 2007
Distribution: Fedora Core 7
Posts: 7

Rep: Reputation: 0
Ok, here is what I did:

- I first edited /etc/fstab to change all "VolGroup00"s to "vg00"s
- I booted with Knoppix 5.1 live cd
- vgrename VolGroup00 vg00 --> success
- Reboot --> I get kernel panic. It says it cannot find VolGroup00. It does the same thing when I edit the kernel arguments to contain root=/dev/vg00/LogVol00 instead of root=/dev/VolGroup00/LogVol00, it does not work.

Thank you in advance for your help
 
Old 08-23-2007, 06:42 PM   #9
fenerli
LQ Newbie
 
Registered: Aug 2007
Distribution: Fedora Core 7
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by fenerli View Post
Ok, here is what I did:

- I first edited /etc/fstab to change all "VolGroup00"s to "vg00"s
- I booted with Knoppix 5.1 live cd
- vgrename VolGroup00 vg00 --> success
- Reboot --> I get kernel panic. It says it cannot find VolGroup00. It does the same thing when I edit the kernel arguments to contain root=/dev/vg00/LogVol00 instead of root=/dev/VolGroup00/LogVol00, it does not work.

Thank you in advance for your help
Does anyone know what I should do now?

Thank you.
 
Old 08-24-2007, 01:14 AM   #10
cojo
Member
 
Registered: Feb 2003
Location: St. Louis
Distribution: RedHat 8
Posts: 262

Rep: Reputation: 31
how far did you get before it give you kernel panic? Can you paste your grub.conf and fstab?
 
Old 08-24-2007, 01:42 AM   #11
tofino_surfer
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Rep: Reputation: 0
edit initrd init file contents to change vg references

Hello,

You need to change the contents of the nash init file inside your initrd ramdisk to remove references to your old volume names. There are typically three. The initrd file is ( on Fedora at least ) a compressed loopback filesystem. You need to:

1. gunzip initrd-2.6....img
2. mkdir ramdisk
3. mount -t ext2 -o loop initrd-2.6...img ramdisk
4. cd ramdisk

There will be a nash script which is called init in Fedora and linuxrc on other distros. In my init file there are three references to VolGroup00. These and possibly all others will need to be changed.

echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure VolGroup00
resume /dev/VolGroup00/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VolGroup00/LogVol00

Please change these references in a text editor, umount ramdisk, and recompress (gzip) the edited image. You will also need to, if you haven't already, change all references to the old volume name in the /dev directory. These may have been changed by the rename command.

Let me know if this works.
 
Old 08-24-2007, 06:40 PM   #12
fenerli
LQ Newbie
 
Registered: Aug 2007
Distribution: Fedora Core 7
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by tofino_surfer View Post
Hello,

You need to change the contents of the nash init file inside your initrd ramdisk to remove references to your old volume names. There are typically three. The initrd file is ( on Fedora at least ) a compressed loopback filesystem. You need to:

1. gunzip initrd-2.6....img
2. mkdir ramdisk
3. mount -t ext2 -o loop initrd-2.6...img ramdisk
4. cd ramdisk

There will be a nash script which is called init in Fedora and linuxrc on other distros. In my init file there are three references to VolGroup00. These and possibly all others will need to be changed.

echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure VolGroup00
resume /dev/VolGroup00/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VolGroup00/LogVol00

Please change these references in a text editor, umount ramdisk, and recompress (gzip) the edited image. You will also need to, if you haven't already, change all references to the old volume name in the /dev directory. These may have been changed by the rename command.

Let me know if this works.
Wow! Thank you very much for the detailed explanations. I appreciate them. For the last couple days, I did not have time to work on it. I will let you know when I try these.
 
Old 08-27-2007, 10:17 AM   #13
tofino_surfer
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Rep: Reputation: 0
old method of accessing intird posted in previous message

Hello,

In my previous message I stated that the initrd file was a compressed loopback filesystem. This was the old method which may be still in use in some distros. The new method in Fedora and other distros is a compressed cpio archive. To access this you need a temporary editing directory in which you will extract the cpio archive contents.


1. mdkir initrd-edit && cd initrd-edit
2. gzip -dc /boot/initrd-2.6...img | cpio -i -c
3. edit contents of directory, specifically init or linuxrc nash script

To repackage the initrd ( or initramfs )

1. cd /initrd-edit
2. find . | cpio --quiet -c -o >../newinitrd
3. cd ..
4. gzip -9 <newinitrd >initrd-2.6...img
5. copy the new initrd image to /boot

As I don't know which distro you use you will have to check which method of initrd creation yours uses. Have a look at the mkinitrd or mkinitramfs bash script ( usually in /sbin ) or simply gunzip the initrd file and look at its file type.

[root@localhost ~]# file initrd*
initrd-2.6.15-1.2054_FC5smp.img: ASCII cpio archive (SVR4 with no CRC)

Let me know if this works.
 
Old 08-28-2007, 12:59 AM   #14
fenerli
LQ Newbie
 
Registered: Aug 2007
Distribution: Fedora Core 7
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by tofino_surfer View Post
Hello,

In my previous message I stated that the initrd file was a compressed loopback filesystem. This was the old method which may be still in use in some distros. The new method in Fedora and other distros is a compressed cpio archive. To access this you need a temporary editing directory in which you will extract the cpio archive contents.


1. mdkir initrd-edit && cd initrd-edit
2. gzip -dc /boot/initrd-2.6...img | cpio -i -c
3. edit contents of directory, specifically init or linuxrc nash script

To repackage the initrd ( or initramfs )

1. cd /initrd-edit
2. find . | cpio --quiet -c -o >../newinitrd
3. cd ..
4. gzip -9 <newinitrd >initrd-2.6...img
5. copy the new initrd image to /boot

As I don't know which distro you use you will have to check which method of initrd creation yours uses. Have a look at the mkinitrd or mkinitramfs bash script ( usually in /sbin ) or simply gunzip the initrd file and look at its file type.

[root@localhost ~]# file initrd*
initrd-2.6.15-1.2054_FC5smp.img: ASCII cpio archive (SVR4 with no CRC)

Let me know if this works.
Thank you very much, I could not look into this because I found some problem with the MoBo I am getting a replacement. When I get it, I will work on this too. Thank you again for detailed answers.
 
Old 08-28-2007, 02:07 AM   #15
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Or you can just use mkinitrd from the live CD to regenerate initrd.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing Vol-Group BadKharma Fedora 4 09-29-2007 12:31 PM
rename a group of files to a single extention Lleb_KCir Linux - General 9 02-20-2005 01:40 AM
Maxiumum Vol Size monkeyleader Linux - Hardware 5 10-22-2004 06:17 PM
Group Admin, Group Root, or God over Group crickett Linux - General 5 07-12-2004 05:01 PM
Modem config-vol off lachlan Linux - General 2 10-16-2002 06:26 AM


All times are GMT -5. The time now is 03:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration