kvm virsh常用命令

复制代码
# 查看已启动虚机
[root@localhost driver]# virsh list
 Id    Name                           State
----------------------------------------------------
 3     ttt2                           running
 5     ttt3                           running

# 查看所有虚机情况
[root@localhost driver]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     ttt2                           running
 5     ttt3                           running
 -     1                              shut off

# 开机
[root@localhost driver]# virsh start ttt

# 关机
[root@localhost driver]# virsh shutdown ttt

# 查看虚机的具体配置
[root@localhost driver]# virsh dumpxml ttt
<domain type='kvm'>
  <name>ttt</name>
  <uuid>98496329-1459-412a-a043-51dde78f3a1a</uuid>

# 查看虚机基本资源配置
[root@localhost driver]# virsh dominfo ttt
Id:             -
Name:           ttt
UUID:           98496329-1459-412a-a043-51dde78f3a1a
OS Type:        hvm
State:          shut off
CPU(s):         8
Max memory:     16777216 KiB
Used memory:    8388608 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: none
Security DOI:   0

# 查看kvm所在服务器资源情况
[root@localhost driver]# virsh nodeinfo
CPU model:           x86_64
CPU(s):              56
CPU frequency:       1263 MHz
CPU socket(s):       1
Core(s) per socket:  14
Thread(s) per core:  2
NUMA cell(s):        2
Memory size:         131826992 KiB

# 查看磁盘镜像信息
[root@localhost local0]# qemu-img info 1e327efd-026b-472a-9f7e-304bb353b2e7_sys.qcow2

  image: 1e327efd-026b-472a-9f7e-304bb353b2e7_sys.qcow2
  file format: qcow2
  virtual size: 40G (42949672960 bytes)
  disk size: 15M
  cluster_size: 65536
  backing file: /var/lib/libvirt/images/local0/1e327efd-026b-472a-9f7e-304bb353b2e7_test03_sys.qcow2
  Format specific information:
  compat: 1.1
  lazy refcounts: false

复制代码

 

posted @   你说夕阳很美  阅读(25)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示