Virtualization/XEN/Sample domain files

From EasyWebDNS
Jump to: navigation, search

Sample Xen Domain Files

The following files are XEN 3.2 config files (.CFG), one will run Windows Vista, The other runs a new linux Kernel, the differences are very few, but beware that a mounted CD will not boot the system, To boot the system you will need to put it on a loop.

Also, here is how to create a virtual hard disk file (You can use LVM or a partition), but if you want to use a virtual hard disk file, this is how we do it.

Assuming you want to put the .img file (A XEN Virtual Hard Drive) in the directory /HD2, and name it vhdd.img

dd if=/dev/zero of=/pathtoimage.img bs=1M count=10000

The above will result in a 10 GB Virtual Hard disk file for your XEN domain

To boot from an iso file, we create a loopback device from the iso file (No copeying, you can think of it as a pointer)


1- We find out what the next vacant loopback device is, the following will print something like /dev/loop1 take note of it

$ losetup -f

2- The actual trick, make sure you replace the path with your actual ISO

$ losetup -f /hd2/winxpsp2.iso

3- change the number in front of loop with the one you got in step 1 to see if it is pointing to has your CD / DVD will display something like /dev/loop1: [0811]:24577 (/hd2/winxpsp2.iso)

$ losetup /dev/loop1

Windows Vista xen config file
    
# Configuration file for the Xen instance atest, created
# by xen-tools 3.8 on Mon May 19 02:15:05 2008.
#

#
# Kernel + memory size
#
#kernel = '/boot/vmlinuz-2.6.24-17-xen'
#ramdisk = '/boot/initrd.img-2.6.24-17-xen'
builder = "hvm"
memory = '1024'
#
# Hostname
#
name = "atest"
vcpus=4
#cpus = "0,1,2,3"
pae=0
acpi=1#1 for windows vista....
apic=1 #If it works on your guest, keep it
#apic is One of the best known APIC architectures by intel, provides much more complex priority schemas than 8259A
#
# Networking
#
dhcp = "dhcp"
#vif = [ 'mac=00:16:3E:5F:C3:25' ]
vif = ['bridge=xenbr0']
#vif = ['ip = "10.0.11.13", bridge=xenbr0']

#vif = [ 'ip=192.168.0.132,mac=00:16:3E:5F:C3:25' ] if you want a static IP, this is the way to go

#
# Disk device(s).
#
root = '/dev/xvda2 ro'
disk = [

'tap:aio:/hd2/testmatch.img,hda,w',
'tap:aio:/hd2/TAFEELEH_V2.iso,hdc:cdrom,r'
#'phy:/dev/loop0,hdc:cdrom,r'

#To mount a CD and not boot from it
# normally, we would say 'tap:aio:/hd2/Fedora-9-x86_64-DVD.iso,hdc:cdrom,r' to load a cd rom into IDE-2 master



# : will display something like /dev/loop1: [0811]:24577 (/hd2/winxpsp2.iso)
#and now you can use 'phy:/dev/loop0,hdc:cdrom,r' as cd, remember to set boot="dc" on the next line if you want to boot from hdc (Our CD)
]
boot="dc"
#
# Behaviour
#
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'
#device_model = "/usr/lib/xen/bin/qemu-dm"
#cdrom='/hd2/TAFEELEH_V2.iso' this is old thing, these days it is merged with disks
#boot='d' Also obsolete
sdl=1
#vnc=1
#vncviewer=0
stdvga=0#this means, use the cirrus VGA not the old VGA
#serial="pty"
#ne2000=0


#i commented this coz i added above
extra = '2 console=xvc0'

    
    
Linux xen config file
#
# Kernel + memory size
#
#kernel = '/boot/vmlinuz-2.6.24-17-xen'
#ramdisk = '/boot/initrd.img-2.6.24-17-xen'
#kernel = 'vmlinuz-2.6.24-16-generic'

####################################################################################
#Virtualization
####################################################################################
builder = "hvm"                                    #(Slower) this one is when 
                                                   #you want full virtualization for 
                                                   #something like Windows
####################################################################################
#Memory
####################################################################################
memory = '1024'
####################################################################################
# Hostname
####################################################################################
name = "ubtest"
####################################################################################
#Processor/Chipset features
####################################################################################
vcpus=4                                            #Number of processors to use
#cpus = "0,1,2,3"                                  #What processors
pae=1                                              #the PAE in processor is requiered 
                                                   #by new linux kernels....
acpi=0                                             #1 required for windows vista....
apic=1                                             #If it works on your guest, keep it
                                                   #apic is One of the best known APIC
                                                   #architectures (by intel), provides 
                                                   #much more complex priority schemas
####################################################################################
# Networking
####################################################################################
#vif = [ 'ip=192.168.0.132,mac=00:16:3E:5F:C0:25' ]
vif = ['bridge=xenbr0']    #if in only dhcp mode
#vif = ['ip = "10.0.11.13", bridge=xenbr0']

####################################################################################
# Disk device(s).
####################################################################################

root = '/dev/xvda2 ro'           #found it somewhere, and forgot what it is for
                                 #most probably for para virt guests
disk = [
         'tap:aio:/hd2/ubdns5.img,hda,w',
         #'tap:aio:/hd2/TAFEELEH_V2.iso,hdc:cdrom,r'
         'phy:/dev/loop1,hdc:cdrom,r'
#To mount a CD and not boot from it
# normally, we would say 'tap:aio:/hd2/Fedora-9-x86_64-DVD.iso,hdc:cdrom,r' to load a cd rom into IDE-2 master
#to mount a CD for booting
#when we want to boot from from CDROM / DVD drive, we have to create a loopback device from the ISO file
# losetup -f : will tell us what loop device is free EX /dev/loop1
# losetup -f /hd2/winxpsp2.iso : The actual trick
# losetup /dev/loop1 : will display something like /dev/loop1: [0811]:24577 (/hd2/winxpsp2.iso)
#and now you can use 'phy:/dev/loop1,hdc:cdrom,r' as cd, remember to set boot="dc" on the next line if you want to boot from hdc (Our CD)
]
boot="dc"
#
# Behaviour
#
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'
#device_model = "/usr/lib/xen/bin/qemu-dm"
#cdrom='/hd2/TAFEELEH_V2.iso' this is old shit, these days it is merged with disks
#boot='d' but how do we boot from CD now ?
sdl=1
#vnc=1
#vncviewer=0
stdvga=0#this means, use the cirrus VGA not the old VGA
#serial="pty"
#ne2000=0


#i commented this coz i added above
extra = '2 console=xvc0'
    
    
Domain Search:
.COM$ 8.49
.NET$ 6.49
.ORG$ 7.49
.INFO$ 1.99
Compare Pricing
Cheap Domains
Personal tools