====== Citrix XenServer ======
respawn
exec /sbin/getty -8 38400 hvc0
~# initctl reload tty1
====== Change a VM from HVM fully-emulated to PV ======
Fully emulated is crashy and slow, you want to run in xen-aware mode for optimal performance.
You must have a xen-aware kernel installed (-xen or -server) and have changed your ''/etc/fstab'' to use UUID's instead of /dev/hda?.
~# xe vm-list name-label=testVM
uuid ( RO) : b17d71d2-d2ef-f62c-3050-5a8324bb9f5d
name-label ( RW): testVM
power-state ( RO): running
~# xe vbd-list vm-name-label=testVM empty=false
uuid ( RO) : 623f7c34-56b1-9f27-9bf3-8d6b38b58801
vm-uuid ( RO): b17d71d2-d2ef-f62c-3050-5a8324bb9f5d
vm-name-label ( RO): testVM
vdi-uuid ( RO): 49cbed56-d870-4654-aef5-f8ba7ea19d52
empty ( RO): false
device ( RO): hda
~# xe vbd-param-list uuid=623f7c34-56b1-9f27-9bf3-8d6b38b58801 param-name=bootable
false
~# xe vbd-param-set uuid=623f7c34-56b1-9f27-9bf3-8d6b38b58801 bootable=true
~# xe vm-param-clear uuid=b17d71d2-d2ef-f62c-3050-5a8324bb9f5d param-name=HVM-boot-policy
~# xe vm-param-set uuid=b17d71d2-d2ef-f62c-3050-5a8324bb9f5d PV-bootloader=pygrub
====== Find the VNC port ======
# xenstore-ls /local/domain/$(xe vm-param-get uuid=$(xe vm-list name-label=vm02 --minimal) param-name=dom-id)/serial
vnc-port = "5902"
The VNC port is localhost:5902
~> ssh -L5900:localhost:5902 root@xenserver
====== Connect to the text console ======
Connect to the domU console via SSH.
/usr/lib/xen/bin/xenconsole $(xe vm-param-get uuid=$(xe vm-list name-label=vm02 --minimal) param-name=dom-id --minimal)
====== Auto start on host boot ======
xe vm-param-set uuid=e5dccf45-313f-e7df-d897-15c41ee3e802 other-config:auto_poweron=true
====== Backup/Restore ======
[/nfs is an NFS share created on a remote NFS server]
[root@xenserver ~]# xe host-backup file-name=/nfs/xenserver-20100828
[root@xenserver ~]# xe host-restore file-name=/nfs/xenserver-20100828
[root@xenserver ~]# xe vm-export filename=/nfs/xenserver-metadata --multiple metadata=true
[root@xenserver nfs]# xe-backup-metadata -h
Usage: /opt/xensource/bin/xe-backup-metadata [-h] [-i] [-u <SR UUID>]
-h: Display this help message
-c: Create a backup VDI if one cannot be found (default: false)
-i: Initialize the backup VDI before performing the backup
-u: UUID of the SR you wish to backup to
-d: Dont perform a backup, but leave the disk mounted in a shell
-k: Number of older backups to preserve (default: 25)
-n: Just try to find a backup VDI and stop the script after that
-v: Verbose output
Use the -d option to examine the backup VDI, and restore it if necessary.
It is a good idea to copy the backup onto the control domain before
restoring it via the xe pool-database-restore CLI command.
[root@xenserver nfs]# xe-backup-metadata -v -c
Using SR: Local Storage
Creating new backup VDI: f8c4577e-4db5-4ddb-a1ee-5c8c975f4f57
done
Rotating old backups: found 0
Backing up pool database: done
Cleaning old VM metadata: done
Backing up SR metadata: done
Backing up VM metadata: done
Backing up Template metadata: done
[root@xenserver nfs]# xe-backup-metadata -v
Using SR: Local Storage
Rotating old backups: found 1
Backing up pool database: done
Cleaning old VM metadata: done
Backing up SR metadata: done
Backing up VM metadata: done
Backing up Template metadata: done
[root@xenserver ~]# xe sr-list name-label=Local\ Storage --minimal
6b559c73-65e6-3475-e49b-78e880f869cd
[root@xenserver ~]# /opt/xensource/bin/xe-backup-metadata -v -u 6b559c73-65e6-3475-e49b-78e880f869cd
Using SR: Local Storage
Rotating old backups: found 3
Backing up pool database: done
Cleaning old VM metadata: done
Backing up SR metadata: done
Backing up VM metadata: done
Backing up Template metadata: done
[root@xenserver ~]# crontab -l
@daily /opt/xensource/bin/xe-backup-metadata -v -u 6b559c73-65e6-3475-e49b-78e880f869cd
(Does not work with the new VHD format).