硬件,os,内核模块,用户空间工具,命令行具体参数,日志

[root@localhost ~]# yum install pciutils

[root@localhost ~]# lscpu;lspci

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    2
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 60
Model name:            Intel(R) Core(TM) i3-4170 CPU @ 3.70GHz
Stepping:              3
CPU MHz:               3700.000
BogoMIPS:              7399.71
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0-3 00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06)
00:02.0 VGA compatible controller: Intel Corporation 4th Generation Core Processor Family Integrated Graphics Controller (rev 06)
00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
00:14.0 USB controller: Intel Corporation 9 Series Chipset Family USB xHCI Controller
00:16.0 Communication controller: Intel Corporation 9 Series Chipset Family ME Interface #1
00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I217-V
00:1a.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #2
00:1b.0 Audio device: Intel Corporation 9 Series Chipset Family HD Audio Controller
00:1c.0 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 1 (rev d0)
00:1c.3 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 4 (rev d0)
00:1d.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #1
00:1f.0 ISA bridge: Intel Corporation 9 Series Chipset Family H97 Controller
00:1f.2 RAID bus controller: Intel Corporation SATA Controller [RAID mode]
00:1f.3 SMBus: Intel Corporation 9 Series Chipset Family SMBus Controller
02:00.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 41)

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)

[root@localhost ~]# lsmod |grep kvm
kvm_intel             162153  3
kvm                   525259  1 kvm_intel
[root@localhost ~]# ll /lib/modules/3.10.0-327.el7.x86_64/kernel/arch/x86/kvm/
total 1180
-rw-r--r--. 1 root root 104261 Nov 20  2015 kvm-amd.ko
-rw-r--r--. 1 root root 271245 Nov 20  2015 kvm-intel.ko
-rw-r--r--. 1 root root 824605 Nov 20  2015 kvm.ko

[root@localhost ~]# yum install bridge-utils qemu-kvm
[root@localhost ~]# rpm -qa|grep kvm
qemu-kvm-common-1.5.3-105.el7_2.4.x86_64
qemu-kvm-1.5.3-105.el7_2.4.x86_64

[root@localhost ~]# /usr/libexec/qemu-kvm -version
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-105.el7_2.4), Copyright (c) 2003-2008 Fabrice Bellard

[root@localhost ~]# /usr/libexec/qemu-kvm -machine ?

[root@localhost ~]# /usr/libexec/qemu-kvm -M ?

Supported machines are:
none empty machine
pc RHEL 7.0.0 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-rhel7.0.0)
pc-i440fx-rhel7.0.0 RHEL 7.0.0 PC (i440FX + PIIX, 1996) (default)
rhel6.6.0 RHEL 6.6.0 PC
rhel6.5.0 RHEL 6.5.0 PC
rhel6.4.0 RHEL 6.4.0 PC
rhel6.3.0 RHEL 6.3.0 PC
rhel6.2.0 RHEL 6.2.0 PC
rhel6.1.0 RHEL 6.1.0 PC
rhel6.0.0 RHEL 6.0.0 PC

[root@localhost ~]# /usr/libexec/qemu-kvm -cpu ?

