Citrix Xen Center Tutorials
Exporting and Importing Virtual Machines in Xen Center
Exporting A Virtual Machine :
xe vm-export -h hostname -u username -pw password vm=vmname filename=/destination.xva
Importing A Virtual Machine :
Importing a virtual machine is a little bit trickier than exporting because you have to specify which storage to use in order to import a virtual machine. In ordder to see the storages available, type the command below:
xe sr-list | more
Get the Sr-UUID from the output of above command for the storage where you want to put the virtual machine and then issue the following command to import.
xe vm-import -h 127.0.0.1 -u root -pw password filename=/source.xva sr-uuid=storage_uuid
Some Useful Commands :
Show storage type , name and uuid :
xe sr-list
Show if attached :
xe pbd-list
Shutdown server
xe vm-shutdown vm=servername
Attach a Local Storage to the xen server
Find the disk you want to attach
fdisk -l
Create the Physical Volume :
pvcreate /dev/sdb
( where /dev/sdb is the new volume)
Find the ID of the Disk you want to attach :
ll /dev/disk/by-id/
This will return the id of the Disk
Create the Storage :
xe sr-create type=lvm content-type=user device-config:device=/dev/disk/by-id/disk_id_returned_by_above_command name-label="Label for storage"
This will create the new storage with the label mentioned above.
Attach Network Storage on Xen Center:
xe sr-create content-type=user type=nfs name-label=NFS shared=true device-config:server=(FQDN or IP) device-config:serverpath=/NFS
Auto Start VM with Xen Center
add to your /etc/rc.local
sleep 20
xe vm-start uuid=
sleep 20
xe vm-start uuid=
sleep 20
xe vm-start uuid=
Another Method :
- Find the UID of the vm :
xe vm-list<br></br>
uuid ( RO) : [uuid-vm]<br></br>
name-label ( RW): [vm-name]<br></br>
power-state ( RO): [vm-power]```
2. Set to auto start:
`xe vm-param-set uuid=[uuid-vm] other-config:auto_poweron=true``<br></br>`