WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] how do I increase a LVM based xen domU?

To: Rudi Ahlers <rudiahlers@xxxxxxxxx>
Subject: Re: [Xen-users] how do I increase a LVM based xen domU?
From: Pasi Kärkkäinen <pasik@xxxxxx>
Date: Thu, 18 Sep 2008 10:07:55 +0300
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 18 Sep 2008 00:08:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <695200da0809172331h59359967s65506877bfd18ac4@xxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <695200da0809172331h59359967s65506877bfd18ac4@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.13 (2006-08-11)
On Thu, Sep 18, 2008 at 08:31:28AM +0200, Rudi Ahlers wrote:
> Hi all
> I know for many this is probably an easy answer, but I just can't figure it
> out.
> 
> How do I increase the size of a xen domU that's installed on a LVM
> partition?
> 
> >From what I can gather from Google searches, is that I need to use lvextend,
> but that doesn't seem enough.
> 
> So, what do I need todo to extend a 5GB LVM to say 8GB?
> 
> I have the following setup:
> 
> [root@saturn plugins]# lvscan
>   ACTIVE            '/dev/System/root' [10.00 GB] inherit
>   ACTIVE            '/dev/System/swap' [4.00 GB] inherit
>   ACTIVE            '/dev/System/pluto' [50.00 GB] inherit
>   ACTIVE            '/dev/System/home' [10.00 GB] inherit
>   ACTIVE            '/dev/System/data' [20.00 GB] inherit
>   ACTIVE            '/dev/System/andrew_vmswap' [1.00 GB] inherit
>   ACTIVE            '/dev/System/andrew_rootimg' [5.00 GB] inherit
>   ACTIVE            '/dev/System/keith_vmswap' [1.00 GB] inherit
>   ACTIVE            '/dev/System/keith_rootimg' [5.00 GB] inherit
>   ACTIVE            '/dev/System/12_vmswap' [1.00 GB] inherit
>   ACTIVE            '/dev/System/12_rootimg' [5.00 GB] inherit
>   ACTIVE   Original '/dev/System/wiseguy_rootimg' [10.00 GB] inherit
>   ACTIVE            '/dev/System/wiseguy' [5.00 GB] inherit
>   ACTIVE   Snapshot '/dev/System/oldcpanel' [32.00 MB] inherit
> 
> 
> 
> And I would like to increase the size of /dev/System/wiseguy
> 
> 
> 
> Inside the domU, I get the following:
> 
> 
> root@server [/scripts]# fdisk -l
> 
> Disk /dev/xvda: 5368 MB, 5368709120 bytes
> 255 heads, 63 sectors/track, 652 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> 
>     Device Boot      Start         End      Blocks   Id  System
> /dev/xvda1   *           1          13      104391   83  Linux
> /dev/xvda2              14         652     5132767+  83  Linux
> 
> 
> 
> 
> Can someone please tell me what commands I need to run to resize the LVM?
> 

I assume you have those LVM volumes in dom0. 

- lvextend the volume in dom0. 
- run "cat /proc/partitions" in domU. Check the size of xvda.
- shutdown domU and start it up again (to pick up the new size for xvda from 
the extended lvm volume) 
- run "cat /proc/partitions" in domU. Verify xvda is bigger now.
- create new partition to xvda, or resize existing partition (you can only grow 
the last partition easily)
- mkfs.ext3 the new partition or resize2fs the existing partition you just grew 
by editing the xvda partition table.

Xen doesn't support online resizing domU xvdX/vbd devices at the moment. 
So you need to restart domU to see the new/bigger size for xvdX devices. 

You could also run LVM in domU aswell.. to be able to resize any 
partition/volume in domU more easily.
In this case the procedure would be:

- lvextend the volume in dom0.
- run "cat /proc/partitions" in domU. Check the size of xvda.
- shutdown domU and start it up again (to pick up the new size for xvda from 
the extended lvm volume)
- run "cat /proc/partitions" in domU. Verify xvda is bigger now.
- resize/grow the LVM PV partition by editing partition table. Remember you can 
only grow last partition easily.
- reboot domU to make sure new partition sizes are picked up.
- run vgdisplay to check available/free space on your VG.
- run pvresize to resize the LVM PV.
- run vgdisplay to verify you have more free space in your VG now.
- lvextend any domU volume you want to.
- run resize2fs for the volume.

Another option is to have LVM PV directly on say xvdb, without any partition 
table..
Then you can skip the partition table editing steps.. just a simple reboot
will pick up the new size and you can pvextend immediately after.

-- Pasi

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users