x86           qemu64  QEMU Virtual CPU version 1.5.3
x86 phenom AMD Phenom(tm) 9550 Quad-Core Processor
x86 core2duo Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz
x86 kvm64 Common KVM processor
x86 qemu32 QEMU Virtual CPU version 1.5.3
x86 kvm32 Common 32-bit KVM processor
x86 coreduo Genuine Intel(R) CPU T2600 @ 2.16GHz
x86 486
x86 pentium
x86 pentium2
x86 pentium3
x86 athlon QEMU Virtual CPU version 1.5.3
x86 n270 Intel(R) Atom(TM) CPU N270 @ 1.60GHz
x86 cpu64-rhel6 QEMU Virtual CPU version (cpu64-rhel6)
x86 Conroe Intel Celeron_4x0 (Conroe/Merom Class Core 2)
x86 Penryn Intel Core 2 Duo P9xxx (Penryn Class Core 2)
x86 Nehalem Intel Core i7 9xx (Nehalem Class Core i7)
x86 Westmere Westmere E56xx/L56xx/X56xx (Nehalem-C)
x86 SandyBridge Intel Xeon E312xx (Sandy Bridge)
x86 Haswell Intel Core Processor (Haswell)
x86 Broadwell Intel Core Processor (Broadwell)
x86 Opteron_G1 AMD Opteron 240 (Gen 1 Class Opteron)
x86 Opteron_G2 AMD Opteron 22xx (Gen 2 Class Opteron)
x86 Opteron_G3 AMD Opteron 23xx (Gen 3 Class Opteron)
x86 Opteron_G4 AMD Opteron 62xx class CPU
x86 Opteron_G5 AMD Opteron 63xx class CPU
x86 host KVM processor with all supported host features (only available in KVM mode) Recognized CPUID flags:
pbe ia64 tm ht ss sse2 sse fxsr mmx acpi ds clflush pn pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de vme fpu
hypervisor rdrand f16c avx osxsave xsave aes tsc-deadline popcnt movbe x2apic sse4.2|sse4_2 sse4.1|sse4_1 dca pcid pdcm xtpr cx16 fma cid ssse3 tm2 est smx vmx ds_cpl monitor dtes64 pclmulqdq|pclmuldq pni|sse3
avx512cd avx512er avx512pf smap adx rdseed avx512f mpx rtm invpcid erms bmi2 smep avx2 hle bmi1 fsgsbase
3dnow 3dnowext lm|i64 rdtscp pdpe1gb fxsr_opt|ffxsr mmxext nx|xd syscall
perfctr_nb perfctr_core topoext tbm nodeid_msr tce fma4 lwp wdt skinit xop ibs osvw 3dnowprefetch misalignsse sse4a abm cr8legacy extapic svm cmp_legacy lahf_lm
pmm-en pmm phe-en phe ace2-en ace2 xcrypt-en xcrypt xstore-en xstore
kvm_pv_unhalt kvm_pv_eoi kvm_steal_time kvm_asyncpf kvmclock kvm_mmu kvm_nopiodelay kvmclock
pfthreshold pause_filter decodeassists flushbyasid vmcb_clean tsc_scale nrip_save svm_lock lbrv npt

[root@localhost lib]# /usr/libexec/qemu-kvm -device ?

