Chapitre 6. Shutting down virtual machines
6.1. Shutting down a virtual machine using the command-line interface
To shut down a responsive virtual machine (VM), do one of the following:
- Use a shutdown command appropriate to the guest OS while connected to the guest.
virsh shutdowncommand on the host:
If the VM is on a local host:
# virsh shutdown demo-guest1 Domain 'demo-guest1' is being shutdown
If the VM is on a remote host, in this example 10.0.0.1:
# virsh -c qemu+ssh://email@example.com/system shutdown demo-guest1 firstname.lastname@example.org's password: Domain 'demo-guest1' is being shutdown
To force a VM to shut down, for example if it has become unresponsive, use the
virsh destroy command on the host:
# virsh destroy demo-guest1 Domain 'demo-guest1' destroyed
virsh destroy command does not actually delete or remove the VM configuration or disk images. It only terminates the running VM instance of the VM, similarly to pulling the power cord from a physical machine. As such, in rare cases,
virsh destroy may cause corruption of the VM’s file system, so using this command is only recommended if all other shutdown methods have failed.