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: Paul Van Allsburg <paulvanall@xxxxxxxxxxx>
Subject: Re: [Xen-users] Howto install domU CentOS 5 directly on partition
From: Liam Kirsher <liamk@xxxxxxxxxxx>
Date: Mon, 30 Jul 2007 16:26:41 -0700
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 30 Jul 2007 16:24:47 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <46AC1372.3060103@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>
Openpgp: id=7011F7B7; url=http://liam.numenet.com/pgp/
References: <46AB27CB.3050501@xxxxxxxxxx> <46AB9513.3080000@xxxxxxxxxxx> <46AC1372.3060103@xxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.0 (X11/20070326)
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.
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.
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.

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

Start it up:
xm create -c domN

Login and run 'yum update' and install any additional packages.

There, I hope that helps!

Best,
Liam

Paul Van Allsburg wrote:
> Hi Liam,
> I'd like to see the details - I'll try on a f7 machine.  It would be
> great not to have to learn everything from scratch for once!
> Thanks!
> Paul Van Allsburg
>
> Liam Kirsher wrote:
>> I used virt-install, and selected custom partitioning during the install
>> process, removing the LVM stuff and reducing it to one partition.  Then
>> the install proceeded fine.  That created my "template" OS, with a
>> single partition and no swap (ignore the warning about missing swap
>> during install).  That is created on a logical volume accessible from
>> dom0, can be mounted with kpartx and mount.
>>
>> Now I just create logical volumes for data and swap, and copy (using dd)
>> the template to the data, mkswap on swap.
>> Then, mount the data volume, make a few changes, and just start it up.
>> I can send more details if you like, but I've got to run now.
>> It took me a *looooong* time to figure out exactly how to do it, but now
>> I can set up a new domU in less than ten minutes, and it´s easy to
>> access the domU files from dom0.
>>
>> Liam
>>
>>
>> kanour-xen wrote:
>>> Hi.
>>>
>>> I am new to CentOS (Debian user) and I am looking for way how to
>>> install CentOS 5 on domU in the way that I have it directly on dom0
>>> LVM partition.
>>> If I install it with virtual-manager then the installation program
>>> takes that partition as a disk and then creates new partitions on it.
>>> I don't want it that way because I cannot then mount it from dom0.
>>>
>>> Is there some way how to install it directly on partition as for
>>> example in Debian with debootstrap?
>>>
>>> Thank you
>>>
>>> Jiri
>>>
>>> _______________________________________________
>>> Xen-users mailing list
>>> Xen-users@xxxxxxxxxxxxxxxxxxx
>>> http://lists.xensource.com/xen-users
>>>
>>>
>>
>
>
> _______________________________________________
> Xen-users mailing list
> Xen-users@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-users
>
>

-- 
Liam Kirsher
PGP: http://liam.numenet.com/pgp/


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