Controller/Bridge/Hub devices:
name "i82801b11-bridge", bus PCI
name "ioh3420", bus PCI, desc "Intel IOH device id 3420 PCIE Root Port"
name "pci-bridge", bus PCI, desc "Standard PCI Bridge"
name "usb-host", bus usb-bus
name "usb-hub", bus usb-bus
name "x3130-upstream", bus PCI, desc "TI X3130 Upstream Port of PCI Express Switch"
name "xio3130-downstream", bus PCI, desc "TI X3130 Downstream Port of PCI Express Switch" USB devices:
name "ich9-usb-ehci1", bus PCI
name "ich9-usb-ehci2", bus PCI
name "ich9-usb-uhci1", bus PCI
name "ich9-usb-uhci2", bus PCI
name "ich9-usb-uhci3", bus PCI
name "ich9-usb-uhci4", bus PCI
name "ich9-usb-uhci5", bus PCI
name "ich9-usb-uhci6", bus PCI
name "nec-usb-xhci", bus PCI
name "piix3-usb-uhci", bus PCI
name "piix4-usb-uhci", bus PCI
name "usb-ehci", bus PCI
name "vt82c686b-usb-uhci", bus PCI Storage devices:
name "ich9-ahci", bus PCI, alias "ahci"
name "ide-cd", bus IDE, desc "virtual IDE CD-ROM"
name "ide-drive", bus IDE, desc "virtual IDE disk or CD-ROM (legacy)"
name "ide-hd", bus IDE, desc "virtual IDE disk"
name "scsi-block", bus SCSI, desc "SCSI block device passthrough"
name "scsi-cd", bus SCSI, desc "virtual SCSI CD-ROM"
name "scsi-disk", bus SCSI, desc "virtual SCSI disk or CD-ROM (legacy)"
name "scsi-generic", bus SCSI, desc "pass through generic scsi device (/dev/sg*)"
name "scsi-hd", bus SCSI, desc "virtual SCSI disk"
name "usb-bot", bus usb-bus
name "usb-storage", bus usb-bus
name "virtio-blk-device", bus virtio-bus
name "virtio-blk-pci", bus PCI, alias "virtio-blk"
name "virtio-scsi-device", bus virtio-bus
name "virtio-scsi-pci", bus PCI Network devices:
name "e1000", bus PCI, desc "Intel Gigabit Ethernet"
name "rtl8139", bus PCI
name "virtio-net-device", bus virtio-bus
name "virtio-net-pci", bus PCI, alias "virtio-net" Input devices:
name "ccid-card-passthru", bus ccid-bus, desc "passthrough smartcard"
name "isa-serial", bus ISA
name "pci-serial", bus PCI
name "usb-ccid", bus usb-bus, desc "CCID Rev 1.1 smartcard reader"
name "usb-kbd", bus usb-bus
name "usb-mouse", bus usb-bus
name "virtconsole", bus virtio-serial-bus
name "virtio-serial-device", bus virtio-bus
name "virtio-serial-pci", bus PCI, alias "virtio-serial"
name "virtserialport", bus virtio-serial-bus Display devices:
name "cirrus-vga", bus PCI, desc "Cirrus CLGD 54xx VGA"
name "qxl", bus PCI, desc "Spice QXL GPU (secondary)"
name "qxl-vga", bus PCI, desc "Spice QXL GPU (primary, vga compatible)"
name "sga", bus ISA, desc "Serial Graphics Adapter"
name "VGA", bus PCI Sound devices:
name "AC97", bus PCI, desc "Intel 82801AA AC97 Audio"
name "hda-duplex", bus HDA, desc "HDA Audio Codec, duplex (line-out, line-in)"
name "hda-micro", bus HDA, desc "HDA Audio Codec, duplex (speaker, microphone)"
name "hda-output", bus HDA, desc "HDA Audio Codec, output-only (line-out)"
name "ich9-intel-hda", bus PCI, desc "Intel HD Audio Controller (ich9)"
name "intel-hda", bus PCI, desc "Intel HD Audio Controller (ich6)" Misc devices:
name "i6300esb", bus PCI
name "ib700", bus ISA
name "isa-debug-exit", bus ISA
name "isa-debugcon", bus ISA
name "kvm-pci-assign", bus PCI, alias "pci-assign", desc "KVM-based PCI passthrough"
name "pc-testdev", bus ISA
name "pci-testdev", bus PCI, desc "PCI Test Device"
name "usb-redir", bus usb-bus
name "usb-tablet", bus usb-bus
name "vfio-pci", bus PCI, desc "VFIO-based PCI device assignment"
name "virtio-balloon-device", bus virtio-bus
name "virtio-balloon-pci", bus PCI, alias "virtio-balloon"
name "virtio-rng-device", bus virtio-bus
name "virtio-rng-pci", bus PCI Uncategorized devices:
name "pvpanic", bus ISA

[root@localhost lib]# /usr/libexec/qemu-kvm -device VGA,?

VGA.vgamem_mb=uint32
VGA.mmio=on/off
VGA.addr=pci-devfn
VGA.romfile=string
VGA.rombar=uint32
VGA.multifunction=on/off
VGA.command_serr_enable=on/off

[root@localhost lib]# /usr/libexec/qemu-kvm -device qxl,?

qxl.ram_size=uint32
qxl.vram_size=uint32
qxl.revision=uint32
qxl.debug=uint32
qxl.guestdebug=uint32
qxl.cmdlog=uint32
qxl.ram_size_mb=uint32
qxl.vram_size_mb=uint32
qxl.vram64_size_mb=uint32
qxl.vgamem_mb=uint32
qxl.surfaces=int32
qxl.addr=pci-devfn
qxl.romfile=string
qxl.rombar=uint32
qxl.multifunction=on/off
qxl.command_serr_enable=on/off

