zeldor.biz

Linux, programming and more

Copyright © 2023
Log in

KVM manage virtual machines with virsh

March 16, 2011 by Igor Drobot Leave a Comment

Virsh is the main interface for managing virsh guest domains. The program can be used to create, pause, and shutdown domains.

Some of this commands may be helpful if you have no chance to run virt-manager.

Show guest information:

Show a list of all running guests: virsh list
Show a list of all available guests: virsh list –all
Show a guest’s info: virsh dominfo GUEST_NAME

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@hexa-core ~]# virsh list
 Id Name                 State
----------------------------------
  9 Webserver            running
 10 Squid                running
 11 Windows_XP           running
 13 Windows_Server_2003  running
 14 MySQL                running
 15 Windows_Server_2008_R2 running
 20 Munin                running
 23 Nagios               running
 27 Windows_7            running
 33 Corosync_01          running
 34 Corosync_02          running
 39 Fedora               running
 41 Fedora2              running

[root@hexa-core ~]# virsh list Id Name State ---------------------------------- 9 Webserver running 10 Squid running 11 Windows_XP running 13 Windows_Server_2003 running 14 MySQL running 15 Windows_Server_2008_R2 running 20 Munin running 23 Nagios running 27 Windows_7 running 33 Corosync_01 running 34 Corosync_02 running 39 Fedora running 41 Fedora2 running

1
2
3
4
5
6
7
8
9
10
11
12
[root@hexa-core ~]# virsh dominfo MySQL
Id:             14
Name:           MySQL
UUID:           59c35554-e61a-c10f-dc2c-2a1e74f9371d
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       127875.7s
Max memory:     2097152 kB
Used memory:    2097152 kB
Persistent:     yes
Autostart:      disable

[root@hexa-core ~]# virsh dominfo MySQL Id: 14 Name: MySQL UUID: 59c35554-e61a-c10f-dc2c-2a1e74f9371d OS Type: hvm State: running CPU(s): 1 CPU time: 127875.7s Max memory: 2097152 kB Used memory: 2097152 kB Persistent: yes Autostart: disable

Start and stop guest:

Start a guest: virsh start GUEST_NAME
Shutdown a guest (gently): virsh shutdown GUEST_NAME
virsh shutdown GUEST_ID
Shutdown a guest (wild – you are a maniac): virsh destroy GUEST_NAME
Suspend a guest: virsh suspend GUEST_NAME
Resume a suspended guest: virsh resume GUEST_NAME

Filed Under: Linux Tagged With: KVM, qemu, virsh

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *