Using KVM Virsh

  1. log into the rails or sgd-virt

  2. To get into the kvm prompt.

  3. >sudo virsh Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit
  4. To see all virtuals running or not on this machine:
  5. >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
  6. To stop a virtual:
  7. >>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.
  8. To start a virtual that has already been created:
  9. >start sgd-vm03 it will need a minute to come all the way up.
  10. 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.
  11. To save a copy of the virtual >save sgd-vm03 this will save a copy of the image and store it for retrieval
  12. To retrieve a copy of a saved virtual: >restore sgd-vm03 This should work and bring it back up.
  13. To save a copy by hand: >cd /vm03 >cp to 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.
  14. There is a sudo for virsh: >sudosh