[CentOS-virt] Resize guest filesystem question

Mon Feb 27 18:20:58 UTC 2012
Jeff Boyce <jboyce at meridianenv.com>

Responding to the daily digest, see comment at bottom.


> Message: 1
> Date: Mon, 27 Feb 2012 14:01:27 +0100
> From: Markus Falb <markus.falb at fasel.at>
> Subject: Re: [CentOS-virt] Resize guest filesystem question
> To: centos-virt at centos.org
> Message-ID: <jifur8$pmi$1 at dough.gmane.org>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On 24.2.2012 21:28, Sergiy Yegorov wrote:
>> Fri, 24-Feb-2012 12:05:55 Jeff Boyce wrote:
>>
>>> 6.  Then I ran  resize2fs /dev/vda2  and got the result that the 
>>> filesystem
>>> is already xx blocks long.  Nothing to do!
>> Before you can resize filesystem, you have to resize partition.
>> If it is only 2 partitions on /dev/vda, you can use one of two ways:
>> 1. Resize partition from host system (I think it is not the best idea for 
>> root
>> partition operations):
>>  Run fdisk /dev/vg/lv_guest1root, delete second partition and create new 
>> one
>> which starts from the same place but takes all available space, after it 
>> you
>> can boot guest (in single mode) and run resize2fs.
>> 2. Boot VM from any 3-party (LiveCD or any) with access to virtual disk, 
>> and
>> do the same: in fdisk delete existing partition, create new one and run
>> resize2fs on it. Or just use parted to do it in one command.
>
> 3. You can repartition from the guest itself
> Do as in 2. After saving the new partition table fdisk will probably
> request a reboot for using the new table. reboot, then resize the fs.
>
> -- 
> Kind Regards, Markus Falb
>

Thanks to everyone that replied.  Ed gave me the right clue that I was 
missing (and is apparently missing in a lot of the how-to's that I reviewed 
which only said to expand the LV, then expand the filesystem).  I had to 
expand the partition before expanding the filesystem.  So for my solution I 
rebooted that particular VM using SystemRescue LiveCD, then started GParted 
and expanded the partition which also expanded the filesystem in a single 
step.  Then rebooted using the VM's image and #df -h now shows the expanded 
LV and a file system on the full space.

Jeff