[CentOS] Resizing est4 filesystem while mounted

Sat Jun 16 01:18:38 UTC 2012
Ross Cavanagh <ross.cav at gmail.com>

On Sat, Jun 16, 2012 at 4:30 AM, Dennis Jacobfeuerborn <
dennisml at conversis.de> wrote:

> On 06/15/2012 09:10 PM, Jeff Boyce wrote:
> > Greetings -
> >
> > I had a logical volume that was running out of space on a virtual
> machine.
> > I successfully expanded the LV using lvextend, and lvdisplay shows that
> it
> > has been expanded.  Then I went to expand the filesystem to fill the new
> > space (# resize2fs -p /dev/vde1) and I get the results that the
> filesystem
> > is already xx blocks long, nothing to do.  If I do a # df -h, I can see
> that
> > the filesystem has not been extended.  I could kick the users off the VM,
> > reboot the VM using a GParted live CD and extend the filesystem that way,
> > but I thought that it was possible to do this live and mounted?  The RH
> docs
> > say this is possible; the man page for resize2fs also says it is possible
> > with ext4.  What am I missing here?  This is a Centos 6.2 VM with an ext4
> > filesystem.  The logical volumes are setup on the host system which is
> also
> > a Centos 6.2 system.
>
> You didn't really specify your topology accurately so I assume you used
> lvextend on the host side. This will not be visible until you rebooted the
> guest.
>
> The only way to resize without taking the system offline is to use lvm in
> the guest. Add a new virtual disk on the host side which results in a
> hot-plug event in the guest (i.e. you should see the new drive added in the
> guest). Now create a single partition on the drive (this is important!) and
> use pvcreate to turn it into a physical volume. Now add the new PV to the
> Volume Group. Finally you can lvextend the LV in the guest and resize the
> filesystem.
>
> The partitioning of the new disk in the guest is important because if you
> use the disk directly as a PV then this PV will also be shown on the host.
> An alternative is to modify the LVM filters in /etc/lvm/lvm.conf on the
> host to specifically not scan the LV for the new disk.
> I find it easier to create a partition though (i.e. use /dev/vda1 instead
> of /dev/vda as the PV).
>
> Regards,
>  Dennis
>
> Not sure if this link would help, I used to refer to this now and then if
I needed to extend an online partition -->
http://www.randombugs.com/linux/howto-extend-lvm-partition-online.html