[root@localhost lib]# /usr/libexec/qemu-kvm -device e1000,?

e1000.mac=macaddr
e1000.vlan=vlan
e1000.netdev=netdev
e1000.bootindex=int32
e1000.autonegotiation=on/off
e1000.addr=pci-devfn
e1000.romfile=string
e1000.rombar=uint32
e1000.multifunction=on/off
e1000.command_serr_enable=on/off

命令行参数

[root@localhost lib]# /usr/libexec/qemu-kvm -h|more
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-105.el7_2.4), Copyright (c) 2003-2008 Fabrice Bellard WARNING: Direct use of qemu-kvm from the command line is not supported by Red Hat.
WARNING: Use libvirt as the stable management interface.
WARNING: Some command line options listed here may not be available in future releases. -machine
-cpu
-smp n set the number of CPUs to 'n' [default=1]
-boot [order=drives] 'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)
-m megs set virtual RAM size to megs MB [default=128]
-name string1[,process=string2]
set the name of the guest
-cdrom file
-display sdl[,frame=on|off][,alt_grab=on|off][,ctrl_grab=on|off]
[,window_close=on|off]|curses|none|
vnc=<display>[,<optargs>]
select display type
-nographic disable graphical output and redirect serial I/Os to console
-spice [port=port][,password=<secret>]
at least one of {port, tls-port} is mandatory
-vga [std|cirrus|vmware|qxl|xenfb|none]
select video card type
-full-screen start in full screen
-vnc display start a VNC server on display -net nic  其中,“-net nic”这个是必须的参数,表明这是一个网卡的配置。如果没有,虚拟机启动后就不会有网卡
-net user 用户网络模式
http://www.diyoms.com/cloud/836.html
http://qemu.weilnetz.de/qemu-doc.html#Using-TAP-network-interfaces
用户模式客户机可以直接连接宿主机和外部网络,而且完全由qemu自身完全实现,不依赖于(bridge,dnsmasq,iptables等),不需要root权限
Qemu使用slirp实现了一套Tcp/ip协议栈,而且用这个协议栈实现了一套虚拟的NAT网络。
qemu-kvm默认使用:-net nic -net user
优点:简单、独立性好、不需要root权限、客户机网络隔离性好。
缺点:
1、性能差
2、不支持部分网络功能(如ICMP),所以不能再客户机中使用ping命令测试,
3、不能从宿主机或外部网络直接访问客户机 -net user dhcpstart=addr 设置分配给客户机的第一个Ip,在qemu内嵌的DHCP服务器中有16个IP地址可以分配,默认是(如10.0.2.15~10.0.2.30)
dns=addr 指定虚拟的DNS地址,该地址不能与宿主机一样,默认为网络中的第三个IP地址(如:10.0.2.3) qemu-kvm centos6u5.img -m 1024 -smp 2 -net nic -net user,tftp=/root/tftp,hostfwd=tcp::5022-hostfwd=tcp::5080-:80
-net none       use it alone to have zero network devices. If no -net option
is provided, the default is '-net nic -net user'
-net nic -net bridge Linux/Multiboot boot specific:
-kernel bzImage use 'bzImage' as kernel image
-append cmdline use 'cmdline' as kernel command line
-initrd file use 'file' as initial ram disk
-dtb file use 'file' as device tree image -daemonize daemonize QEMU after initializing
-echr chr set terminal escape character instead of ctrl-a
During emulation, the following keys are useful:
ctrl-alt-f toggle full screen
ctrl-alt-n switch to virtual console 'n'
ctrl-alt toggle mouse and keyboard grab When using -nographic, press 'ctrl-a h' to get some help.

命令行参数解释及实例

在qemu-kvm命令行中,添加“-nographic”参数可以完全关闭QEMU的图形界面输出,从而让QEMU在该模式下完全成为简单的命令行工具。而QEMU中模拟产生的串口被重定向到了当前的控制台(console)中,所以如果在客户机中对其内核进行配置从而让内核的控制台输出重定向到串口后,就依然可以在非图形模式下管理客户机系统或调试客户机的内核。

