我在物理机上安装了 Ubuntu 16.04 和 QEMU/KVM,虚拟机上也安装了 Ubuntu 16.04。KVM 下的磁盘写入速度极慢,安装过程按时进行了一天多的时间,但始终没有完成。第二台机器的速度比第一台慢 100 倍。但这是全新的计算机,磁盘速度很快。为什么它运行得这么慢?我必须检查什么?
# hdparm -Tt /dev/sda
/dev/sda:
Timing cached reads: 25588 MB in 1.99 seconds = 12861.67 MB/sec
Timing buffered disk reads: 1518 MB in 3.00 seconds = 505.46 MB/sec
# hdparm -Tt /dev/sdb
/dev/sdb:
Timing cached reads: 24748 MB in 1.99 seconds = 12435.68 MB/sec
Timing buffered disk reads: 1512 MB in 3.00 seconds = 503.95 MB/sec
# hdparm -Tt /dev/sdc
/dev/sdc:
Timing cached reads: 24766 MB in 1.99 seconds = 12444.51 MB/sec
Timing buffered disk reads: 1512 MB in 3.00 seconds = 503.83 MB/sec
# virsh domblkstat U226 sda --human
Device: sda
number of read operations: 15650
number of bytes read: 370658304
number of write operations: 1335
number of bytes written: 14706688
number of flush operations: 577
total duration of reads (ns): 895910866
total duration of writes (ns): 157488133
total duration of flushes (ns): 705676395
# virsh domblkstat U227 vda --human
Device: vda
number of read operations: 2890
number of bytes read: 29400064
number of write operations: 62919
number of bytes written: 3077697536
number of flush operations: 15855
total duration of reads (ns): 262241702
total duration of writes (ns): 56456643605
total duration of flushes (ns): 277285135
# virsh dominfo U226
Id: 3
Name: U226
UUID: 027a5df5-4211-4451-be4f-ca1bf9941e7b
OS Type: hvm
State: running
CPU(s): 2
CPU time: 114.4s
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: none
Security DOI: 0
# virsh dominfo U227
Id: 4
Name: U227
UUID: f1966b82-2bea-46ec-94b7-d0a52e6e32be
OS Type: hvm
State: running
CPU(s): 2
CPU time: 441.9s
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: none
Security DOI: 0
# virsh domblkerror U227
No errors found