From Hack Sphere Labs Wiki
Jump to: navigation, search

Importing xva Images

xe vm-import -h <host ip> -pw <yourpass> filename=./Ubuntu-9.1032bitPV.xva sr-uuid=<your SR UUID>

SATA Direct Local Disk Access

If/when Xen updates it will overwrite this file, you will have to add the lines again.

nano -w /etc/udev/rules.d/50-udev.rules

Add to the end

ACTION=="add", KERNEL=="sdb", SYMLINK+="xapi/block/%k", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"
ACTION=="remove", KERNEL=="sdb", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"

Reboot Xen Server...

ethtool network stuff

Snapshots and Cloaning


xe vm-snapshot vm=name new-name=label=name2 new-name-description=Testing
xe vm-list
xe snapshot-list snapshot-of=


Can only copy when VM is shutdown. Other solution, if I remember is to snapshot, and then copy or something.

xe vm-copy vm="ABCServer" sr-uuid=24565487-accf-55ed-54da54993ade784a new-name-label="Copy of ABCServer" new-name-description="New Description"

Export live running VM: http://www.xenlens.com/export-a-live-running-vm-guest-from-xenserver-host/


xe sr-create

  • type - type of the SR, used to specify the SR backend driver to use
    • SR - storage repository


xe sr-probe


Creating Local ISO Repo - LVM

lvcreate -L 50G -n ISORepo VG_XenStorage-d2e116af-c45b-e6ba-5965-abc7e85c88c7
mkfs.ext3 /dev/VG_XenStorage-d2e116af-c45b-e6ba-5965-abc7e85c88c7/ISORepo
mkdir /mnt/ISORepo


/dev/VG_XenStorage-d2e116af-c45b-e6ba-5965-abc7e85c88c7/ISORepo /mnt/ISORepo ext3 defaults 0 1

Mount it then:

xe sr-create name-label=ISORepo type=iso device-config:legacy_mode=true device-config:location=/mnt/ISORepo content-type=iso
uuidoutput:  93a71420-d899-58e7-bce4-26d9cd4f6e46

This is supposed to refresh the repo, but with legacy mode it is supposed to do that itself:

xe sr-scan uuid=93a71420-d899-58e7-bce4-26d9cd4f6e46

Additional LVMs do not activate on boot!!! Do this:

nano /etc/rc.sysinit


#if [ -x /sbin/lvm.static ]; then
# action $"Setting up Logical Volume Management:" /sbin/lvm.static vgchange -a y --ignorelockingfailure


Activate LVM on Boot on XenServer

To activate on boot we need to make small modification to file /etc/rc.sysinit around line 487 to 489. Take a look into these lines:

#if [ -x /sbin/lvm.static ]; then
# action $"Setting up Logical Volume Management:" /sbin/lvm.static vgchange -a y --ignorelockingfailure

That's the problem, the lines which activate the LVM volume is commented. That's why we ended up with the problem. Now just uncomment those lines and save the file. But make sure you made a copy of it. Reboot the server and all LVM volumes should be detected on boot. Here's an example of my XenServer custom partition scheme:

LABEL=root-mterkkri    /         ext3     defaults   1  1
#/var/swap/swap.001          swap      swap   defaults   0  0
none        /dev/pts  devpts defaults   0  0
none        /dev/shm  tmpfs  defaults   0  0
none        /proc     proc   defaults   0  0
none        /sys      sysfs  defaults   0  0
/opt/xensource/packages/iso/XenCenter.iso   /var/xen/xc-install   iso9660   loop,ro   0  0
/dev/mapper/VG--XEN01-Dom0--TMP /tmp ext2 defaults,noexec,nosuid,nodev 1 2
/dev/mapper/VG--XEN01-Dom0--SWAP swap swap defaults 0 0
/tmp /var/tmp   none rw,noexec,nosuid,nodev,bind 1 2

Applying Official Patches

wget http://downloadns.citrix.com.edgesuite.net/10340/XS65ESP1.zip
unzip XS65ESP1.zip
xe patch-upload -s -u root -pw eliteelite file-name=XS65ESP1.xsupdate


xe patch-upload file-name=XS65ESP1.xsupdate

Outputs UUID

xe -s -u root -pw eliteelite patch-pool-apply uuid=7f2e4a3a-4098-4a71-84ff-b0ba919723c7


xe host-list
xe patch-apply uuid=7f2e4a3a-4098-4a71-84ff-b0ba919723c7 host-uuid=94a5ec24-cfa9-4592-bf73-7ed04a215bc6

List Patches

xe patch-list [1]



PCI Passthrough

Knowing if pciback support is active: http://wiki.xenproject.org/wiki/Xen_Kernel_Feature_Matrix#pvops

Only Temp?

03:00.0 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
03:00.1 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
04:00.0 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)
04:00.1 Ethernet controller: Intel Corporation 82571EB Gigabit Ethernet Controller (rev 06)

xl pci-assignable-add 03:00.0
xl pci-assignable-add 03:00.1
xl pci-assignable-add 04:00.0
xl pci-assignable-add 04:00.1

xl pci-assignable-list

Kernel Line

nano -w /boot/extlinux.conf

Add (Old Way):


Add (New Way):

  • I just tried the old way on 6.5SP1 xenserver and it is working

Add it to a domU:

  • For more then one:
xe vm-param-set other-config:pci=0/0000:03:00.0,0/0000:03:00.1,0/0000:04:00.0,0/0000:04:00.1 uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
  • For one:
xe vm-param-set other-config:pci=0/0000:03:00.1 uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
xe vm-param-list uuid=46bca2ec-2756-73cd-de4c-e60068a95a84

Error("38: Function not implemented")

You most likley do not IOMMU or have it disabled in the BIOS.

Changing domU Memory

xl mem-set #Not going to use
xe vm-list
xe vm-list params=all uuid=46bca2ec-2756-73cd-de4c-e60068a95a84


            memory-static-max ( RW): 268435456
           memory-dynamic-max ( RW): 268435456
           memory-dynamic-min ( RW): 268435456
            memory-static-min ( RW): 134217728

Set it: (try KiB, MiB, GiB or TiB)

xe vm-param-set memory-static-max=4GiB uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
xe vm-param-set memory-dynamic-max=4GiB uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
xe vm-param-set memory-dynamic-min=4GiB uuid=46bca2ec-2756-73cd-de4c-e60068a95a84
xe vm-param-set memory-static-min=4GiB uuid=46bca2ec-2756-73cd-de4c-e60068a95a84

What does vm-memory-limits-set do?


xe network-list
xe network-destroy

xe pif-list
xe pif-forget


  • Get notifications about new updates

Adding an additional hard drive to XenServer

fdisk -l
xe sr-create name-label=2TBNoRaid shared=false device-config:device=/dev/sdb type=lvm

Adding a existing network to a VM

xe vm-list
xe network-list
xe vif-create network-uuid=<networkuuid> vm-uuid=<vmuuid> device=2
  1. http://mytechmemoirs.com/2012/03/11/update-or-patch-a-xenserver-host/