[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Howto install domU CentOS 5 directly on partition


  • To: Liam Kirsher <liamk@xxxxxxxxxxx>
  • 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
  • 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=
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.