在命令行直接安装虚拟机
mount -o loop CentOS-6.5-x86_64-bin-DVD1.iso /mnt
qemu-img create -f qcow2 cs66.qcow2 8G
/usr/libexec/qemu-kvm -boot order=dc -hda cs66.qcow2 -cdrom CentOS-6.5-x86_64-bin-DVD1.iso -m 1024 -nographic -append console=ttyS0 -kernel /mnt/isolinux/vmlinuz -initrd /mnt/isolinux/initrd.img
kill 掉上面的进程,重启去掉一些参数再如下启动
/usr/libexec/qemu-kvm -boot order=dc -hda cs66.qcow2 -m 1024 -nographic 宿主机是cs72,虚拟机是cs65
安装好系统之后,先用spice启动
1.先启动/usr/libexec/qemu-kvm -boot order=dc -hda cs65.qcow2 -m 1024 -spice port=9987,password=1234
2.windows的spice客户端去连接,进去之后,vi /boot/grub/grub.cfg,在内核行后加入console=ttyS0然后保存关机
3.再加-nographic参数后启动,/usr/libexec/qemu-kvm -boot order=dc -hda cs65.qcow2 -m 1024 -nographic
这样就在宿主机本地启动了 man qemu-kvm
debug/expert options
/usr/libexec/qemu-kvm -enable-kvm -monitor stdio

服务器启动 /usr/libexec/qemu-kvm -boot dc -hda disk/cs65.qcow2 -m 1024 -vnc :2 -daemonize -net bridge -net nic -enable-kvm -monitor telnet:192.168.10.101:4444,server,nowait

客户端连接 telnet 192.168.10.101 4444

/usr/libexec/qemu-kvm -boot dc -hda disk/cs65.qcow2 -m 1024 -vnc :2 -daemonize -net bridge -net nic -enable-kvm -monitor tcp:192.168.10.101:4445,server,nowait

nc 192.168.10.101 4445

    tcp – raw tcp sockets  #下面第2点,我的举例是RAW TCP socket
    telnet – the telnet protocol is used instead of raw tcp sockets. This is the preferred option over tcp as you can break out of the monitor using Ctrl-] then typing quit. You can’t break out of the monitor like this after connecting with the raw socket option
    10.1.77.82 – Listen on this host/IP only. You can use 127.0.0.1 if you want to only allow connections locally. If you want to listen on any ip address on the server, just leave this blank so you end up with two consecutive colons ie “::” .
    4444 – port number to listen on.
    server – listening in server mode
    nowait – qemu will wait for a client socket application to connect to the port before continuing unless this option is used. In most cases you’ll want to use the nowait option.

日志问题追查

