When installing a Xen virtual machine, you need to determine what kind of block devices you want to work with. There are three possibilities: installing directly on a dedicated partition (maximum performance) or by using an important disk image file or create your own disk image file with dd (resizable; You can use snapshots for making backups)
All commands assume root (ie. sudo su). I also assume using LVM but have also included an untested method where you use dd to use your own image. So skip 1 if you want to use a file (and not LVM) and skip 2 if you do use LVM.
Create a new LVM volume for your virtual machine. Change the name (after -n) to suit your needs:
lvcreate is part of lvm2 but it is already installed when you are using lvms.
You can also use a file (dd). I have not found a suitable method for this with Ubuntu but this should come close. If you go with this I have experience with it but all the next steps should be the same. Copied from the link the method to create one using dd (the link also includes other methods of getting a file):
Create a 4Gb empty file with at /var/lib/xen/images/disk1 (change either size and location to fit your needs):
Apart from creating empty image files using the dd utility, you can also use ISO files as an alternative for your physical optical drives. The usage is the same as the usage of a disk image file created with dd. Don't have an ISO file yet? Then we have good news for you; it's easy to create one. If the cd-rom of which you want to create an ISO file is in your optical drive, use the following to copy it to a file with the name cdrom.iso:
dd if=/dev/cdrom of=/isos/cdrom.iso
After creating either a disk image file or an ISO file, you need to include the disk image file in your virtual machine configuration using the file option in the disk definition:
Get the kernel, initrd, and xen config. wget versions for nl and installer-amd64 (so change the country code nl and also use installer-amd64 in the URL to fit your needs):
Edit the config file to taste, paying attention to the memory, name, vcpus, vif, and disk options. Also, find the line that says bootloader=pygrub and change it to the absolute path bootloader=/usr/sbin/pygrub.
Start the install (again pay attention to the command: change server country code and architecture to your needs):
configure your network card. If it fails you will need to configure it manually (choose back, drop to a shell and issue a modprobe xen-netfront && exit. Configure the network card again.
select detect network hardware and insert a hostname
and it starts installing.
Fix the install.
The xen-blkfront module isn’t loaded at first so xen will fail to boot.
Paravirtualized guest and Ubuntu 11.04
When installing a Xen virtual machine, you need to determine what kind of block devices you want to work with. There are three possibilities: installing directly on a dedicated partition (maximum performance) or by using an important disk image file or create your own disk image file with dd (resizable; You can use snapshots for making backups)
All commands assume
root
(ie.sudo su
). I also assume using LVM but have also included an untested method where you usedd
to use your own image. So skip 1 if you want to use a file (and not LVM) and skip 2 if you do use LVM.Create a new LVM volume for your virtual machine. Change the name (after
-n
) to suit your needs:lvcreate
is part of lvm2 but it is already installed when you are using lvms.You can also use a file (
dd
). I have not found a suitable method for this with Ubuntu but this should come close. If you go with this I have experience with it but all the next steps should be the same. Copied from the link the method to create one usingdd
(the link also includes other methods of getting a file):Create a 4Gb empty file with at
/var/lib/xen/images/disk1
(change either size and location to fit your needs):Apart from creating empty image files using the dd utility, you can also use ISO files as an alternative for your physical optical drives. The usage is the same as the usage of a disk image file created with dd. Don't have an ISO file yet? Then we have good news for you; it's easy to create one. If the cd-rom of which you want to create an ISO file is in your optical drive, use the following to copy it to a file with the name cdrom.iso:
After creating either a disk image file or an ISO file, you need to include the disk image file in your virtual machine configuration using the file option in the disk definition:
Get the
kernel
,initrd
, andxen config
.wget
versions fornl
andinstaller-amd64
(so change the country codenl
and also useinstaller-amd64
in the URL to fit your needs):Edit the config file
Edit the config file to taste, paying attention to the memory, name, vcpus, vif, and disk options. Also, find the line that says
bootloader=pygrub
and change it to the absolute pathbootloader=/usr/sbin/pygrub
.Start the install (again pay attention to the command: change server country code and architecture to your needs):
back
, drop to ashell
and issue amodprobe xen-netfront && exit
. Configure the network card again.and it starts installing.
Fix the install.
The
xen-blkfront
module isn’t loaded at first soxen
will fail to boot.Once the host finishes booting, log in and sudo to root. Then enter the following:
Untested and from memory + googling to fix my memory