Import and Export Xen VM a.k.a XCP-NG

Print virtual machine list

xe vm-list
uuid ( RO)           : 43dfac04-515e-7769-b2d2-444d4b7cb198
name-label ( RW): hk-zabbix-01
power-state ( RO): halted

Check the mount disk

df -h
[root@xenserver-hk-01 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 2.0G   44K  2.0G   1% /dev
tmpfs                       2.0G  504K  2.0G   1% /dev/shm
tmpfs                       2.0G  4.1M  2.0G   1% /run
tmpfs                       2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda1                18G  8.9G  7.9G  53% /
xenstore                   2.0G     0  2.0G   0% /var/lib/xenstored
/dev/loop0               45M   45M     0 100% /var/xen/xc-install
/dev/sda4                 512M  2.0M  510M   1% /boot/efi
/dev/sda5                 3.9G  708M  3.0G  20% /var/log
//192.168.10.10/soft    500G   49G  452G  10% /run/sr-mount/21c3c475-28c7-26b7-2abb-9bd8b011eb1e<br>192.168.10.10:/nfs/iso 18G 8.9G 7.9G 53% /run/sr-mount/a3ab3cfb-645d-54a0-9c49-9462bd66a7c3

Export the virtual machine to shared storage disk

xe vm-export vm=hk-zabbix-01 filename=/run/sr-mount/21c3c475-28c7-26b7-2abb-9bd8b011eb1e/hk-zabbix-01.xva

Import the VM

First copy the .xva or exported VM file to anywhere in the server. Then look for desired SR (Storage) UUID to be exported. Below the example import SR UUID is da491968-b6c2-00fa-1e8c-84e48f4d6114

Let’s fire up import command-

xe vm-import filename=/tmp/cifmount/SL-MEL-RMM.xva sr-uuid=da491968-b6c2-00fa-1e8c-84e48f4d6114 
Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.