- >sudo virsh Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit
To get into the kvm prompt.
- To see all virtuals running or not on this machine:
>list --all virsh # list --all Id Name State ---------------------------------- 1 sgd-vm02 running 2 sgd-vm03 running 3 sgd-vm06 running 4 sgd-vm07 running 5 cherry-vm08 running 7 sgd-vm13 running 9 cherry-vm14 running- To stop a virtual:
>>shutdown sgd-vm02 This will bring the virtual machine down to an off state. You need to do this if you are going to remove it.- To start a virtual that has already been created:
>start sgd-vm03 it will need a minute to come all the way up.- To remove a virtual altogether, this has to be done if youa re rebuilding the same virtual
>undefine sgd-vm03 This will get rid of all trace of the virtual, unless you saved it or made a backup copy.- To save a copy of the virtual
>save sgd-vm03 this will save a copy of the image and store it for retrieval- To retrieve a copy of a saved virtual:
>restore sgd-vm03 This should work and bring it back up.- To save a copy by hand:
>cd /vm03 >cpto filename.bak Now you have a copy of the image of sgd-vm03, keep this in a directory and you can reuse it on any kvm server. - There is a sudo for virsh:
>sudosh