Archive for the ‘Xen’ Category

How to view actual physical memory available on xen host

July 19, 2008

When I was new on xen I had this very problem, that I was not able to figure out what is the actual amount of physical ram on xen host i.e Dom0. So sharing this little tip here for newbies that might be starting.

use “xm top” command to find out the actual physical ram.

Hope this will be helpful for someone.

Technorati Tags: , ,

Advertisements

How You can create xen VM without installation

February 21, 2008
  1. Download the CentOS 5.1 image from jailtime. http://jailtime.org/download:centos:v5.1
  2. At the time of writing this howto the current image file name is: centos.5-1.20080125.img.tar.bz2

  3. Untar the image:
  4. # tar -xjf centos.5-1.20080125.img.tar.bz2

  5. Create directories under /mnt to mount image your downloaded from jailtime and in our case lvm parition.
  6. # mkdir /mnt/img
    # mkdir /mnt/vm

  7. Mount jailtime image and lvm partition image.
  8. # mount -o loop centos.5-1.img /mnt/img
    # mount /dev/vg/ComC /mnt/vm

  9. Copy the image files to our VM image i.e on lvm parition.
  10. # cp -a /mnt/img/* /mnt/vm/

  11. Configure IP for domU. I don’t think I need to explain this step.
  12. cat /mnt/vm/etc/sysconfig/network-scripts/ifcfg-eth0

    TYPE=Ethernet
    DEVICE=eth0
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=192.168.1.10
    NETMASK=255.255.255.0
    GATEWAY=192.168.1.254

  13. Configure domU hostname.
  14. [root@aag ~]# cat /mnt/vm/etc/sysconfig/network

    NETWORKING=yes
    HOSTNAME=complay

  15. For me the xm console never worked until I have used this line in /mnt/vm/etc/inittab, I hope you know where to put following line in /mnt/vm/etc/inittab, other wise learn about inittab first please.
  16. 1:2345:respawn:/sbin/mingetty console

  17. root logins are not allowed on default jailtime image, so if you need them you can enable them too, or if you change your SSH port to something unusual you can do that too in /mnt/vm/etc/ssh/sshd_config change following:
  18. Port 2023

    PermitRootLogin yes

  19. Unmount both images.
  20. # umount /mnt/img /mnt/vm

  21. Create initrd image for your domU
  22. # mkinitrd /boot/xen-guest-initrd `uname -r` --with xenblk --with xennet --preload xenblk --preload xennet

  23. Create a xen config file, as I was using LVM partition so my config file will look bit different.
  24. My domU config file looks like following:
    [root@aag xen]# cat complay.cfg

    kernel = “/boot/xen-vm-kernel”
    ramdisk = “/boot/xen-guest-initrd”
    name = “complay”
    memory = “128”
    disk = [ ‘phy:vg/ComC-swap,sda2,w’, ‘phy:vg/ComC,sda1,w’ ]
    vif = [ ‘mac=00:14:d1:3e:F9:f1’, ]
    root = “/dev/sda1 rw”
    vcpus=1
    on_reboot = ‘restart’
    on_crash = ‘destroy’

  25. Start your domU
  26. # xm create -c /etc/xen/complay.cfg

  27. You will see a nice login prompt like following:
  28. CentOS release 5 (Final)
    Kernel 2.6.18-8.1.14.el5xen on an i686

    complay login:

  29. Login as root, default root password for jailtime image is “password”
  30. Change your root password first 😉
  31. Enter nameservers in /etc/resolv.conf
  32. Now this small CentOS 5.1 image likes many usefult softwares, few of which I really like and need I will install here. If you don’t find your favourite software you know how to install it right?
  33. # yum -y install logwatch postfix vim-enhancd iptables anacron

  34. Now your VM is ready to be used.

Possible Errors

If you get following Error:

Error: destroyDevice() takes exactly 3 arguments (2 given)

Make sure you have unmounted your image: umount /mnt/vm