Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Fedora Core 7 (FC7) Xen/KVM Guide
Previous Page Home Next Page

Managing Virtual Machines from the command line with `virsh`

Virtual machines can be managed on the command line with the virsh utility. The virsh utility is built around the libvirt management API and has a number of advantages over the traditional Xen xm tool:

  • virsh has a stable set of commands whose syntax & semantics will be preserved across updates to Xen.

  • virsh can be used as an unprivileged user for read-only operations (eg listing domains, getting info, etc)
  • virsh will (in future) be able to manage QEMU, VMWare, etc machines in additional to Xen, since libvirt is hypervisor agnostic.

To start a new virtual machine from an XML vm definition:

  • # virsh create <path to VM xml config> 
    
    
    

To list the virtual machines currently running, use:

  •  # virsh list
    
    
    

To gracefully power off a guest use:

  • # virsh shutdown <virtual machine (name | id | uuid)>
    
    
    

To save a snapshot of the machine to a file of your choosing:

  • # virsh save <virtual machine (name | id | uuid)> <filename>
    
    
    

To restore a previously saved snapshot:

  • # virsh restore <filename>
    
    
    

To export the XML config associated with a virtual machine:

  • # virsh dumpxml <virtual machine (name | id | uuid)
    
    
    

For a complete list of commands available for use with virsh run:

  • # virsh help
    
    
    

Or consult the manual page virsh(1)

Bugs in the virsh tool should be reported in BugZilla against the 'libvirt' component

Fedora Core 7 (FC7) Xen/KVM Guide
Previous Page Home Next Page


 
 
  Published under the terms of the Open Publication License Design by Interspire