Xen 4 Ubuntu 10.04 Self Virtualization

After experimenting with XenServer at work wanted to delve in deeper.
Wanted to maintain existing md raids arrays, with out having to create images or lvm groups of existing storage, because I already had good speed and redundancy, raid 10 f2, around 100MBytes/s writes and 200Mbytes/s reads
So the course I took was to go with Xen 4, and use Debian 6 for Dom0
I already had full backups of my server setup and had several vbox vm’s running, first i converted my vbox hd’s to raw disk, google it
then I installed over / and /boot with debian 6, all my data is on different arrays
/music
/Virt
/dumps
I gave /Virt to dom0 for disk storage and went about getting everything setup.
Create several directories to make my life easier
/Virt/Disk
/Virt/Config
/Virt/Template
because its easier to spell out then /etc/xen and /var/……images/
I then just create symlinks of configs to /etc/xen and /etc/xen/auto
I originally couldn’t get libvirtd to work properly with debian 6 and xen 4, but found that doing it by hand worked alot better anyway.
To do the ubuntu restore I used a template to create a basic ubuntu setup like so
set up my options for xen-create-image (read the man)
xen-create-image –hostname whatever lucid (or whatever version your using)
Then I copied the image, this is the one I restore, then editied the config it generated by hand, set the parameters I wanted, I added the other too md array for
/music and /dumps
as well as the copy of the raw disk
so something like this
disk [
'file:the_one_from_the_script,xvda1,w',
'file:the_copy_to_restore_to,xvdb,w',
'phy:/dev/md2,xvdc,w',
'phy:/dev/md3,xvdd,w',
]

Then i booted it up, (note I also used pygrub so i wouldn’t have to pass an internal kernel)
I did a quick apt-get install dump
then mount /dumps
then mount /restoredestination
then cd into the restore destination, restored my full backup over top of the existing ubuntu install made sure not to restore /dev and /proc for somereason this method works, can’t get linux to do a raw restore with dump for some reason, works great on bsd though
Then I mount /dev bind and /proc in the restore destination, i chroot in and remove all the virtualbox stuff, then I install a virtual kernel think its something like
apt-get install linux-image-virtual
but a apt-cache search linux image virtual should give a better result going off memory here
also edited fstab, I use uuid cause its safer in my experience then trying to say xvda or sda1 or hda1 or what ever
ls -lh /dev/disk/by-uuid should fill you in
shutdown the vm, edited the disk portition of config and removed the first line making sure the main disk was on the first line
I also setup dynamic memory in the config.

I haven’t yet, but I’ll probably just do a file level swap, which is easy enough to do
could also just add it to config file, if you use the above it can automate this for you

some interesting benchmarks, the first one is an image on a raid 10 f2 configuration rated to around 200r/100w MB/sec, but the results are probably due to file caching
The other two are phycial md arrays, raid 10 rated to 100r/100w MB/sec

ron@server:~$ sudo hdparm -t /dev/xvda

/dev/xvda:
Timing buffered disk reads: 1088 MB in 3.00 seconds = 362.36 MB/sec
ron@server:~$ sudo hdparm -t /dev/xvdb

/dev/xvdb:
Timing buffered disk reads: 368 MB in 3.01 seconds = 122.41 MB/sec
ron@server:~$ sudo hdparm -t /dev/xvdc

/dev/xvdc:
Timing buffered disk reads: 336 MB in 3.02 seconds = 111.27 MB/sec

Leave a Reply

CAPTCHA Image