Creating guests using xl in Xen

This post is about creating guests after Xen is installed. There are several ways to do that. But after using them this is the one that I preferred i.e. creating guest manually using xl. If you want a fancy GUI then one can use virt-manager but that going to create a mess if you installed Xen from source. So if you are installing Xen using source code then this is worth a try. πŸ™‚ My mentors suggested and helped me to try it and I can say its pretty amazing and simple. So the following steps create a guest ubuntu-guest. The following steps create an disk image for the guest ubuntu-guest4.

sudo mkdir -p /var/lib/xen/images
sudo dd if=/dev/zero of=/var/lib/xen/images/ubuntu-guest4.img bs=1M seek=15096 count=0
sudo mkfs.ext4 -F /var/lib/xen/images/ubuntu-guest4.img (optional if using iso for installation)

Then create file /etc/xen/ubuntu-hvm4.cfg for configuration details of guest. Mine looks like the below.

In line stating the disk home/uma/Desktop/OS/ubuntu-12.04-desktop-amd64.iso should be replaced by the address of your iso file.

blog

xl create /etc/xen/ubuntu-hvm4.cfg

(This will open your guest console :D)

After installing OS you can shutdown the guest and change the disk line in /etc/xen/ubuntu-hvm4.cfg to

disk = [‘phy:/var/lib/xen/images/ubuntu-guest4.img,hda,w’]

And start using your guest. πŸ˜€

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s