5.22.2009

Extend a Mounted LVM EXT3 Partition

Prerequisites:

You need to have some extra unused space in your volume group. That's pretty much it.


Dump:


[root@webapp /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.9G 4.5G 1.1G 81% /
/dev/xvda1 99M 29M 66M 31% /boot
tmpfs 3.0G 0 3.0G 0% /dev/shm

[root@webapp /]# pvscan
PV /dev/xvda2 VG VolGroup00 lvm2 [15.50 GB / 7.56 GB free]
Total: 1 [15.50 GB] / in use: 1 [15.50 GB] / in no VG: 0 [0 ]

[root@webapp /]# lvextend -L+3G /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 9.00 GB
Logical volume LogVol00 successfully resized

[root@webapp /]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 2359296 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 2359296 blocks long.

[root@webapp /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
8.8G 4.5G 3.9G 54% /
/dev/xvda1 99M 29M 66M 31% /boot
tmpfs 3.0G 0 3.0G 0% /dev/shm


Done.

1 comment:

  1. Nice short post. Just a comment on my personal preference. When looking for available space, I usually use a vg command to look at the VG stats for free PE (or PP depending on your OS). So in this case instead of the "pvscan" it would be a "vgscan", or on other OS "vgdisplay", "lsvg" or whatever you have.

    Because it's the VG space you are allocating, not necessarily the PV space.

    Thanks!
    http://geekswing.com

    ReplyDelete