msgbartop
Adam Palmer MBCS CITP, Linux, PHP Programmer, MySQL Developer, Embedded Hardware, Security Consultant
Did my blog help you? Please link to me!
  dns test
 
RSS Feed
msgbarbottom

25 Oct 09 Move Xen Guest from loopback filesystem to LVM

Moving a Xen Guest into an LVM container from a loopback sparse image is easy enough.

You’ll need to power down the VM using xm shutdown mymachine

Once done, create the logical volume with: lvcreate –name mymachine-disk –size 10G myvg 10G should match the exact size (if not more) of your current VM. Now create the same for the swap file: lvcreate -name mymachine-swap -size 128M myvg. Now edit your machine’s config (/etc/xen/mymachine.cfg), replacing the disk part from:

disk        = [
'file:/xen/mymachine/mymachine-swap,sda1,w',
'file:/xen/mymachine/mymachine-disk,sda2,w',
]

to

disk        = [
'phy:/dev/myvg/mymachine-swap,sda1,w',
'phy:/dev/myvg/mymachine-disk,sda2,w',
]

And use dd to write the disk to your new LVM filesystem:

dd if=/xen/mymachine/mymachine-disk of=/dev/myvg/mymachine-disk
dd if=/xen/mymachine/mymachine-swap of=/dev/myvg/mymachine-swap

Remembering that you can use killall -SIGUSR1 dd at any time to gain a status update on dd’s IO.

Once done, power up your VM again with xm create mymachine.cfg

Tags: , , , , , , ,

18 Oct 09 Installing and Configuring Xen with guests

Installing and Configuring Xen on a Debian Lenny machine is pretty easy. Firstly, install the system:

apt-get install xen-tools xen-utils-3.2-1 xen-linux-system-2.6.26-2-xen-686

xen-linux-system-2.6.26-2-xen-686 comes with the Xen kernel that you’ll need. It should install a new kernel as the default, and therefore you’ll now need to reboot.

Once rebooted, issue uname -a to ensure that your new Xen kernel is running:

apnic01:~# uname -a
Linux apnic01 2.6.26-2-xen-686 #1 SMP Wed Aug 19 08:47:57 UTC 2009 i686 GNU/Linux

You now have Xen installed! Now, you’ll need to make a few changes. Firstly, none of my new guest VMs had working console, apparently this is a known issue in Lenny with Lenny guests. The work around is to change the inittab on the guest. I wanted to create guests without modifications, so in this case, I edited /etc/xen-tools/xen-tools.conf and uncommented:

#serial_device = hvc0 #default

It’s listed as the default, but uncommenting this seemed to solve my issues.

Now, you’re ready to create your first guest:
(more…)

Tags: , , , , , ,