0

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.

  1. I am shutting down guest 'test'
  2. Undefying guest 'test'
  3. removing qcow2 image from main images folder
  4. then copy qcow2 to main image folder
  5. 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?

0

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 test.xml.

The correct syntax is virsh define filename.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.