Thursday, October 21, 2010

Lvm reducing and extending

Resizing ,extending adding a disk in lvm
 lvextend -L12G /dev/myvg/homevol (or)  lvextend -L+1G /dev/myvg/homevol
I am adding a new hard drive to increase the size of my logical volume "home1" in logical volume group "home" with LVM2 under Ubuntu 6.10.1 LTS.  The instructions in the LVM Howto are pretty straightforward; the only part that spooks me is the resizing of the ext3 filesystem.  This is what I have done so far:
(installed new hardware & partitioned with fdisk; shows up as /dev/sdb1)
(backed up the existing logical volume in case something bad happens)

# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created 

# vgextend home /dev/sdb1
  Volume group "home" successfully extended 

# lvextend -l 357700 /dev/home/home1
  Extending logical volume home1 to 1.36 TB
  Logical volume home1 successfully resized

From what I googled, the next steps are a bit more involved for LVM2 than the Howto lets on.  Does the following look o.k. to the experts:

' use a root login, not su or sudo, because /home will be unmounted

# umount /dev/home/home1 ' the next steps should be done off-line

# e2fsck -C 0 -v dev/home/home1 ' make sure the file system is ok

# tune2fs -O ^has_journal /dev/home/home1 'disable journaling on the logical volume

# resize2fs /dev/home/home1 'do the resizing

# e2fsck -C 0 -v dev/home/home1 ' make sure the file system is still ok

# tune2fs -O has_journal /dev/home/home1 're-enable journaling
# e2fsck -C 0 -v dev/home/home1 ' yes, I am a first-timer and somewhat paranoid

# mount /dev/home/home1 /home ' back on-line
 -------------------------------
VGREDUCE

vgreduce <volume group> <device name>
mount -o remount,rw /

LV REMOVE

lvremove /dev/volumegroup/logical volume

No comments:

Post a Comment