Converting open-source Xen Windows VMs to XenServer

Posted by Christian Ashby on April 13, 2010

A number of people are looking to migrate from the open-source Xen to Citrix XenServer itself, and it’s not immediately obvious how to migrate Windows VMs between the two platforms. Citrix have a tool called ‘XenConvert’ designed to move machines between environments, and the way you can use this to move from open-source Xen is as follows:

  • Download XenConvert from the Citrix downloads centre.
  • Add a virtual disk to the guest machine (at least twice the size of the existing disk) to receive the exported VM.
  • Run the original guest machine and partition / format the new virtual disk (NTFS / FAT, as long as you can mount these filesystems in the host).
  • Install & Run XenConvert on the source guest machine.
  • Select ‘XVA’ and select the new virtual disk as the destination for the XVA image.
  • Shut down the source guest machine.
  • Work out where the new virtual partition starts – something like this:
    root@host:/etc/xen# parted /dev/host-vm/name-XVA
    GNU Parted 1.7.1
    Using /dev/mapper/host--vm-name--XVA
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) unit B
    (parted) print
    Disk /dev/mapper/host--vm-name--XVA: 26843545599B
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Number  Start   End           Size          Type     File system  Flags
    1      32256B  26839088639B  26839056384B  primary  ntfs
  • Mount the new virtual disk – change ‘offset’ to be the value in the Start column above, replace ntfs with vfat if FAT32 was used:
    mount -o ro,offset=32256 -t ntfs /dev/host-vm/name-XVA /mnt/t
  • Copy the *.xva folder from this mounted drive to somewhere accessible to the new XenServer host.
  • Run XenCenter on a machine and connect to the new host.
  • Import a new VM, select the ova.xml file from the *.xva folder, and follow the import – you’ll need to setup a new Network Interface.
  • If required, reactivate Windows on the new guest as it starts up, and install XenServer Tools.


Oracle XE: Clearing out unwanted trace files

Posted by Christian Ashby on April 9, 2010

If left unchecked, Oracle XE installations can balloon in size quite quickly – this is due to the trace files being written by the server. The following run in a cron script can be used to remove files more than 7 days old.

find $ORACLE_HOME/../../../admin/$ORACLE_SID/bdump -name "*.trc" -mtime +7 -exec rm "{}" \;
find $ORACLE_HOME/../../../admin/$ORACLE_SID/udump -name "*.trc" -mtime +7 -exec rm "{}" \;
find $ORACLE_HOME/../../../admin/$ORACLE_SID/cdump -name "*.trc" -mtime +7 -exec rm "{}" \;

This tip was found and modified for XE in the following a useful article ‘Oracle Linux – Using the “find” command to manage files’.


Linux: Getting SMART status from 3ware cards

Posted by Christian Ashby on March 9, 2010

3ware RAID cards are a very robust hardware RAID solution which work under Linux.

If you use these cards though, the ’3dm2′ web interface and command line interface only give limited information about the health of the drive.

Fortunately the standard tool smartctl can access the drives as if they were directly connected to the system like this:

smartctl -d 3ware,X --all /dev/twa0

Where X is the index (0…n) of the drive you want to check.