Showing posts with label xen. Show all posts
Showing posts with label xen. Show all posts

Saturday, January 1, 2011

Beginning the new year with Xen

Being the geek that I am, I enter the new year working late with Xen and trying to build an HD file image using the qemu command and watching some early Season 5 episodes of Dexter.

I am just going to document some of my starting out with Xen.

To list all running domains
xm list

To install a new domU from location (online or local)
virt-install --prompt
qemu -hda /dev/domU -cdrom linuxDistro.iso -boot d

Location of domU configuration file on dom0
/etc/xen/nameOfDomU

Start the domU image
xm create -c [nameOfDomU or ID]

Move from domU to dom0
Press: Ctrl-] (control, minus, right bracket)

Connect from dom0 to a running domU
xm console [nameofDomU or ID]

Reboot and Shutdown
xm reboot nameOfDomU
xm shutdown nameOfDomU



The Book of Xen does not have instructions on how to install Xen on a pre-installed system, so the best and most recent guide of installing Xen on CentOS is this one:
Install Xen on CentOS (for 32 bit systems)
Install Xen on CentOS (for 64 bit systems)

They are very similar.

I did create a new CentOS VM to be used as Xen hypervisor. Here are a couple of things I had forgotten:
CentOS time servers are busted, and base install of CentOS doesn't install ntpd.

Initial Configuration
  • yum install ntp
  • Edit /etc/ntp.conf (change the servers to ones that work)
  • Edit /etc/sysconfig/ntpd (enable option to sync the hardware clock)
  • ntpdate pool.ntp.org
  • chkconfig ntpd on (add ntpd to run when system starts)
  • service ntpd start

Setting hostname on CentOS 5.5:

  • Edit /etc/sysconfig/network
  • Edit /etc/hosts

Monday, December 20, 2010

Adventures with Logical Volume Manager

While trying to create a separate partition for virtual machines, I realized that I did not change the default CentOS partition layout so it was using LVM. I was a little confused whether to simply just mount the /dev/sdb or work with LVM, so I logged on Freenode and someone told me I need to make it part of the volume group. (I later realized I could've [obviously] just mounted it.) Took me couple hours to read about and understand how LVM works.

I followed these guides, they're very similar:
TLDP LVM HOWTO
CentOS LVM Administration Guide

The guides are a little vague for a newcomer to LVM to I had a hard time, and I got stuck towards the end with how to mount the new space that I had made part of the volume group. I did not want to merge this space into / (root file system) where everything else is, and keep the /vm in a separate partition.

The virtual HDD I had added was now part of the volume group, and I could see it as /dev/VolGroup00/virtmacs (that's the name I gave it). Therefore, for simplicity's sake, I just did mkfs -t ext3 /dev/VolGroup00/virtmacs, and then added it to /etc/fstab and mounted it and took a sigh of relief.

For people who're adding a new hard drive and get confused by Logical Volume Manager, and don't want to deal with it for whatever reason (maybe you're just testing something and don't want to expand storage etc.), just mount as usual. You don't have to go through any special guides.