Riaan's SysAdmin Blog

My tips, howtos, gotchas, snippets and stuff. Use at your own risk!

LVM

How to Rename your Logical Volume Group

Boot a Linux live CD. I used Fedora which I know has LVM enabled in the kernel at boot time.

# vgchange -a y
  5 logical volume(s) in volume group "locallvm" now active

# mkdir /mnt/a

# mount /dev/locallvm/root /mnt/a

** Figure out where your /boot physical partition lives. This one was sda2 but it could easily be /dev/sda1 also.

# mount /dev/sda2 /mnt/a/boot

# ls /mnt/a/boot/
abi-3.0.0-12-server         memtest86+.bin
config-3.0.0-12-server      memtest86+_multiboot.bin
grub                        System.map-3.0.0-12-server
initrd.img-3.0.0-12-server  vmcoreinfo-3.0.0-12-server
lost+found                  vmlinuz-3.0.0-12-server

# mount -o bind /sys /mnt/a/sys
** Note:  if –o dev and –o proc don’t work, use –o bind for the next two
# mount -o dev /dev /mnt/a/dev
# mount -o proc /proc /mnt/a/proc

# chroot /mnt/a /bin/bash

Run update-grub
** If /run/lock does not exist, create the directory or else update-grub will fail since /var/lock is linked to /run/lock.

Use ls /boot to find the most current kernel and then run mkinitramfs on it.

mkinitramfs -k -o /boot/initrd.img-3.2.0-29-generic -v 3.2.0-29-generic

This next step is important and you need to do it before you reboot. If necessary change /etc/fstab references to point to new VG name.

Type exit. Choose reboot system from menu. Eject the CD so we don’t boot off CD by default.

admin

Bio Info for Riaan