LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Help with vgrename & lvrename (https://www.linuxquestions.org/questions/linux-general-1/help-with-vgrename-and-lvrename-468330/)

rh_bomani 07-27-2006 03:51 PM

Help with vgrename & lvrename
 
Hello, I'm using RHEL 4.0 and have lvm2 v2.0 and I wish to rename both my volume group and logical volumes. Here is my current setup,/dev/VolGroup00/LogVol00, and I want to change to something like /dev/sys/home. I read the docs on tldp.org but they don't go into detail about vgrename and lvrename.

Must I first umount the filesystems, use lvchange -an
pathtoLogicalVolume, and then lvrename?

Here is an example of what I tried and the error I got.

[root@UW-RASBERRYL ~]# umount /opt
[root@UW-RASBERRYL ~]# lvchange -an /dev/VolGroup00/LogVol06
[root@UW-RASBERRYL ~]# lvrename /dev/VolGroup00/LogVol06 /dev/VolGroup00/sys-opt
[root@UW-RASBERRYL ~]# lvchange -ay /dev/VolGroup00/sys-opt
One or more specified logical volume(s) not found.

uselpa 08-03-2006 02:02 PM

That procedure seems correct, it works for me:
Code:

root@slackw:~$ lvs
  LV      VG      Attr  LSize  Origin Snap%  Move Copy%
  LVtemp  VGlocal -wi-a- 60,00G
  LVvmware VGlocal -wi-ao 35,94G

root@slackw:~$ lvchange -an /dev/VGlocal/LVtemp

root@slackw:~$ lvrename /dev/VGlocal/LVtemp /dev/VGlocal/LVtest
  Renamed "LVtemp" to "LVtest" in volume group "VGlocal"

root@slackw:~$ lvchange -ay /dev/VGlocal/LVtest

root@slackw:~$ lvs
  LV      VG      Attr  LSize  Origin Snap%  Move Copy%
  LVtest  VGlocal -wi-a- 60,00G
  LVvmware VGlocal -wi-ao 35,94G

root@slackw:~$ mount /dev/VGlocal/LVtest mountpoint

root@slackw:~$ v mountpoint/
total 0
drwxr-xr-x  9 pu pu 216 2006-06-10 14:45 zw26/

root@slackw:~$ mount
/dev/hda6 on / type reiserfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/mapper/VGlocal-LVvmware on /mnt/vmware type ext3 (rw)
/dev/hda3 on /mnt/win type vfat (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,size=144m)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/mapper/VGlocal-LVtest on /root/mountpoint type reiserfs (rw)

Maybe try issuing an `lvscan` or `vgscan`?

rh_bomani 08-04-2006 03:47 PM

Did you have to go into single user mode and/or shut down services first?
I get device busy messages for my / and /var partitions.

uselpa 08-04-2006 03:55 PM

No, but my LV is something that doesn't need to be mounted for normal operation. If your LV contain / and /var, I'd suggest that you take a LVM2-compatible live CD, boot that and change the LV names and /etc/fstab from there.

Personally I use RIP but I guess that in your case, the CentOS LiveCD should be a good choice. Haven't used it, though.

rh_bomani 08-04-2006 08:34 PM

thanks alot for the suggestion. I downloaded and used knoppix and it allowed me to change the vg's and lv's. It's my first time using a livecd so I'm trying to figure out how to access original fstab and make necessary changes.

uselpa 08-05-2006 04:18 AM

Last time I used Knoppix the local partitions were shown as icons on the desktop, but they weren't LVM partitions. If they show up, you can click on those and you should see fstab in the subfolder /etc.

Otherwise, go to a shell, create a mountpoint, mount your LV there and under you mountpoint you'll find etc/fstab as well which you can edit directly.

rh_bomani 08-07-2006 05:59 PM

thanks alot! I had to create mountpoints for the lv's. From there I was able to edit any file I wanted.

rh_bomani 09-27-2006 08:38 PM

Revisiting of an old topic. I opened a support ticket with RH to find an official solution to this problem. Here is the conclusion we came too after a few trial and errors.

Logical Volume Rename
1.) boot into rescue mode
2.) issue lvrename OLD NEW for each lv
3.) edit fstab and grub.conf

Oddly, I did not have to use lvchange -an/y.
VG renames proved very troublesome.

Volume Group Rename
1.)boot into rescue mode
2.) edit fstab and grub.conf to new VG name
3.)exit and boot into rescue mode. When prompted to select 'Continue', Read-Only' or 'Skip' choose skip
4.) type lvm vgrename OLD NEW
5.)exit and boot into rescue mode
6.) chroot /mnt/sysimage
7.) rebuild initial ramdisk


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