
Tengo el problema de que cada vez que intento ejecutar Windows dentro de QEMU, parece que el acceso al disco se vuelve muy lento después de un rato. Sorprendentemente, tanto el acceso al disco desde dentro como desde fuera de la VM parece volverse lento.
Tengo mi unidad de Windows de casa y QEMU en el mismo disco (esta es una computadora portátil, por lo que no puedo usar varios discos), pero en diferentes volúmenes LVM (sin qcow ni nada, solo el LV sin formato). Poco después de unos minutos, Windows se vuelve inutilizable y el host también se vuelve lento. Tan pronto como desactivo la VM, el host vuelve a ser utilizable. He rastreado el problema en Windows para ralentizar el acceso al disco utilizando el monitor de recursos. Pero el problema parece estar en el lado LVM del host. Si ejecuto iostat -xz
me sale lo siguiente:
avg-cpu: %user %nice %system %iowait %steal %idle
17,36 10,14 5,41 38,51 0,00 28,58
Device r/s rkB/s rrqm/s %rrqm r_await rareq-sz w/s wkB/s wrqm/s %wrqm w_await wareq-sz d/s dkB/s drqm/s %drqm d_await dareq-sz aqu-sz %util
dm-0 7,63 82,81 0,00 0,00 84,37 10,85 22,74 209,61 0,00 0,00 121,53 9,22 0,00 0,00 0,00 0,00 0,00 0,00 3,41 3,32
dm-1 0,05 0,27 0,00 0,00 5,05 5,49 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00
dm-2 0,00 0,09 0,00 0,00 6,10 21,75 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00
dm-3 2,28 9,12 0,00 0,00 21,28 4,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,05 0,53
dm-4 0,02 0,09 0,00 0,00 4,95 4,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00
dm-5 0,00 0,00 0,00 0,00 31,64 4,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00
dm-6 0,02 0,09 0,00 0,00 4,94 4,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00
dm-7 0,00 0,09 0,00 0,00 6,85 21,75 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00 0,00
dm-8 36,13 1454,39 0,00 0,00 46,74 40,25 528,37 2107,50 0,00 0,00 122,58 3,99 0,00 0,00 0,00 0,00 0,00 0,00 66,46 12,66
dm-9 7,63 82,77 0,00 0,00 84,49 10,85 22,74 213,86 0,00 0,00 1578,74 9,40 0,00 0,00 0,00 0,00 0,00 0,00 36,55 3,18
nvme0n1 4,49 176,13 5,82 56,45 0,19 39,26 101,54 445,00 0,07 0,07 0,95 4,38 0,00 0,00 0,00 0,00 0,00 0,00 0,07 0,38
sda 41,89 1547,29 4,19 9,10 46,21 36,93 41,60 2317,08 509,51 92,45 158,29 55,70 0,00 0,00 0,00 0,00 0,00 0,00 8,40 15,35
dm-8 es Windows LV y dm-9 es mi disco de casa. Entonces, por alguna razón, parece que los datos están en cola para ambas unidades. La velocidad de escritura no es muy rápida mientras el sistema es lento, alrededor de 1-5 MB/s como máximo, lo cual es muy lento para la unidad que tengo en el sistema.
El uso de CPU es muy bajo mientras la VM se está ejecutando (tanto dentro de la VM usando el monitor de recursos como en el host). Por lo general, es sólo alrededor del 10%.
Estoy usando Virtio como adaptador de almacenamiento y ya probé diferentes configuraciones (subprocesos, almacenamiento en caché, etc.), pero nada parece cambiar este problema.
¿Existe alguna otra configuración que pueda probar para obtener un mejor acceso al disco?
EDITAR:
Aquí está el resultado de smartctl -a /dev/sda
:
smartctl 7.0 2018-12-30 r4883 [x86_64-linux-5.4.48-gentoo-20200819] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate FireCuda 2.5
Device Model: ST2000LX001-1RG174
Serial Number: ZDZ9N2W8
LU WWN Device Id: 5 000c50 0c4905536
Firmware Version: SDM1
User Capacity: 2.000.398.934.016 bytes [2,00 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: 5400 rpm
Form Factor: 2.5 inches
Device is: In smartctl database [for details use: -P show]
ATA Version is: ACS-3 T13/2161-D revision 3b
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Tue Sep 1 10:07:55 2020 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: ( 0) seconds.
Offline data collection
capabilities: (0x71) SMART execute Offline immediate.
No Auto Offline data collection support.
Suspend Offline collection upon new
command.
No Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 328) minutes.
Conveyance self-test routine
recommended polling time: ( 2) minutes.
SCT capabilities: (0x3035) SCT Status supported.
SCT Feature Control supported.
SCT Data Table supported.
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 078 064 006 Pre-fail Always - 66205122
3 Spin_Up_Time 0x0003 099 099 000 Pre-fail Always - 0
4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 161
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 075 060 045 Pre-fail Always - 29488074
9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 527 (193 175 0)
10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always - 151
184 End-to-End_Error 0x0032 100 100 099 Old_age Always - 0
187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
188 Command_Timeout 0x0032 100 099 000 Old_age Always - 4
189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0022 058 048 040 Old_age Always - 42 (Min/Max 22/43)
191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 1
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 22
193 Load_Cycle_Count 0x0032 100 100 000 Old_age Always - 1116
194 Temperature_Celsius 0x0022 042 052 000 Old_age Always - 42 (0 19 0 0 0)
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 523h+48m+09.290s
241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 2770583284
242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 713825407
254 Free_Fall_Sensor 0x0032 100 100 000 Old_age Always - 0
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 523 -
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.