Increase The Size of a Mounted Partition with LVM

Author: Mark DeCheser
Published: May 31, 2010 at 8:18 am
Share

With LVM, it is possible to grow a partition safely without unmounting and remounting your volume. These steps presume you have extra disk available on your volume which is currently unallocated. While it is possible to move unused disk from one partition to another, it is not advised because it requires you to shrink a partition first (a risky process).

For purposes of this how-to, let's presume that you have already verified that your partition is out of space (or getting close) by using df or some other method. Let's also presume you have a separate partition in /usr/local which is in a separate Volume Group (VolGroup01). Follow these steps to grow your partition:

1) List your volumes:

$ cat /etc/fstab (I'll show only what is pertinent)

/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
/dev/VolGroup01/LogVol01 /usr/local ext3 defaults 1 2

This step simply verifies your Volume Group name and Logical Volume name.

2) Run pvscan to verify you have allocatable space in your target Logical Volume:

$ sudo pvscan

PV /dev/sda2 VG VolGroup00 lvm2 [19.88 GB / 1020.00 MB free]
PV /dev/sdb VG VolGroup01 lvm2 [100.00 GB / 20.00 GB free]

From the output, you can see VolGroup01, which contains the partition want to grow, had some free space.

3) Run lvresize to add free space to your partition:

$ sudo lvresize -L 20G -n LogVol01 /dev/mapper/VolGroup01-LogVol01

Extending logical volume LogVol01 to 120.00GB
Logical volume LogVol01 successfully resized

4) Run df again to verify that you have additional space:

$ df -h (truncated to relevant portions)

/dev/mapper/VolGroup01-LogVol01
120G 100G 20G 80% /usr/local

And huzzah! 

 
 

About this article

Profile image for markdecheser

Article Author: Mark DeCheser

Mark has been working in technology based positions since 1999. His professional experience with internet-related projects spans numerous roles, including company branding & marketing, strategy, design, development, and quality insurance testing. …

Mark DeCheser's author pageAuthor's Blog

Article Tags

Share: Bookmark and Share

Add your comment, speak your mind

Personal attacks are NOT allowed
Please read our comment policy