Jul 31 11:02:59 localhost kernel: kvm [1463]: vcpu0 disabled perfctr wrmsr: 0xc2 data 0xffff
Jul 31 11:02:59 localhost kernel: kvm [1463]: vcpu0 unhandled rdmsr: 0x570
cpu标志
[root@localhost ~]# cat /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm arat pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt 日志中kvm报出来的关于cpu的情况
[root@localhost ~]# tail -20 /var/log/messages-20160731
Jul 31 11:02:59 localhost kernel: kvm [1463]: vcpu0 disabled perfctr wrmsr: 0xc2 data 0xffff
Jul 31 11:02:59 localhost kernel: kvm [1463]: vcpu0 unhandled rdmsr: 0x570 这是kvm支持的cpu特征
[root@localhost ~]# /usr/libexec/qemu-kvm -cpu ?|grep msr
pbe ia64 tm ht ss sse2 sse fxsr mmx acpi ds clflush pn pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de vme fpu
perfctr_nb perfctr_core topoext tbm nodeid_msr tce fma4 lwp wdt skinit xop ibs osvw 3dnowprefetch misalignsse sse4a abm cr8legacy extapic svm cmp_legacy lahf_lm cpu flag msr概念
Model Specific Register (MSR) as the name implies is model specific and may change from processor model number (n) to processor model number (n+1).
读写方法
MSR 是CPU 的一组64 位寄存器,可以分别通过RDMSR 和WRMSR 两条指令进行读和写的操作,前提要在ECX 中写入MSR 的地址。对于RDMSR 指令,将会返回相应的MSR 中64bit 信息到(EDX:EAX)寄存器中;对于WRMSR 指令,把要写入的信息存入(EDX:EAX)中,执行写指令后,即可将相应的信息存入ECX 指定的MSR 中。MSR 的指令必须执行在level 0 或实模式下。
作用
MSR 总体来是为了设置CPU 的工作环境和标示CPU 的工作状态,包括温度控制,性能监控等,具体来说,分为以下几项: [root@localhost ~]# lsmod|grep papi
[root@localhost ~]# modprobe papi
modprobe: FATAL: Module papi not found. [root@localhost ~]# lsmod |grep perfctr
[root@localhost ~]# modprobe perfctr
modprobe: FATAL: Module perfctr not found. # modprobe perfctr 加载模块
lsmod 显示模块
rmmod perfctr移除模块
若perfctr模块安装成功后,你将看到perfctr模块,并且你可以在 /lib/modules/2.6.19-zkl-perfctr/kernel/drivers/perfctr中看到perfctr模块perfctr.ko 需要使用PAPI得到硬件级的数据,即与微指令相关的数据,
例如 L1/L2 cache miss、TLB miss、Cycle等,而PAPI需要perfctr(Performance-monitoring counters support)模块的支持,
而Linux内核当中默认没有perfctr模块,并且perfctr只在某些内核上被支持,它实际上是内核的一个补丁,需要重新编译内核,打上补丁才能在内核上运行perfctr模块。更多信息参考papi和perfctr的INSTALL文件。 PAPI (Performance Application Programming Interface),它是一套API,通过它可以访问CPU性能计数器的数据,
例如 L1/L2 Cache,CPU Cycle,CPU Instruction,TLB等.
PAPI官网是: http://icl.cs.utk.edu/papi/ [root@localhost ~]# yum search papi
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.hust.edu.cn
* extras: mirrors.neusoft.edu.cn
* updates: mirrors.neusoft.edu.cn
=================================================== N/S matched: papi ====================================================
papi-devel.i686 : Header files for the compiling programs with PAPI
papi-devel.x86_64 : Header files for the compiling programs with PAPI
papi-static.i686 : Static libraries for the compiling programs with PAPI
papi-static.x86_64 : Static libraries for the compiling programs with PAPI
papi-testsuite.x86_64 : Set of tests for checking PAPI functionality
papi.i686 : Performance Application Programming Interface
papi.x86_64 : Performance Application Programming Interface
pcp-pmda-papi.x86_64 : Performance Co-Pilot (PCP) metrics for Performance API and hardware counters

virt-manager做快照,其实是将当前状态整个保存在磁盘上,从下面可以看到容量的变量,做完以后,snapshot -l才会增加一条记录,对oracle4作了一次快照7.4G,用了10多分钟。

