Extending Logical Volume

I was only using a part of my external usb hard drive to keep backups and needed to extend the partition to accomodate the ever-growing backup files.

There are quite some ways to do this which can be referenced at FedoraNews.org and TLDP.org .

Below is a quick command line reference if you are familiar with the process already.

  1. I added an additional 10GB of space:
    # lvextend -L+10G /dev/vg00/lvol0
    
  2. Unmount the drive:
    # umount /mnt/usbdisk
    
  3. Check the logical volume:
    # e2fsck -f /dev/vg00/lvol0
    
  4. Increase the file system size to match.
    # resize2fs -pf /dev/vg00/lvol0
    
  5. Remount:
    # mount /mnt/usbdisk
    

Here's what the logical volume is currently displayed as after extending from 50GB to 60GB:

# lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg00/lvol0
  VG Name                vg00
  LV UUID                vVr2IO-81Cc-zv05-6Ffu-hHUD-8xpc-9qUBDh
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                60.00 GB
  Current LE             15360
  Segments               1
  Allocation             next free (default)
  Read ahead sectors     0
  Block device           253:0

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

online resize

Linux 2.6 kernel supports on-line resize for filesystems mounted using ext3 with resize2fs, so no need to unmount when resizing!!

Extend Volume Group

If adding a new drive or partition to extend logical volume, you can extend your existing volume group as below:

  1. Create a new physical volume:
    # pvcreate /dev/sdb1
  2. Extend existing volume group to use the new physical volume.
    # vgextend vg00 /dev/sdb1
  3. Display summary via:
    # pvs
    # vgs
Comment