Xen 4.0.1 on Debian Squeeze dom0 and domU

From Wiki

(Difference between revisions)
Jump to: navigation, search
Line 44: Line 44:
== Create Virtual Machines - domUs ==
== Create Virtual Machines - domUs ==
-
At this stage I used to manually setup lvm volumes and manually debootstrap the VM. I'd then copy across resolv.conf, fstab, sources.lst as well as /lib/modules/2.6... etc. However with Etch and Lenny there was additional hassle tweaking inittab and the config to get the xm console to work properly.
+
At this stage I used to manually setup lvm volumes and manually debootstrap the VM. See [[Create_DomU#LVM_Based_Setup_of_Virtual_Disk]] and [[Basic_Setup_of_Xen3.2_32bit#Create_DomU]] I'd then copy across resolv.conf, fstab, sources.lst as well as /lib/modules/2.6... etc. However with Etch and Lenny there was additional hassle tweaking inittab and the config to get the xm console to work properly.
With Debian Squeeze, I followed Debians advise on their wiki and started using Xen-Tools. It automates a lot and makes things much easier.
With Debian Squeeze, I followed Debians advise on their wiki and started using Xen-Tools. It automates a lot and makes things much easier.
Line 51: Line 51:
  apt-get install xen-tools
  apt-get install xen-tools
  vi /etc/xen-tools/xen-tools.conf
  vi /etc/xen-tools/xen-tools.conf
-
 
+
#Below are all the uncommented lines I used:
-
 
+
lvm = vg1
-
 
+
install-method = debootstrap
-
lvm = vg1
+
size  = 20Gb
-
install-method = debootstrap
+
memory = 512Mb
-
size  = 20Gb
+
swap  = 1Gb
-
memory = 512Mb
+
fs    = ext3
-
swap  = 1Gb
+
dist  = `xt-guess-suite-and-mirror --suite`
-
fs    = ext3
+
image  = sparse
-
dist  = `xt-guess-suite-and-mirror --suite`
+
gateway    = 10.10.9.126
-
image  = sparse
+
netmask    = 255.255.255.192
-
gateway    = 193.1.99.126
+
bridge=xenbr1
-
netmask    = 255.255.255.192
+
passwd = 1
-
bridge=xenbr1
+
kernel = /boot/vmlinuz-`uname -r`
-
passwd = 1
+
initrd = /boot/initrd.img-`uname -r`
-
kernel = /boot/vmlinuz-`uname -r`
+
arch = amd64
-
initrd = /boot/initrd.img-`uname -r`
+
mirror = `xt-guess-suite-and-mirror --mirror`
-
arch = amd64
+
ext3_options    = noatime,nodiratime,errors=remount-ro
-
mirror = `xt-guess-suite-and-mirror --mirror`
+
ext2_options    = noatime,nodiratime,errors=remount-ro
-
ext3_options    = noatime,nodiratime,errors=remount-ro
+
xfs_options      = defaults
-
ext2_options    = noatime,nodiratime,errors=remount-ro
+
reiserfs_options = defaults
-
xfs_options      = defaults
+
btrfs_options    = defaults
-
reiserfs_options = defaults
+
pygrub = 1
-
btrfs_options    = defaults
+
-
pygrub = 1
+
http://old-list-archives.xen.org/archives/html/xen-users/2010-04/msg00518.html
http://old-list-archives.xen.org/archives/html/xen-users/2010-04/msg00518.html
http://prefetch.net/blog/index.php/2009/04/23/best-io-scheduler-to-use-with-virtualized-linux-hosts/
http://prefetch.net/blog/index.php/2009/04/23/best-io-scheduler-to-use-with-virtualized-linux-hosts/

Revision as of 00:44, 17 December 2011

Most of the details on this page are from Debians much improved wiki page at http://wiki.debian.org/Xen

Contents

Installation of Xen on Debian Squeeze

aptitude -P install xen-linux-system
//At this point I prematurely rebooted and went
//xm list
//WARNING!  Can't find hypervisor information in sysfs!
//Error: Unable to connect to xend: No such file or directory. Is xend running?
//don't reboot. Follow the below:

mv /etc/grub.d/10_linux /etc/grub.d/21_linux

Additional Tweaks to make dom0 more stable

Limit RAM available to dom0

vi /etc/default/grub
#add the following
# Disable OS prober to prevent virtual machines on logical volumes from appearing in the boot menu.
GRUB_DISABLE_OS_PROBER=true
#limit dom0 to 512MB RAM
GRUB_CMDLINE_XEN="dom0_mem=512M"

update-grub

Disable auto save and restore of domUs on host reboot

Apparently in Debians wiki, they say that saving the state of domU's on powerdown doesn't always work. Hence, disable the xen save and restore.

vi /etc/default/xendomains
XENDOMAINS_RESTORE=false
XENDOMAINS_SAVE=""

Bridge Networking and disabling Memory Ballooning

vi /etc/xen/xend-config.sxp
#(vif-script vif-bridge)
(network-script 'network-bridge antispoof=yes')
#(enable-dom0-ballooning yes)
(enable-dom0-ballooning no)

Reboot dom0 and bring up Xen

reboot
xm list
//outputs:
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0 15630    12     r-----     10.2

Create Virtual Machines - domUs

At this stage I used to manually setup lvm volumes and manually debootstrap the VM. See Create_DomU#LVM_Based_Setup_of_Virtual_Disk and Basic_Setup_of_Xen3.2_32bit#Create_DomU I'd then copy across resolv.conf, fstab, sources.lst as well as /lib/modules/2.6... etc. However with Etch and Lenny there was additional hassle tweaking inittab and the config to get the xm console to work properly.

With Debian Squeeze, I followed Debians advise on their wiki and started using Xen-Tools. It automates a lot and makes things much easier.

Using Xen-Tools to create VMs

apt-get install xen-tools
vi /etc/xen-tools/xen-tools.conf
#Below are all the uncommented lines I used:
lvm = vg1
install-method = debootstrap
size   = 20Gb
memory = 512Mb
swap   = 1Gb
fs     = ext3
dist   = `xt-guess-suite-and-mirror --suite`
image  = sparse
gateway    = 10.10.9.126
netmask    = 255.255.255.192
bridge=xenbr1
passwd = 1
kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r`
arch = amd64
mirror = `xt-guess-suite-and-mirror --mirror`
ext3_options     = noatime,nodiratime,errors=remount-ro
ext2_options     = noatime,nodiratime,errors=remount-ro
xfs_options      = defaults
reiserfs_options = defaults
btrfs_options    = defaults
pygrub = 1


http://old-list-archives.xen.org/archives/html/xen-users/2010-04/msg00518.html http://prefetch.net/blog/index.php/2009/04/23/best-io-scheduler-to-use-with-virtualized-linux-hosts/

Personal tools