[root@kvm disk]# pwd
/home/kvm/disk
[root@kvm disk]# ll
total 273772440
-rw------- 1 qemu qemu 2238185472 Nov 9 15:48 asm-crs.qcow2
-rw------- 1 qemu qemu 8532787200 Nov 9 15:48 asm-data1.qcow2
-rw------- 1 qemu qemu 6071648256 Nov 9 15:48 asm-data2.qcow2
-rw------- 1 qemu qemu 9287696384 Nov 9 15:48 asm-fra.qcow2
-rw------- 1 root root 53695545344 Dec 9 2016 iscsi-share.qcow2
-rw-r--r-- 1 root root 87976050688 Dec 2 14:41 oracle1.qcow2
-rw------- 1 qemu qemu 75245158400 Dec 15 10:42 oracle3.qcow2
-rw------- 1 qemu qemu 19414646784 Dec 15 10:42 oracle4-db-file.qcow2
-rw------- 1 qemu qemu 18080858112 Dec 15 10:42 oracle4-db-fra.qcow2
-rw------- 1 qemu qemu 13367050240 Dec 15 10:41 oracle4-db-soft.qcow2
-rw------- 1 qemu qemu 36824350720 Dec 15 10:41 oracle4-os.qcow2
-rw------- 1 qemu qemu 111209349120 Dec 15 10:42 oracle-test.qcow2
-rw-r--r-- 1 root root 53695545344 Nov 30 2016 rac1.qcow2
-rw------- 1 root root 53695545344 Dec 3 2016 rac2.qcow2
-rw------- 1 root root 53695545344 Nov 29 2016 rac-share.qcow2
-rw-r--r-- 1 root root 21478375424 Jan 14 2017 test.qcow2 [root@kvm disk]# qemu-img snapshot -l oracle1.qcow2
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snapshot1 7.9G 2017-01-26 14:16:35 01:13:03.990 [root@kvm disk]# qemu-img snapshot -l oracle4-db-file.qcow2
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snapshot1 0 2017-03-11 10:42:52 01:34:06.874
2 snapshot2 0 2017-12-14 11:06:23 53:46:10.040 [root@kvm disk]# qemu-img snapshot -l oracle4-db-fra.qcow2
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snapshot1 0 2017-03-11 10:42:52 01:34:06.874
2 snapshot2 0 2017-12-14 11:06:23 53:46:10.040 [root@kvm disk]# qemu-img snapshot -l oracle4-db-soft.qcow2
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snapshot1 0 2017-03-11 10:42:52 01:34:06.874
2 snapshot2 0 2017-12-14 11:06:23 53:46:10.040 [root@kvm disk]# qemu-img snapshot -l oracle4-os.qcow2
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snapshot1 7.4G 2017-03-11 10:42:52 01:34:06.874
2 snapshot2 7.7G 2017-12-14 11:06:23 53:46:10.040 [root@kvm disk]# qemu-img info oracle4-os.qcow2
image: oracle4-os.qcow2
file format: qcow2
virtual size: 15G (16106127360 bytes)
disk size: 24G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 snapshot1 7.4G 2017-03-11 10:42:52 01:34:06.874
2 snapshot2 7.7G 2017-12-14 11:06:23 53:46:10.040
Format specific information:
compat: 1.1
lazy refcounts: true

