Women in Technology

Hear us Roar



Article:
  Managing Disk Space with LVM
Subject:   simple logical volume extension
Date:   2008-01-29 16:54:01
From:   dustinkirkland
Good article, guys. I've used this guide as a reference on several occasions. Thanks.


I ran across a simple use case that wasn't explicitly covered in the article, but I was able to piece together the required commands from various examples in the article. I thought I'd share concisely.


Given:


  • A single disk (/dev/sda), partitioned to a Physical Volume (/dev/sda2) in an active Volume Group (VolGroup00), and allocated to a Logical Volume (/dev/VolGroup00/LogVol00)

  • An active filesystem (ext3) mounted (/) on that Logical Volume, where more disk space is required

  • No RAID involved


Wanted:


  • To add disk space (/dev/sdb) to the mounted filesystem (/)


Procedure:


  • Partition the disk (/dev/sdb1), mark as type 8e

    # fdisk /dev/sdb


  • Create the physical volume

    # pvcreate /dev/sdb1


  • Extend the volume group by adding the new physical volume

    # vgextend VolGroup00 /dev/sdb1


  • Check the new volume group size

    # vgdisplay | grep "VG Size"


  • Extend the logical volume to the new total available

    # lvextend -L 28G /dev/VolGroup00/LogVol00


  • Find the filesystem mount point

    # mount


  • Perform an online resize of the filesystem to the max available

    # ext2online -v /dev/mapper/VolGroup00-LogVol00


  • Now check your disk free

    # df -h