virsh create somefile.xml
creates my machine just fine but when I shut the machine down the whole thing disappears. Machines I made with the virt-manager GUI are persistent (stick around after shutdown) and the xml file is derived from those virt-manager created machines.
Asked
Active
Viewed 1.9k times
27
colechristensen
- 602
- 1
- 5
- 14
2 Answers
32
Use virsh define somefile.xml
and virsh start domain-name
, doing this the VM will be persistent.
I can't check right now, but I think you can use virsh define
on an already started VM and this will make it persistent.
Francesco
- 336
- 3
- 2
-
6I can confirm this works with a domain started with the 'create' command – Pete Jul 31 '13 at 17:05
-
The best tip I read today – Chris Reid Dec 23 '20 at 16:49
11
If you don't have the xml for the running vm (eg. after transient migration), you can do
virsh dumpxml vm_name > vm_name.xml
virsh define vm_name.xml
To check:
virsh list --all --persistent
The VM should now be listed. Or
virsh dominfo vm_name
There should be a line with 'Persistent: yes'.
samesame
- 111
- 1
- 3