我有一块 sata ssd,当我在 windows(双启动)上使用时,正如广告宣传的那样,读写性能约为 500MB/s,但另一方面,当我在 ubuntu(20.4-20.10)下使用它时,写入性能略低于 100MB/s,读取性能虽然还可以。所以,我想这也许是 IO 调度程序的魔力。因此,我决定更改它,即使在为 sda 创建了 udev 规则并使用 IO 调度程序属性“none”(也尝试了 kyber,mq-deadline 是默认值)后,也没有任何改善。因此,为了深入研究问题,我使用dd
监控iotop
来找出实际发生的情况,我发现完全出乎意料。它确实只在很短的时间内上升到 500MB/s 左右,但它从未超过 100 MB/s,甚至有时它只是低于 20 MB/s。是的,APM 被禁用了(255)。现在我不知道该怎么做才能提高SSD的性能。
以下是一些信息:
$ sudo hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
Model Number: TS240GSSD220S
Serial Number: F528440890
Firmware Revision: R0510A0
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 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 468862128
Logical Sector size: 512 bytes
Physical Sector size: 512 bytes
Logical Sector-0 offset: 0 bytes
device size with M = 1024*1024: 228936 MBytes
device size with M = 1000*1000: 240057 MBytes (240 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: disabled
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
* Host Protected Area feature set
* 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
* WRITE_{DMA|MULTIPLE}_FUA_EXT
* 64-bit World wide name
* {READ,WRITE}_DMA_EXT_GPL commands
* Segmented DOWNLOAD_MICROCODE
* 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)
* SANITIZE feature set
* BLOCK_ERASE_EXT command
* DOWNLOAD MICROCODE DMA command
* WRITE BUFFER DMA command
* READ BUFFER DMA command
* Data Set Management TRIM supported (limit 8 blocks)
* Deterministic read data after TRIM
Security:
Master password revision code = 65534
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: 57c3548185201a3a
NAA : 5
IEEE OUI : 7c3548
Unique ID : 185201a3a
Device Sleep:
DEVSLP Exit Timeout (DETO): 90 ms (drive)
Minimum DEVSLP Assertion Time (MDAT): 26 ms (drive)
Checksum: correct
英希-Fxz
$ inxi -Fxz
System:
Kernel: 5.8.0-26-generic x86_64 bits: 64 compiler: gcc v: 10.2.0 Desktop: N/A
Distro: Ubuntu 20.10 (Groovy Gorilla)
Machine:
Type: Desktop Mobo: Micro-Star model: X470 GAMING PLUS MAX (MS-7B79) v: 3.0
serial: <filter> UEFI: American Megatrends v: H.60 date: 06/11/2020
CPU:
Info: 6-Core model: AMD Ryzen 5 3600 bits: 64 type: MT MCP arch: Zen 2
L2 cache: 3072 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
bogomips: 86399
Speed: 3602 MHz min/max: N/A Core speeds (MHz): 1: 3602 2: 3596 3: 3600 4: 3567
5: 3520 6: 3498 7: 3585 8: 3587 9: 3614 10: 3613 11: 3844 12: 3498
Graphics:
Device-1: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
vendor: Sapphire Limited driver: amdgpu v: kernel bus ID: 27:00.0
Display: x11 server: X.Org 1.20.9 driver: amdgpu,ati
unloaded: fbdev,modesetting,vesa resolution: 1366x768~60Hz
OpenGL:
renderer: Radeon RX 570 Series (POLARIS10 DRM 3.38.0 5.8.0-26-generic LLVM 11.0.0)
v: 4.6 Mesa 20.2.1 direct render: Yes
Audio:
Device-1: AMD Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590]
vendor: Sapphire Limited driver: snd_hda_intel v: kernel bus ID: 27:00.1
Device-2: AMD Starship/Matisse HD Audio vendor: Micro-Star MSI driver: snd_hda_intel
v: kernel bus ID: 29:00.4
Sound Server: ALSA v: k5.8.0-26-generic
Network:
Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: Micro-Star MSI driver: r8169 v: kernel port: f000 bus ID: 22:00.0
IF: enp34s0 state: up speed: 100 Mbps duplex: full mac: <filter>
Drives:
Local Storage: total: 1.13 TiB used: 156.29 GiB (13.5%)
ID-1: /dev/sda vendor: Transcend model: TS240GSSD220S size: 223.57 GiB temp: 51 C
ID-2: /dev/sdb vendor: Toshiba model: HDWD110 size: 931.51 GiB temp: 38 C
Partition:
ID-1: / size: 188.22 GiB used: 51.75 GiB (27.5%) fs: ext4 dev: /dev/sda5
Swap:
ID-1: swap-1 type: file size: 16.00 GiB used: 0 KiB (0.0%) file: /swapfile
更新:我让它不再冻结。hdparm -I
之后运行只发现一个不同,即 APM 功能集前现在有一个星号 (*)。但我不知道这是什么意思
答案1
您是否修剪过分区?我认为 Windows 会自动执行此操作,但在 Ubuntu 中,您必须自己执行此操作(也可以自动执行,搜索后您就会找到方法)。
sudo fstrim -v /
这将修剪安装在/