[CentOS] Is it possible to lvrename the current root partition?
Ross S. W. Walker
rwalker at medallion.com
Fri May 2 21:24:46 UTC 2008
Alfred von Campe wrote:
>
> I'd like to rename my existing volume groups and logical volumes (I
> picked names a long time ago I no longer like :-). I recently
> stumbled across the lvrename and vgrename commands, but when I tried
> the former to rename the logical volume that my root partition
> resides on, the system became unbootable.
>
> In addition to renaming the LV (and VG if I decide to to that as
> well), what else needs to be changed? So far my list includes:
>
> o /etc/fstabb
> o /boot/grub/grub.conf
> o /dev/<vgname>/<lvnamex>
> o /dev/mapper/<vgname-lvnamex>
>
> I was hoping the lvrename and/or vgrename would take care of these
> details. Are there any scripts out there that take care of all the
> details? If not, I may write one (once I have the recipe to get this
> working, of course).
Sure you can do all this from rescue mode off the first CD.
Boot the cd type in 'linux rescue' and continue to the command prompt.
At the command prompt:
1) make sure swap isn't using the swap lv
- swapoff -a
2) unmount all lvs mounted
- umount /mnt/sysimage/boot
- umount /mnt/sysimage
3) mark all lvs as unavailable
- lvchange -a n <vgname>
4) rename the volume group
- vgrename <oldvgname> <newvgname>
5) rename the logical volumes
- lvrename <vgname>\<oldlvname> <newlvname>
6) repeat #5 as necessary
7) re-activate all the lvs
- lvchange -a y <vgname>
8) re-mount the root and boot lvs,
- mount /dev/<vgname>/<rootlv> /mnt/sysimage
- mount /dev/<vgname>/<bootlv> /mnt/sysimage/boot
9) chroot to the mounts with, 'chroot /mnt/sysimage /bin/bash'
10) edit /etc/fstab
11) edit /boot/grub/grub.conf
That should do it.
-Ross
______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.
More information about the CentOS
mailing list