How To Enable Auto Start for KVM
I had one of my dedicated servers crash the other day and when I fixed it and booted it again, some of my virtual machines didn’t boot.
Turns out, it’s because they didn’t have the autostart enabled:
root@s3:~ # virsh dominfo m
Id: -
Name: m
UUID: f2f9b5aa-7086-89ef-a643-fddb55134ef0
OS Type: hvm
State: shut off
CPU(s): 4
Max memory: 4194304 KiB
Used memory: 4194304 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: none
Security DOI: 0
That’s how one can turn the autostart on so that next reboot this VM would start (last parameter is the name of the VM):
root@s3:~ # virsh autostart m
Domain m marked as autostarted
And just to make sure this actually helped:
root@s3:~ # virsh dominfo m
Id: -
Name: m
UUID: f2f9b5aa-7086-89ef-a643-fddb55134ef0
OS Type: hvm
State: shut off
CPU(s): 4
Max memory: 4194304 KiB
Used memory: 4194304 KiB
Persistent: yes
Autostart: enable
Managed save: no
Security model: none
Security DOI: 0
I had one of my dedicated servers crash the other day and when I fixed it and booted it again, some of my virtual machines didn’t boot.
Turns out, it’s because they didn’t have the autostart enabled:
root@s3:~ # virsh dominfo m
Id: -
Name: m
UUID: f2f9b5aa-7086-89ef-a643-fddb55134ef0
OS Type: hvm
State: shut off
CPU(s): 4
Max memory: 4194304 KiB
Used memory: 4194304 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: none
Security DOI: 0
That’s how one can turn the autostart on so that next reboot this VM would start (last parameter is the name of the VM):
root@s3:~ # virsh autostart m
Domain m marked as autostarted
And just to make sure this actually helped:
root@s3:~ # virsh dominfo m
Id: -
Name: m
UUID: f2f9b5aa-7086-89ef-a643-fddb55134ef0
OS Type: hvm
State: shut off
CPU(s): 4
Max memory: 4194304 KiB
Used memory: 4194304 KiB
Persistent: yes
Autostart: enable
Managed save: no
Security model: none
Security DOI: 0