This solution assumes you have already installed Debian Linux with minimum base system.
This solution is made for amd64 system. But others should be the same, just find the correct package for you system.
Setup
First install SSH, so it will be a lot easier to copy/paste commands in console
apt-get install ssh
Remove packages we don’t need
apt-get remove exim4 exim4-base lpr nfs-common portmap pidentd pcmcia-cs pppoe pppoeconf ppp pppconfig
apt-get install screen debootstrap iproute python python-twisted-core python-twisted-conch bridge-utils
XEN related packages
apt-get install xen-linux-system-2.6.18-6-xen-amd64
apt-get install xen-tools
If you wish to use XFS file system, you also need to install xfsprogs
apt-get install xfsprogs
Creating Virtual Machines
The best way of creating up virtual machines is using hard drives LVM volume, thus way you can easly increase partition size of partition where VM is.
Creating virtual machine using LVM volume vs0, and ext3 filesystem. VM will be running minimum base install of Debian Linux
xen-create-image –hostname=vm1.hackersdiary.com –size=4Gb –swap=512Mb –ide \
–ip=10.0.0.119 –netmask=255.255.255.0 –gateway=10.0.0.1 –force \
–lvm=vs0 –memory=512Mb –arch=amd64 –fs=ext3 –kernel=/boot/vmlinuz-2.6.18-6-xen-amd64 \
–debootstrap –dist=etch –mirror=http://ftp.ee.debian.org/debian/ –passwd \
–initrd=/boot/initrd.img-2.6.18-6-xen-amd64
This will create a 4Gb root partition, and 512Mb swap for VM. After the installation of base system, you will be required to input root password for your newly created VM.
To create XFS filesystem on VM, replace the –fs=ext3 with –fs=xfs
To use image files instead of LVM volumes replace –lvm=vs0 with –dir=/vm/images
Make VM to start automatically on boot
ln -s /etc/xen/vm1.hackersdiary.com.cfg /etc/xen/auto
Starting up VM manually
xm create -c /etc/xen/vm1.hackersdiary.com.cfg
To leave VM’s shell, type CTRL+] if you are at the console, or CTRL+5 if you’re connected to main debian using ssh
Shutting down VM
xm shutdown vm1.hackersdiary.com
Also awailable commands
xm reboot vm1.hackersdiary.com
xm list
How to increase VM’s partition size (Only if using LVM)
XFS Filesystem
lvextend -L+10G /dev/vs0/vm1.hackersdiary.com-disk
xm shutdown vm1.hackersdiary.com
mount /dev/vs0/vm1.hackersdiary.com-disk /vm/base
xfs_growfs /vm/base
umount /vm/base
xm create -c /etc/xen/vm1.hackersdiary.com.cfg
EXT3 Filesystem
lvextend -L+10G /dev/vs0/vm1.hackersdiary.com-disk
xm shutdown vm1.hackersdiary.com
resize2fs /dev/vs0/vm1.hackersdiary.com-disk
e2fsck -f /dev/vs0/vm1.hackersdiary.com-disk
xm create -c /etc/xen/vm1.hackersdiary.com.cfg
Comments? Problems? You’re welcome.