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: "Fajar A. Nugraha" <fajar@xxxxxxxxx>
Subject: Re: [Xen-users] how do I increase a LVM based xen domU?
From: "Rudi Ahlers" <rudiahlers@xxxxxxxxx>
Date: Thu, 18 Sep 2008 14:33:04 +0200
Cc: xen-users <Xen-users@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 18 Sep 2008 05:33:43 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=nWZNgmLSlar8QdkdIZnrVeEm3yKm0KlP41gAbjemoAQ=; b=HPn9Yvl+LmMx72sQ8ylkW5+VM14ZjZQcXBc08KFHAc92gtYH59ppP4+4wiEStJzAs9 ln7EcslJ/Zqls01VXND0s4C5ONiF6V22YNMgHcHj15RPc7TIy5JQP8PDDXD444dqlyol 24GKNrrw2EdzIh1p8ZpfJ7NghzjtLeopmiPtI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=oxfXqtTRnJ+Q5Rb8NGUjQomgsN8o2iGItXz71AdhuV6LeuYQffNsJzn9Ki7LHJY1uN pqI1ACHOkx7ZGvMLXnn0BotiGtUIEEy4t5yPr3hdZvk9B8T9WsXDvFQgzUeveYVDzY39 MnDIrdFtx3YPXhXqyIanEqKA1BnMykBqnwvXo=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <48D20F43.2000008@xxxxxxxxx>
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> <48D1FAD9.2020307@xxxxxxxxx> <695200da0809180021q6b496962gb4defaf53566a4c6@xxxxxxxxxxxxxx> <48D20F43.2000008@xxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx


On Thu, Sep 18, 2008 at 10:20 AM, Fajar A. Nugraha <fajar@xxxxxxxxx> wrote:
Rudi Ahlers wrote:
>
> On Thu, Sep 18, 2008 at 8:53 AM, Fajar A. Nugraha <fajar@xxxxxxxxx
> <mailto:fajar@xxxxxxxxx>> wrote:
>
>
>     Best practices would be :
>     1) LVM on dom0 -> maps to xvda on domU -> LVM on domU, using xvda
>     as PV
>     (which is what Redhat does by default if you install RHEL5 PV)
>     2) LVM on dom0 -> maps to (xv/s/h)da1 on domU, and mounted directly
>     without additional partitioning or LVM on domU.
>
>     It might be easier to move to  (1) or (2)
>     and move the data.
>

> Ok, so when I create a domU VPS, and I start the installation (in this
> case it's CentOS 5.2), how should I partition it?
>

If you install it using anaconda (which is what you get if you use
virt-manager) the default partitioning scheme is to use LVM on domU.
This is (1), which AFAIK is what RH recommends. It will enable easy disk
addition (you dan do xm block-attach online without having to restart
domU).

Personally, I don't like this approach because it's harder (although
possible) to mount domU's fs in dom0 (you have two LVM layers to deal with).

With Virt-install I can at least choose all the packages I need to install, and the installation files are on the server already, so I don't need to waste bandwidth every time I install it. 


Would it be better to install the VPS with an ext3 partition instead of LVM? In which case it will have 3 partitions (/boot, / & swap) but that shouldn't be a problem, right? Can an ext3 partition (for the domU)  on a LVM (dom0) be resized easily?
 

Layout(2) is somewhat more complicated because it requires either :
- you modify an existing install, or
- you have a template OS tarball, or
- you're using a distro that can install to a directory from command
line (i.e. something like debootstrap for debian/ubuntu)

Installing CentOS / Fedora Core onto CentOS is easiest with virt-install, for me :) I've tried the debootstrap option before, but have had no luck getting it to work. 

 

Note that once you have a template tarball, installing (2) is VERY easy.

> And is there any way to copy the existing data on this domU to a newly
> created one?
>
>
Copying the data is the same as you'd do on a normal linux install :
rsync, tar, dd, etc.

I just realized that your xvda doesn't contain a swap partition. Is this
intentional?

Yes, I wanted to add a separate swap partition, but haven't figured that out yet. 

 

Assuming you want to copy this existing install and modify it to (2),
these steps might work. 


The following assumes :
- you're using PV domU, not HVM
- your current domU is called "server"
- your dom0 VG is called "System"
- you only have a filesystem ("/") on domU

On dom0:
- create a new LV (10GB or whatever) on dom0
lvcreate -L 10G -n wiseguy2 System
- attach the block device as xvdb1 (or whatever partition currently
unused on domU)
xm block-attach server phy:/dev/System/wiseguy2 xvdb1 w


Do I need to create a configuration file for the wiseguy2 domU manually?
 

And then, for the following steps, for I need to mount /dev/System/wiseguy2 on say /mnt/wiseguy2 - on dom0, or do I need to boot wiseguy2 domU ?

On domU (make sure you doublecheck everything you type):
- do "fdisk -l". You should see a new disk /dev/xvdb1
- mkfs.ext3 /dev/xvdb1
- mkdir /mnt/tmp1; mount /dev/xvdb1 /mnt/tmp1
- mkdir /mnt/tmp2; mount --bind / /mnt/tmp2
- cd /mnt/tmp1
- ( cd /mnt/tmp2 && tar cvf - . ) | tar xvf -
- cd /mnt/tmp1/boot
- ( cd /boot && tar cvf - . ) | tar xvf -
- edit /mnt/tmp1/etc/fstab, remove the line for /boot, edit the line for
"/" to use "/dev/xvda1" instead of the original "/dev/xvda2"
- edit /mnt/tmp1/boot/grub/menu.lst, adjust the boot entry to look
something like this

default=0
timeout=5
title New-Centos
   root (hd0,0)
   kernel /boot/vmlinuz-2.6.18-92.1.10.el5xen ro root=/dev/xvda1
   initrd /boot/initrd-2.6.18-92.1.10.el5xen.img

At this point you have xvdb1 which contains the original xvda1 (/boot)
and xvda2 (/) merged. Next :
- shutdown domU (it's much easier this way)
- create a new xen config file with disk line which looks something like
this

disk = [ 'phy:/dev/System/wiseguy2,xvda1,w' ]
bootloader="/usr/bin/pygrub"

Note that it says "xvda1", and not xvda. The xvdb1 that you created
earlier will be mounted as xvda1 on the new domU.

- start the new domU. It should work. If it boots succesfully, you might
want to consider creating a tarball of the fs inside
/dev/System/wiseguy2 for future installs.

Regards,

Fajar



--

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