kvm的更多相关文章

  1. [原] KVM 虚拟化原理探究(1)— overview

    KVM 虚拟化原理探究- overview 标签(空格分隔): KVM 写在前面的话 本文不介绍kvm和qemu的基本安装操作,希望读者具有一定的KVM实践经验.同时希望借此系列博客,能够对KVM底层 ...

  2. 基于本地存储的kvm虚拟机在线迁移

    基于本地存储的kvm虚拟机在线迁移 kvm虚拟机迁移分为4种(1)热迁移基于共享存储(2)热迁移基于本地存储(3)冷迁移基于共享存储(4)冷迁移基于本地存储 这里介绍的是基于本地存储的热迁移 动态块迁 ...

  3. [原] KVM 虚拟化原理探究 —— 目录

    KVM 虚拟化原理探究 -- 目录 标签(空格分隔): KVM KVM 虚拟化原理探究(1)- overview KVM 虚拟化原理探究(2)- QEMU启动过程 KVM 虚拟化原理探究(3)- CP ...

  4. [原] KVM 虚拟化原理探究(6)— 块设备IO虚拟化

    KVM 虚拟化原理探究(6)- 块设备IO虚拟化 标签(空格分隔): KVM [toc] 块设备IO虚拟化简介 上一篇文章讲到了网络IO虚拟化,作为另外一个重要的虚拟化资源,块设备IO的虚拟化也是同样 ...

  5. [原] KVM 虚拟化原理探究(5)— 网络IO虚拟化

    KVM 虚拟化原理探究(5)- 网络IO虚拟化 标签(空格分隔): KVM IO 虚拟化简介 前面的文章介绍了KVM的启动过程,CPU虚拟化,内存虚拟化原理.作为一个完整的风诺依曼计算机系统,必然有输 ...

  6. [原] KVM 虚拟化原理探究(4)— 内存虚拟化

    KVM 虚拟化原理探究(4)- 内存虚拟化 标签(空格分隔): KVM 内存虚拟化简介 前一章介绍了CPU虚拟化的内容,这一章介绍一下KVM的内存虚拟化原理.可以说内存是除了CPU外最重要的组件,Gu ...

  7. [原] KVM 虚拟化原理探究(3)— CPU 虚拟化

    KVM 虚拟化原理探究(3)- CPU 虚拟化 标签(空格分隔): KVM [TOC] CPU 虚拟化简介 上一篇文章笼统的介绍了一个虚拟机的诞生过程,从demo中也可以看到,运行一个虚拟机再也不需要 ...

  8. [原] KVM 虚拟化原理探究(2)— QEMU启动过程

    KVM 虚拟化原理探究- QEMU启动过程 标签(空格分隔): KVM [TOC] 虚拟机启动过程 第一步,获取到kvm句柄 kvmfd = open("/dev/kvm", O_ ...

  9. [原] KVM虚拟机网络闪断分析

    背景 公司云平台的机器时常会发生网络闪断,通常在10s-100s之间. 异常情况 VM出现问题时,表现出来的情况是外部监控系统无法访问,猜测可能是由于系统假死,OVS链路问题等等.但是在出现网络问题的 ...

  10. [原] KVM 环境下MySQL性能对比

    KVM 环境下MySQL性能对比 标签(空格分隔): Cloud2.0 [TOC] 测试目的 对比MySQL在物理机和KVM环境下性能情况 压测标准 压测遵循单一变量原则,所有的对比都是只改变一个变量 ...

随机推荐

  1. 破解Outlook数据文件密码/PST访问密码

    不少人会经常用outlook,邮件多的时候可能不定期导出一个PST文件,为安全起见,给PST文件设置访问密码,可是时间长了,难免忘记,怎么办呢?不用担心,你自己就可以解决,无论是Outlook97.O ...

  2. Outlook不能预览和打开Excel文件:

    无法打开Outlook邮箱中的Excel附件,确实让人恼火 先不要着急: 1.在开始->运行,输入"regedit" 2.找到路径:HKEY_CURRENT_USER\Sof ...

  3. web前端教程之javascript创建对象的方法

    今天给大家讲讲javascript基础教程中的javascript面向对象的技术,这一次我们深入的学习一下JavaScrip基于t面向对象之创建对象,关于面向对象的一些术语这里就不给大家介绍了,不了解 ...

  4. 新篇章,Golang 和 beego 初识

    beego 是一个快速开发 Go 应用的 HTTP 框架,他可以用来快速开发 API.Web 及后端服务等各种应用,是一个 RESTful 的框架,主要设计灵感来源于 tornado.sinatra ...

  5. Hadoop基本操作

    命令基本格式: hadoop fs -cmd < args > 1.ls hadoop fs -ls / 列出hdfs文件系统根目录下的目录和文件 hadoop fs -ls -R / 列 ...

  6. 字符串strcpy

    strcpy函数的表达方式: //把一个char组成的字符串循环右移n个,如:“abcdefghi",n=2,移动后"hiabcdefgh" #include <i ...

  7. HTML5体验改进的14条军规

    来自公园<HTML5——用新方式创造更好的用户体验>线下活动中来自火速轻应用的技术总监胡敏东的分享.   1. fake 页 - 首屏加速 目标:首屏 3s 以内   因为 71% 的用户 ...

  8. UE4 VR GUI实现 参考(UMG AND VR)

    Note:4.13以后版本VR UI采用 WidgetComponent + WidgetInteractionComponent可轻松实现交互 Blueprint Demo: https://for ...

  9. Android Studio安装插件GsonFormat

    Android Studio菜单栏File > Settings > plugins' 这个是Android Studio搜索和安装插件的界面,下面直接上动图 : 安装结束后需要关闭重新启 ...

  10. ECMAScript6 中 类的封装与继承

    ECMASCRIPT6中实现了class关键字,这样使我们更容易也更形象的进行类的操作 <script type="text/javascript"> class OF ...