我遇到了一个问题,当我向 SSD 磁盘写入数据时,Ubuntu(目前是 17.10,但这个问题已经存在了好几个版本)会冻结,我需要查明这是软件问题还是我的 SSD 坏了。我在华硕 UX31E 笔记本电脑上运行 Ubuntu。我使用的是全盘加密(使用安装程序自动配置)。
我已经像这样测试了读取速度:
$ sudo hdparm -Tt /dev/mapper/sda5_crypt
/dev/mapper/sda5_crypt:
Timing cached reads: 9228 MB in 2.00 seconds = 4618.04 MB/sec
Timing buffered disk reads: 1190 MB in 3.00 seconds = 396.46 MB/sec
对我来说这看起来像是一个不错的数字,让我们尝试写入磁盘:
$ LC_ALL=C dd if=/dev/zero of=~/out.bin bs=100M count=1
1+0 records in
1+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 16.882 s, 6.2 MB/s
哇,这真的很慢。尽管它是一个加密分区(512 位 aes-xts-plain64),但不应该花这么长时间,对吧?写入磁盘时我无法执行任何操作,它变得完全没有响应。我甚至无法移动鼠标指针。
我正在使用截止期限调度程序:
$ cat /sys/block/sda/queue/scheduler
noop [deadline] cfq
我想验证这是否是硬件问题,这样我就不会浪费钱购买新的 SSD。如何确定无响应的根本原因?
编辑1:
smartctl 输出:
[...]
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0002 100 100 000 Old_age Always - 0
9 Power_On_Hours 0x0002 100 100 000 Old_age Always - 6160
12 Power_Cycle_Count 0x0002 100 100 000 Old_age Always - 4420
171 Program_Fail_Count 0x0002 100 100 000 Old_age Always - 0
172 Erase_Fail_Count 0x0002 100 100 000 Old_age Always - 0
173 Avg_Write/Erase_Count 0x0002 100 100 000 Old_age Always - 84
174 Unexpect_Power_Loss_Ct 0x0002 100 100 000 Old_age Always - 4379
187 Reported_Uncorrect 0x0002 100 100 000 Old_age Always - 0
230 Perc_Write/Erase_Count 0x0002 100 100 000 Old_age Always - 280
232 Perc_Avail_Resrvd_Space 0x0003 100 100 005 Pre-fail Always - 0
234 Perc_Write/Erase_Ct_BC 0x0002 100 100 000 Old_age Always - 436
241 Total_LBAs_Written 0x0002 100 100 000 Old_age Always - 10526182882
242 Total_LBAs_Read 0x0002 100 100 000 Old_age Always - 9359492632
[...]
Warning! SMART Self-Test Log Structure error: invalid SMART checksum.
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Interrupted (host reset) 70% 64397 -
# 2 Short offline Interrupted (host reset) 50% 18010 -
# 3 Short offline Interrupted (host reset) 70% 31469 -
# 4 Short offline Interrupted (host reset) 60% 26654 -
# 5 Short offline Interrupted (host reset) 70% 10910 -
# 6 Short offline Interrupted (host reset) 70% 58379 -
我还尝试强制进行自检(多次),方法是从实时 CD 启动并运行smartctl -t short -C /dev/sda
,等待时间明显长于指定时间。但是,当我尝试查看结果时,我无法:
$ smartctl -a /dev/sda
[...]
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options*
[...]