Home > Linux, Tips & Tricks > Extend a ext3 volume with LVM

Extend a ext3 volume with LVM

February 7th, 2009 Leave a comment Go to comments

If you have a ext3 volume on LVM you can easily change this volume.

When you want to extend a volume you can do this with lvextend.
To extend a volume with 10GB do the following:

[[email protected] ~]# lvextend -L+10G /dev/<volgroup>/<volume>
Extending logical volume <volume> to 14.88 GB
Logical volume <volume> successfully resized

After this you have to extend/resize the filesystem:

[[email protected] ~]# resize2fs /dev/<volgroup>/<volume>
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/os is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/os to 3899392 (4k) blocks.
The filesystem on /dev/VolGroup00/os is now 3899392 blocks long.

That’s all!
You can do this without any problems on a live root file system.

  1. Benny Chitambira
    February 19th, 2009 at 18:07 | #1

    You cannot actually do this on a live root filesystem (while its mounted) You can resize other lv’s but not /dev/VolGroup/root unless your do pivot to another temporary root, resize your root, then pivot back to your original root.

  2. TrafeX
    February 20th, 2009 at 13:42 | #2

    @Benny Chitambira
    Yes you can, I’ve done it. The output you see above is really the root (/ is mounted on /dev/VolGroup00/os) filesystem. I haven’t umount it, and it worked without any problems. The server is still running fine :)

  1. No trackbacks yet.