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: dd, disk, dom0, domu, killall, lvm, xen, xm
Setting up an LVM filesystem is quite easy assuming you have the right tools installed and a recent kernel. LVM has a lot of advantages, most notably the ability to take snapshots of the current filesystem – this is why LVM is often used in live database environments.
Assuming a Debian Lenny machine, get the relevant packages. Some may already be installed: apt-get install lvm2 dmsetup mdadm
In this example, we will assuming that /dev/sda is your boot drive, and that you want to leave it out of your LVM array, but include /dev/sdb and /dev/sdc. Both /dev/sdb and /dev/sdc should be of equal sizes.
Firstly, using fdisk, remove any existing partitions with ‘d’, on /dev/sdb and /dev/sdc, and create one new partition to span the drive. Change the partition type to ‘8e’ which is the LVM type.
Now prepare your physical disk for LVM with the ‘pvcreate’ tool:
pvcreate /dev/sdb1 /dev/sdc1
Note that you can reverse this with pvremove. You can also use pvdisplay now to display information on all physical volumes.
Oh – you do realie that you can use /dev/mdX just as easily to create LVM on your RAID devices?
Now, we need to create a ‘volume group’: vgcreate myvg /dev/sdb1 /dev/sdc1
Tags: dd, ext3, kernel, Linux, lvcreate, lvdisplay, lvm, lvremove, mkfs, mount, pvcreate, pvdisplay, pvremove, resize, tar, vgcreate, vgdisplay, vgremove, xen
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:
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: apt-get, debian, lenny, Linux, uname, xen, xm
I’m going to write 3 articles next, the first on installing Xen on a Debian Lenny host (Dom0) with Debian Lenny guests (DomU) on a regular loopback filesystem. Next I’m going to write about setting up LVM and some basic working examples, and then finally how to move your Xen over to LVM once you realise that you don’t want loopback. This is the same order in which I performed my installation, and covers Xen setup, LVM setup and migration from loopback to LVM which is a valid upgrade path. My Xen installation is entirely automated. Watch this space..
Tags: debian, lenny, Linux, lvm, xen
I’d guess that 90% of hosting providers ‘oversell’. This essentially means that should they have 1,000GB allocated, they might offer 15 packages of 100Gb to 15 of their customers, banking on the fact that no one will fully use their 100GB allocation – Selling 5 Virtual Machines with 256MB RAM on a 1GB host, assuming that no one will use their full RAM allocation. This is bad, because you’ll generally be able to confirm that you’ve been allocated the resources, but nonetheless benchmark tests will show that you’re just not getting them, and your environment will be sluggish and unresponsive. This is the same as airlines selling 110 seats on a 100 seat plane. When that 101st paying customer does show up to claim his seat, he’s stuck without a flight.
The general consensus is that a VPS is a cheaper and lower-grade option than a dedicated service, however VPSs have a number of undisputable advantages over dedicated servers and I’m going to discuss why almost all the dedicated machines I manage are hosts for a range of VPSs.
(more…)
Tags: 10mbit, adamsinfo.com, advantages, allocation, apache2, backup service, benchmark, bind, cheap, client, co-locate, colocate, config, CPU, datacenter, debian, dedicated, dedicated servers, disk access, disk IO, endpoint, environment, exim, host, Hosting, hosting providers, Intel, kernel, kernel upgrade, mailserver, mppc, mppe, MySQL, named, noc, oversell, packages, php5, pptp, processor type, Quad Core, racks, reboot, remote services, routing, seek time, spamassassin, system administrator, tick speed, virtualization, vmware, vmware free server, vmware gsx, VPN, vps, xen, Xeon