john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Lvm rename volgroup vgrename systemrescuecd lvm2 logical volume resize

boot using SystemRescueCd (NOTE: boot with x64 if you have a 64 bit system (using Ubuntu 10.04.2 x64 so mkinitramfs instead of mkinitrd) lvm vgscan lvm vgrename VolGroup00 NewName lvm vgchange -a y (activate the lvm's)

mount /dev/mapper/VolGroup00-root /mnt/backup (mount before modifying fstab!)

nano /mnt/backup/etc/fstab /dev/mapper/VolGroup00-root modified to be /dev/mapper/NewName-root

nano /mnt/backup/etc/mtab /dev/mapper/VolGroup00-root ... /dev/mapper/NewName-root

mount -o bind /sys /mnt/backup/sys mount -o bind /sys /mnt/backup/proc mount -o bind /dev /mnt/backup/dev

chroot: failed to run command `/bin/zsh': No such file or directory echo $SHELL (/bin/zsh) SHELL=/bin/bash echo $SHELL (/bin/bash)

chroot /mnt/backup /bin/bash (ensuring that after chroot you start BASH!)

mount /dev/sda1 /boot (or earlier might have "mount /dev/sda1 /mnt/backup/boot" )

cd /boot mkinitramfs -o /boot/initrd.img-2.6.32-28-server 2.6.32-28-server

UNFORTUNATELY THE ABOVE STEP FOR recreating the init.rd does not seem to help (can't boot ... so somewhere the old name is still stuck...)


modprode dm-mod # enable the lvm module in the kernel if not yet enabled vgscan # initialize the lvm information (usually done at boot)

pvscan pvdisplay # physical volumes vgdisplay # volume groups lvdisplay # logical volumes that are in side of volume groups ls -ahl /dev/mapper # listing of logical volumes file systems (i.e. mount /dev/mapper/myroot /mnt/backup)

  1. create a new partition (systemrescuecd + gparted)
  2. pvcreate /dev/sda3 (command line: new lvm physical volume in the new partition)
  3. vgextend myvolumegroup /dev/sda3 (extend the volume group to the new physical volume)
  4. lvextend -l +100%FREE VolGroup/name_of_logical_volume (i.e. myvolumegroup/root )

e2fsck -f /dev/mapper/test--mule-root resize2fs /dev/mapper/test--mule-root

dumpe2fs -h /dev/mapper/ExistingExt4 # view accurate detailed disk info, better than df



vgchange -ay # only necessary if modifying the volumes

/dev/mapper/test--mule-root 8.8G 2.5G 5.8G 31% /

/dev/sda1 * 2048 499711 248832 83 Linux /dev/sda2 501758 20969471 10233857 5 Extended /dev/sda3 20969472 419430399 199230464 83 Linux /dev/sda5 501760 20969471 10233856 8e Linux LVM

PV VG Fmt Attr PSize PFree /dev/sda5 test-mule lvm2 a- 9.76g 0

lvextend -L +100G /dev/mapper/vg00-var

vgchange -an myvolumegroup # deactivate the volume group vgexport myvolumegroup

ERROR PRONE FDISK METHOD

  1. increase the size of the extended partition (gparted)
  2. increase the size of the /dev/sda5 partition (fdisk to delete and recreate) 501760 - 20969471 (8e)

    1. increase the lv size

lvextend -L +100G /dev/mapper/test-mule lvresize -L 100g -n test-mule /dev/mapper


  • « nirvanix connection
  • OxygenLogin pom.xml »

Published

Feb 15, 2013

Category

linux

~344 words

Tags

  • linux 249
  • logical 1
  • lvm 2
  • lvm2 1
  • rename 1
  • resize 2
  • systemrescuecd 3
  • vgrename 1
  • volgroup 1
  • volume 1