HOWTO Resize LVM partitions and filesystems

HOWTO Resize LVM partitions and filesystems

From Consultancy.EdVoncken.NET

Jump to: navigation, search

This one is short and sweet. Let's say you wish to enlarge your root ('/') filesystem on the fly.

With LVM, you can perform online resizing. Better still, it takes only two steps!

  1. Extend the disk volume
  2. Extend the filesystem within that disk volume to use all available space
 # lvresize -L 80G /dev/vg_md1/lv_dom0_root
   Extending logical volume lv_dom0_root to 80.00 GB
   Logical volume lv_dom0_root successfully resized
 
 # resize2fs /dev/vg_md1/lv_dom0_root
 resize2fs 1.39 (29-May-2006)
 Filesystem at /dev/vg_md1/lv_dom0_root is mounted on /; on-line resizing required
 Performing an on-line resize of /dev/vg_md1/lv_dom0_root to 20971520 (4k) blocks.
 The filesystem on /dev/vg_md1/lv_dom0_root is now 20971520 blocks long.

Done!

Note: Of course, you should first verify that you have a recent and working backup!