两个月前我买了一个 samsung 840 pro 250 GB ssd,我想知道已经写入了多少。实际上,我有四个分区:/、/home、boot 和 swap。为了弄清楚给家里写了多少,我写了
$cat /sys/fs/ext4/sda7/lifetime_write_kbytes
输出是8,985,606,440(我添加了逗号)。所以这是8TB。我在想,孩子,我一定写了很多。我想知道如何?我通过浏览互联网和其他常见任务监控我写了多少,然后我记得我设置了一个每日 cron 来做 fstrim,因为互联网告诉我。所以我跑了
$sudo fstrim -v /home
并且输出是606,591,360字节被修剪。
然后我跑了
$cat /sys/fs/ext4/sda7/lifetime_write_kbytes
再一次,果然我明白了8,986,209,516。所以我的写入增加了 600MB。现在这还不足以说明 8TB 的写入,但我刚刚在几分钟前运行了 fstrim,所以我认为 fstrim 通常会修剪超过 600 MB。我将不得不确认这一点。
无论如何,由 fstrim 引起的写入实际上会减少 SSD 的使用寿命吗?我的印象是他们没有。
我不必猜测 cron 作业通常会修剪多少。事实证明,互联网告诉我要记录 fstrim 的输出。查看日志,我看到它自 8 月 24 日以来平均减少了约 150 GB/天,150 GB/天 * 60 天约为 9 TB。所以我认为 fstrim 确实占了我对 SSD 的 9TB 写入。
SSD 上未启用 smart,但我运行了$sudo smartctl -s on /dev/sda7. 然后我跑了$sudo smartctl -a /dev/sda7。这是输出:
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-3.8.0-25-generic] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Device Model: Samsung SSD 840 PRO Series
Serial Number: S1ATNSAD780426K
LU WWN Device Id: 5 002538 5a00ae961
Firmware Version: DXM05B0Q
User Capacity: 256,060,514,304 bytes [256 GB]
Sector Size: 512 bytes logical/physical
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 8
ATA Standard is: ATA-8-ACS revision 4c
Local Time is: Wed Oct 30 09:43:18 2013 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: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (53956) seconds.
Offline data collection
capabilities: (0x53) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
No Offline surface scan supported.
Self-test supported.
No 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: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 20) minutes.
SCT capabilities: (0x003d) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.
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 0x0033 100 100 010 Pre-fail Always - 0
9 Power_On_Hours 0x0032 099 099 000 Old_age Always - 458
12 Power_Cycle_Count 0x0032 099 099 000 Old_age Always - 28
177 Wear_Leveling_Count 0x0013 099 099 000 Pre-fail Always - 2
179 Used_Rsvd_Blk_Cnt_Tot 0x0013 100 100 010 Pre-fail Always - 0
181 Program_Fail_Cnt_Total 0x0032 100 100 010 Old_age Always - 0
182 Erase_Fail_Count_Total 0x0032 100 100 010 Old_age Always - 0
183 Runtime_Bad_Block 0x0013 100 100 010 Pre-fail Always - 0
187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0032 072 068 000 Old_age Always - 28
195 Hardware_ECC_Recovered 0x001a 200 200 000 Old_age Always - 0
199 UDMA_CRC_Error_Count 0x003e 100 100 000 Old_age Always - 0
235 Unknown_Attribute 0x0012 001 001 000 Old_age Always - 4294967148
241 Total_LBAs_Written 0x0032 099 099 000 Old_age Always - 748699270
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 1
No self-tests have been logged. [To run self-tests, use: smartctl -t]
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
255 0 65535 Read_scanning was never started
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.
Run Code Online (Sandbox Code Playgroud)
fstrim 不会磨损您的 ssd;相反,它增加了它的寿命。life_write_kbytes 中报告的写入是指更高抽象级别的文件系统写入,不一定对应于对驱动器的物理写入。因此,尽管lifetime_write_kbytes 中报告了40 TB 的写入,但运行$sudo smartctl -s on /dev/sda7后跟 $sudo smartctl -a /dev/sda7显示我只写入了750,000,000 个512 字节的块,结果为375GB,这是两个月使用的更合理值。
| 归档时间: |
|
| 查看次数: |
3643 次 |
| 最近记录: |