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

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


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
virt-install --paravirt --nographics --name=domTemplate \
        --location=nfs: \

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
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:

- 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!


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



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