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] Howto install domU CentOS 5 directly on partition

To: Liam Kirsher <liamk@xxxxxxxxxxx>
Subject: Re: [Xen-users] Howto install domU CentOS 5 directly on partition
From: Nico Kadel-Garcia <nkadel@xxxxxxxxx>
Date: Tue, 31 Jul 2007 07:49:14 +0100
Cc: xen-users@xxxxxxxxxxxxxxxxxxx, Paul Van Allsburg <paulvanall@xxxxxxxxxxx>
Delivery-date: Mon, 30 Jul 2007 23:46:25 -0700
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=UndXYJ0ShR5Lu0JS6OkDIDnNjygerkoM0PnxZi3UQqz4jwDZiKGcfWBmuFfLXd1Kap7TkhraITeMBYzp7fjcM0eUIsY+fxbrXSTHejuuMa6SG/Liq0RVCH4k80kzGNeYhQxTlXf7eEOcNJVU8Trr7vC8zeOa7rQEBGXKji+EaMA=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=NEB5XqZHQSkVlyyXd65Ffk14h3rT2rORKBcvCpYTWRi0iHRmdJJh+NUIQ+tHUao4Z0PJk2BHptjciIO7CtFIVgNA7A4yuhPEW3sjiE3eNBqmpUQRlkhQ33fi0BIRW/99zJyJ784jemDiaz3dVSLzGoTAKWCJjtv8GIiAsqCVqMg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <46AE73B1.4060308@xxxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <46AB27CB.3050501@xxxxxxxxxx> <46AB9513.3080000@xxxxxxxxxxx> <46AC1372.3060103@xxxxxxxxxxx> <46AE73B1.4060308@xxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.12 (Windows/20070509)
Liam Kirsher wrote:
Paul,

I think someone else already furnished basically the same info, but here
is more on what I did.  I just wanted identical CentOS5 virtual
machines.  Below, I give them the name domN, where N is some integer.

First, I created a template installation using virt-install with these
variables
virt-install --paravirt --nographics --name=domTemplate \
        --location=nfs:192.168.1.102:/linux/CentOS-5.0-x86_64 \
        --ram=512

Others have pointed out that the virt-* programs need at least 500M of
RAM to function, otherwise they hang.
I didn't see how to use virt-manager to re-partition -- it kept giving
me the LVM volumes, but maybe it's possible.
You do it in your CentOS kickstart, or by hand-configuring disks in your CentOS installation as ou did.


Anyway, during installation with virt-install I removed all the volumes
and partitions and created a single new one that used the entire space
(which consisted of a previously created logical volume of 2G, named
domTemplate_data).
Ignore the warning about not having swap. The template doesn't need
swap, that gets created for each domU.
Swap is not evil in such a simple setup. You can add it later by adding another DomU "disk" and partition.


I unchecked all the packages to be installed, because I wanted a small,
generic installation to start with.  It came out to be around 1.2G, if I
recall. You could make it slimmer, but that was good enough for my purposes.
Yeah, this is RedHat's fault. I've growsed at them about it. I'm sorry, but a "base" installation should not include bluetooth and ISDN widgets.

After the domTemplate is created, you might want to check to make sure
it works before going any farther:
xm create -c domTemplate

I borrowed from the following how-to:
http://www.redhat.com/archives/fedora-xen/2006-November/msg00257.html

- Create lvm partitions:
lvcreate -L 1G -n domN_swap VolGroup01
lvcreate -L 3G -n domN_data VolGroup01

- Map the domTemplate_data partition:
kpartx -av /dev/VolGroup01/domTemplate_data

- Use dd to copy to the new partition:
dd if=/dev/mapper/VolGroup01-domTemplate_data of=/dev/VolGroup01/domN_data

- Create swap space:
mkswap /dev/VolGroup01/domN_swap

- Unmap the domTemplate_data partition:
kpartx -dv /dev/VolGroup01/domTemplate_data

- Mount the new data partition:
mount /dev/VolGroup01/domN_data /mnt/domN

- In new host, edit the following files and change 'template' to new name.
- I had named the host "template" to remind me which one I was working with.
vi /mnt/domN/etc/hosts
vi /mnt/domN/etc/sysconfig/network

- Also on new host, set the correct IP address and MAC address:
vi /mnt/domN/etc/sysconfig/network-scripts/ifcfg-eth0

- Unmount the new data partition:
umount /mnt/domN

- Copy the 'image' xen configuration file and edit it:
cp /etc/xen/domTemplate /etc/xen/domN
vi /etc/xen/domN
        set MAC address to unique!
        set memory
(I forgot to set the MAC address once, and ended up with perplexing
networking problems.  It should be unique, and should match the MAC
value set in ifcfg-eth0.  I removed the unique id, I think that should
be okay, not sure why I would need it.
You may also want to put a link in the /etc/xen/auto directory, so the
domain is created when the system boots up.)

RESIZE FILE SYSTEM if domN logical volume is larger than the template! Make sure it's not running, first.
e2fsck -f /dev/VolGroup01/domN_data
resize2fs  /dev/VolGroup01/domN_data
No need for this. You can store a tarball of the file system, not the file system itself, which is inevitably more space efficient, and restore the tarball to a new filesystem in similar fashion. I've done this before, to about 13,000 servers in one month, so I'm sure the technique works well. It's also one heck of a lot faster than using Anaconda and most other OS installers.

Getting "grub" loaded for use by pygrub in my approach of setup is.... a bit of an art form to discuss another time.

Your write-up is overall quite good, and appropriate for a FAQ.

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