ard*_*new 8 linux performance ssd hard-drive linux-mint
我最近在包含 2 个 SanDisk SSD 的全新 PC 上安装了 Linux Mint 18.2。安装完成,没有错误。
在这台新 PC 上设置了所有所需的软件后,我注意到磁盘的性能非常慢——尤其是写入速度。例如,平均dd
显示大约3.5MB/s:
$ dd bs=1M count=256 if=/dev/zero of=test conv=fdatasync
256+0 records in
256+0 records out
268435456 bytes (268 MB, 256 MiB) copied, 61.9192 s, 4.3 MB/s
$ dd bs=1M count=256 if=/dev/urandom of=test conv=fdatasync
256+0 records in
256+0 records out
268435456 bytes (268 MB, 256 MiB) copied, 86.7794 s, 3.1 MB/s
Run Code Online (Sandbox Code Playgroud)
我不知道从哪里开始寻找诊断或解决这个问题。它使这台原本非常快的 PC 几乎无法使用。
安装文件系统EXT4是,并安装有选择noatime,errors=remount-ro
在/etc/fstab
。
我试过降低/禁用高级电源管理 ( hdparm -B 254 /dev/sda
) 并且我还在根 fs ( fstrim /
)上手动运行 TRIM 。这些似乎都没有任何区别。
我非常有信心将 25MiB 文件复制到与原始文件本身相同的磁盘和分区上不会花费 15 秒:
$ stat test
File: 'test'
Size: 26214400 Blocks: 51200 IO Block: 4096 regular file
Device: 801h/2049d Inode: 10880436 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ aps) Gid: ( 1000/ aps)
Access: 2017-10-14 15:48:24.460658106 -0500
Modify: 2017-10-14 15:37:22.577357279 -0500
Change: 2017-10-14 15:37:22.577357279 -0500
Birth: -
$ \time -v cp test test.out
Command being timed: "cp test test.out"
User time (seconds): 0.03
System time (seconds): 0.00
Percent of CPU this job got: 0%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:14.36
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 2188
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 134
Voluntary context switches: 1452
Involuntary context switches: 1
Swaps: 0
File system inputs: 0
File system outputs: 51200
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
Run Code Online (Sandbox Code Playgroud)
hdparm
显示以下详细信息:
$ sudo hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
Model Number: SanDisk SD8TB8U512G1001
Serial Number: 165125801567
Firmware Revision: X4133101
Media Serial Num:
Media Manufacturer:
Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
Used: unknown (minor revision code 0x0110)
Supported: 9 8 7 6 5
Likely used: 9
Configuration:
Logical max current
cylinders 16383 0
heads 16 0
sectors/track 63 0
--
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 1000215216
Logical Sector size: 512 bytes
Physical Sector size: 512 bytes
Logical Sector-0 offset: 0 bytes
device size with M = 1024*1024: 488386 MBytes
device size with M = 1000*1000: 512110 MBytes (512 GB)
cache/buffer size = unknown
Form Factor: 2.5 inch
Nominal Media Rotation Rate: Solid State Device
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec'd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 1 Current = 1
Advanced power management level: 254
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* WRITE_BUFFER command
* READ_BUFFER command
* DOWNLOAD_MICROCODE
* Advanced Power Management feature set
SET_MAX security extension
* 48-bit Address feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
* General Purpose Logging feature set
* 64-bit World wide name
* WRITE_UNCORRECTABLE_EXT command
* {READ,WRITE}_DMA_EXT_GPL commands
* Segmented DOWNLOAD_MICROCODE
unknown 119[8]
* Gen1 signaling speed (1.5Gb/s)
* Gen2 signaling speed (3.0Gb/s)
* Gen3 signaling speed (6.0Gb/s)
* Native Command Queueing (NCQ)
* Phy event counters
* READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
* DMA Setup Auto-Activate optimization
Device-initiated interface power management
* Software settings preservation
Device Sleep (DEVSLP)
* reserved 69[4]
* DOWNLOAD MICROCODE DMA command
* WRITE BUFFER DMA command
* READ BUFFER DMA command
* Data Set Management TRIM supported (limit 8 blocks)
* Deterministic read ZEROs after TRIM
Security:
Master password revision code = 1
supported
not enabled
not locked
frozen
not expired: security count
supported: enhanced erase
2min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5001b448b48ce759
NAA : 5
IEEE OUI : 001b44
Unique ID : 8b48ce759
Device Sleep:
DEVSLP Exit Timeout (DETO): 30 ms (drive)
Minimum DEVSLP Assertion Time (MDAT): 30 ms (drive)
Checksum: correct
Run Code Online (Sandbox Code Playgroud)
安装在 PC 中的第二个 SSD 当前未格式化。是否有可能以解决此问题的方式准备其他磁盘,同时保留复制到其上的当前 Mint 的用户空间安装/配置?必须重新安装在这个慢速磁盘上设置的所有软件将是一场噩梦。
编辑
系统规格来自inxi
:
$ inxi -Fz
System: Host: dapadev Kernel: 4.8.0-53-generic i686 (32 bit) Desktop: Cinnamon 3.4.3
Distro: Linux Mint 18.2 Sonya
Machine: System: LENOVO product: 30B7000YUS v: ThinkStation P710
Mobo: LENOVO model: 1030 v: SBB0J05441 WIN 3305058809791 Bios: LENOVO v: S01KT40A date: 05/04/2017
CPU: Octa core Intel Xeon E5-2620 v4 (-HT-MCP-) cache: 20480 KB
clock speeds: max: 3000 MHz 1: 2099 MHz 2: 2100 MHz 3: 2120 MHz 4: 2100 MHz 5: 2099 MHz 6: 2100 MHz
7: 2299 MHz 8: 2100 MHz
Graphics: Card: NVIDIA GK107GL [Quadro K420]
Display Server: X.Org 1.18.4 drivers: nvidia (unloaded: fbdev,vesa,nouveau)
Resolution: 1680x1050@59.95hz
GLX Renderer: Quadro K420/PCIe/SSE2 GLX Version: 4.5.0 NVIDIA 375.66
Audio: Card-1 NVIDIA GK107 HDMI Audio Controller driver: snd_hda_intel Sound: ALSA v: k4.8.0-53-generic
Card-2 Intel C610/X99 series HD Audio Controller driver: snd_hda_intel
Network: Card-1: Intel Ethernet Connection (2) I218-LM driver: e1000e
IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Card-2: Intel I210 Gigabit Network Connection driver: igb
IF: eth1 state: down mac: <filter>
Card-3: Intel I210 Gigabit Network Connection driver: igb
IF: eth2 state: up speed: 100 Mbps duplex: full mac: <filter>
Drives: HDD Total Size: 2024.4GB (2.1% used) ID-1: /dev/sda model: SanDisk_SD8TB8U5 size: 512.1GB
ID-2: /dev/sdb model: SanDisk_SD8TB8U5 size: 512.1GB ID-3: /dev/sdc model: ST1000DM003 size: 1000.2GB
Partition: ID-1: / size: 438G used: 8.9G (3%) fs: ext4 dev: /dev/sda1
ID-2: swap-1 size: 34.24GB used: 0.00GB (0%) fs: swap dev: /dev/sda5
RAID: No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors: System Temperatures: cpu: 43.0C mobo: N/A gpu: 53C
Fan Speeds (in rpm): cpu: N/A
Info: Processes: 275 Uptime: 3 days Memory: 1887.9/32323.8MB Client: Shell (bash) inxi: 2.2.35
Run Code Online (Sandbox Code Playgroud)
驱动器详细信息来自lsblk
:
$ lsblk -Sfalt
NAME HCTL TYPE VENDOR MODEL REV TRAN NAME FSTYPE LABEL UUID MOUNTPOINT NAME ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE RA WSAME
sdb 3:0:0:0 disk ATA SanDisk SD8TB8U5 3101 sata sdb sdb 0 512 0 512 512 0 deadline 128 128 0B
sr0 6:0:0:0 rom PLDS DVD-RW DH16AFSH DL3M sata sr0 sr0 0 512 0 512 512 1 deadline 128 128 0B
sdc 4:0:0:0 disk ATA ST1000DM003-1SB1 CC62 sata sdc sdc 0 4096 0 4096 512 1 deadline 128 128 0B
sda 2:0:0:0 disk ATA SanDisk SD8TB8U5 3101 sata sda sda 0 512 0 512 512 0 deadline 128 128 0B
Run Code Online (Sandbox Code Playgroud)
驱动器详细信息来自smartctl
:
$ sudo smartctl -a /dev/sda
smartctl 6.5 2016-01-24 r4214 [i686-linux-4.8.0-53-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: SanDisk SD8TB8U512G1001
Serial Number: 165125801567
LU WWN Device Id: 5 001b44 8b48ce759
Firmware Version: X4133101
User Capacity: 512,110,190,592 bytes [512 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-2 T13/2015-D revision 3
SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Sat Oct 14 16:05:13 2017 CDT
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: ( 16) The self-test routine was aborted by
the host.
Total time to complete Offline
data collection: ( 0) seconds.
Offline data collection
capabilities: (0x11) SMART execute Offline immediate.
No Auto Offline data collection support.
Suspend Offline collection upon new
command.
No Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
No 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: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 10) minutes.
SMART Attributes Data Structure revision number: 4
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0032 100 100 --- Old_age Always - 0
9 Power_On_Hours 0x0032 100 100 --- Old_age Always - 519
12 Power_Cycle_Count 0x0032 100 100 --- Old_age Always - 309
170 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0
171 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0
172 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0
173 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 0
174 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 48
178 Used_Rsvd_Blk_Cnt_Chip 0x0032 100 100 --- Old_age Always - 0
180 Unused_Rsvd_Blk_Cnt_Tot 0x0033 100 100 010 Pre-fail Always - 100
184 End-to-End_Error 0x0033 100 100 097 Pre-fail Always - 0
187 Reported_Uncorrect 0x0032 100 100 --- Old_age Always - 0
194 Temperature_Celsius 0x0022 068 033 --- Old_age Always - 32 (Min/Max 23/33)
199 UDMA_CRC_Error_Count 0x0032 100 100 --- Old_age Always - 0
233 Media_Wearout_Indicator 0x0033 100 100 001 Pre-fail Always - 16772743
234 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 90
241 Total_LBAs_Written 0x0030 253 253 --- Old_age Offline - 101
242 Total_LBAs_Read 0x0030 253 253 --- Old_age Offline - 13
249 Unknown_Attribute 0x0032 100 100 --- Old_age Always - 40
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 Aborted by host 00% 519 -
Selective Self-tests/Logging not supported
Run Code Online (Sandbox Code Playgroud)
与其说是问题的正确解决,不如说是一种变通办法——用 Linux Mint 18.2 64 位替换 Linux Mint 18.2 32 位,永久解决了写入速度极慢的问题。
有兴趣了解更多详情吗?唉,亲爱的读者,请继续阅读!
我们需要使用特定的 32 位编译器工具链。有了这个,我认为最好安装 32 位操作系统,我选择了 Linux Mint Cinnamon(内核 4.8),因为它给我的印象是,对于我们一些不太熟悉的开发人员来说,它是一个更适合桌面的发行版。 Linux。
启动后立即写入> 200 MiB/秒;大约一小时后,恢复到 < 5 MiB/秒。
在运行 Manjaro Linux 32 位(内核 4.9 LTS,以及一些 4.10)时观察到完全相同的行为。
所以我尝试安装 Linux Mint 64 位(同样是 4.8 内核)。现在,磁盘写入开始快速并保持快速;根本没有磁盘问题。我立即意识到这是一个内核错误,是 SSD 驱动程序之一,专门针对 32 位环境。
幸运的是,apt
有一个元包ia32-libs
可以安装一组可靠的 x86 库,结果几乎足以运行我们的 32 位编译器工具链——只需手动安装一个额外的库。