Hello I made a backup of a VM guest with these steps:
1. virsh dumpxml --migratable test > /backup/test.xml 2. virsh snapshot-create-as --domain test \ --name backup.qcow2 \ --no-metadata \ --atomic \ --quiesce \ --disk-only \ --diskspec vda,snapshot=external 3. cp /var/lib/libvirt/images/test.qcow2 /backup/ 4. virsh blockcommit test vda --active --pivot 5. rm -f /var/lib/libvirt/images/test.backup.qcow2
After backup I am trying to test if I can restore from it.
- I am shutting down guest ‘test’
- Undefying guest ‘test’
- removing qcow2 image from main images folder
- then copy qcow2 to main image folder
- Trying to define by this command:
virsh define -file /backup/test.xml
and I am getting error:
error: unexpected data 'test.xml'
What I am doing wrong? How can I troubleshot this?
When you get an error suggesting a syntax problem, you should always check the man page first.
virsh define expects only one argument, the filename from which it should load the XML definition. You have passed two arguments. Thus it thinks you are trying to load a file named
-file, and has no idea what you mean with the second argument
The correct syntax is
virsh define filename.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.