当前位置: 首页 > article >正文

20241225在ubuntu22.04.5下使用smartmontools命令查看ssd的寿命

20241225在ubuntu22.04.5下使用smartmontools命令查看ssd的寿命
2024/12/25 15:10


rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo apt install smartmontools
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo fdisk -l
Disk /dev/nvme0n1: 3.73 TiB, 4096805658624 bytes, 8001573552 sectors
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo smartctl -l devstat /dev/nvme0n1 -a
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ smartctl -version
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo hdparm -I /dev/nvme0n1


rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo apt install smartmontools
[sudo] password for rootroot: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi libaacs0 libass9 libavformat58 libbdplus0 libblas3 libbluray2 libbs2b0 libchromaprint1 libflashrom1 libflite1 libftdi1-2 libgme0
  libgstreamer-plugins-bad1.0-0 liblilv-0-0 libllvm13 libmysofa1 libnorm1 libopenmpt0 libpgm-5.3-0 libpostproc55 librabbitmq4 librubberband2 libserd-0-0 libsord-0-0 libsratom-0-0 libsrt1.4-gnutls
  libssh-gcrypt-4 libswscale5 libudfread0 libva-wayland2 libvidstab1.1 libzimg2 libzmq5 pocketsphinx-en-us
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  gsmartcontrol smart-notifier mailx | mailutils
The following NEW packages will be installed:
  smartmontools
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 583 kB of archives.
After this operation, 1,980 kB of additional disk space will be used.
0% [Working]y
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 smartmontools amd64 7.2-1ubuntu0.1 [583 kB]
Fetched 583 kB in 21s (27.3 kB/s)              
Selecting previously unselected package smartmontools.
(Reading database ... 218828 files and directories currently installed.)
Preparing to unpack .../smartmontools_7.2-1ubuntu0.1_amd64.deb ...
Unpacking smartmontools (7.2-1ubuntu0.1) ...
Setting up smartmontools (7.2-1ubuntu0.1) ...
Created symlink /etc/systemd/system/smartd.service → /lib/systemd/system/smartmontools.service.
Created symlink /etc/systemd/system/multi-user.target.wants/smartmontools.service → /lib/systemd/system/smartmontools.service.
Processing triggers for man-db (2.10.2-1) ...
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 

rootroot@rootroot-ThinkBook-16-G5-IRH:~$ cat /etc/issue
Ubuntu 22.04.5 LTS \n \l

rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ uname -a
Linux rootroot-ThinkBook-16-G5-IRH 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov  6 17:42:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 


参考资料:
百度:ubuntu查看ssd寿命


https://www.sysgeek.cn/check-ssd-health-in-linux/
5 种简单方法,在 Linux 中检查 SSD 健康状态
发布日期:2023-11-15 分类:Linux 阅读(12786) 评论(0) 赞(1)


https://blog.csdn.net/zhzgbf/article/details/128868847
linux 查看 SSD 固态硬盘 使用寿命

linux 下面只有 smartmontools 这一个工具,并且只对像三星和 intel 这样的大厂支持良好,其它品牌可能会出现无法获取数据的情况

安装 smartmontools

apt install smartmontools -y   # ubuntu 系统命令
yum install -y smartmontools   # centos 系统命令
使用以下命令查看SSD硬盘输出( /dev/sdb 是需要查看的SSD固态硬盘),其中最后一个最重要和直观 “ Percentage Used Endurance Indicator ” ,单位是百分比,新的是 0%,我现在的是 1%。

smartctl -l devstat /dev/sdb


详细的LOG:
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo apt install smartmontools
[sudo] password for rootroot: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi libaacs0 libass9 libavformat58 libbdplus0 libblas3 libbluray2 libbs2b0 libchromaprint1 libflashrom1 libflite1 libftdi1-2 libgme0
  libgstreamer-plugins-bad1.0-0 liblilv-0-0 libllvm13 libmysofa1 libnorm1 libopenmpt0 libpgm-5.3-0 libpostproc55 librabbitmq4 librubberband2 libserd-0-0 libsord-0-0 libsratom-0-0 libsrt1.4-gnutls
  libssh-gcrypt-4 libswscale5 libudfread0 libva-wayland2 libvidstab1.1 libzimg2 libzmq5 pocketsphinx-en-us
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  gsmartcontrol smart-notifier mailx | mailutils
The following NEW packages will be installed:
  smartmontools
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 583 kB of archives.
After this operation, 1,980 kB of additional disk space will be used.
0% [Working]y
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 smartmontools amd64 7.2-1ubuntu0.1 [583 kB]
Fetched 583 kB in 21s (27.3 kB/s)              
Selecting previously unselected package smartmontools.
(Reading database ... 218828 files and directories currently installed.)
Preparing to unpack .../smartmontools_7.2-1ubuntu0.1_amd64.deb ...
Unpacking smartmontools (7.2-1ubuntu0.1) ...
Setting up smartmontools (7.2-1ubuntu0.1) ...
Created symlink /etc/systemd/system/smartd.service → /lib/systemd/system/smartmontools.service.
Created symlink /etc/systemd/system/multi-user.target.wants/smartmontools.service → /lib/systemd/system/smartmontools.service.
Processing triggers for man-db (2.10.2-1) ...
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 

rootroot@rootroot-ThinkBook-16-G5-IRH:~$ cat /etc/issue
Ubuntu 22.04.5 LTS \n \l

rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ uname -a
Linux rootroot-ThinkBook-16-G5-IRH 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov  6 17:42:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo fdisk -l
Disk /dev/loop0: 61.89 MiB, 64901120 bytes, 126760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 4 KiB, 4096 bytes, 8 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 63.7 MiB, 66789376 bytes, 130448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 73.87 MiB, 77459456 bytes, 151288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 155.63 MiB, 163188736 bytes, 318728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop5: 349.7 MiB, 366682112 bytes, 716176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop6: 248.76 MiB, 260841472 bytes, 509456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop7: 505.09 MiB, 529625088 bytes, 1034424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/nvme0n1: 3.73 TiB, 4096805658624 bytes, 8001573552 sectors
Disk model: Lexar SSD ARES 4TB                      
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: B13A60C4-1CCC-4222-9F95-76DFC122ED97

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048     206847     204800   100M EFI System
/dev/nvme0n1p2     206848     239615      32768    16M Microsoft reserved
/dev/nvme0n1p3     239616  875161852  874922237 417.2G Microsoft basic data
/dev/nvme0n1p4  875163648 2017761279 1142597632 544.8G Microsoft basic data
/dev/nvme0n1p5 8000360448 8001570815    1210368   591M Windows recovery environment
/dev/nvme0n1p6 2017761280 2018719743     958464   468M Linux filesystem
/dev/nvme0n1p7 2018719744 2049970175   31250432  14.9G Linux swap
/dev/nvme0n1p8 2049970176 7863642111 5813671936   2.7T Linux filesystem
/dev/nvme0n1p9 7863642112 8000360447  136718336  65.2G Linux filesystem

Partition table entries are not in disk order.


Disk /dev/loop8: 81.26 MiB, 85209088 bytes, 166424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop9: 91.69 MiB, 96141312 bytes, 187776 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop10: 45.86 MiB, 48087040 bytes, 93920 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop11: 44.3 MiB, 46448640 bytes, 90720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop12: 284 KiB, 290816 bytes, 568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop13: 568 KiB, 581632 bytes, 1136 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop14: 12.2 MiB, 12791808 bytes, 24984 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 

rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ smartctl -l devstat /dev/nvme0n1
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.8.0-49-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

Smartctl open device: /dev/nvme0n1 failed: Permission denied
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo smartctl -l devstat /dev/nvme0n1
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.8.0-49-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

NVMe device successfully opened

Use 'smartctl -a' (or '-x') to print SMART (and more) information

rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo smartctl -l devstat /dev/nvme0n1 -a
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.8.0-49-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       Lexar SSD ARES 4TB
Serial Number:                      PB1602R001379P2202
Firmware Version:                   12237
PCI Vendor/Subsystem ID:            0x1d97
IEEE OUI Identifier:                0xcaf25b
Total NVM Capacity:                 4,096,805,658,624 [4.09 TB]
Unallocated NVM Capacity:           0
Controller ID:                      0
NVMe Version:                       2.0
Number of Namespaces:               1
Namespace 1 Size/Capacity:          4,096,805,658,624 [4.09 TB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            caf25b 035e0001a4
Local Time is:                      Wed Dec 25 15:14:23 2024 CST
Firmware Updates (0x14):            2 Slots, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x005f):     Comp Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
Log Page Attributes (0x0a):         Cmd_Eff_Lg Telmtry_Lg
Maximum Data Transfer Size:         128 Pages
Warning  Comp. Temp. Threshold:     90 Celsius
Critical Comp. Temp. Threshold:     95 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     6.50W       -        -    0  0  0  0        0       0
 1 +     5.80W       -        -    1  1  1  1        0       0
 2 +     3.60W       -        -    2  2  2  2        0       0
 3 -   0.0500W       -        -    3  3  3  3     5000   10000
 4 -   0.0025W       -        -    4  4  4  4     8000   41000

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        34 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%

Percentage Used:                    0%
Data Units Read:                    3,045,211 [1.55 TB]
Data Units Written:                 3,637,083 [1.86 TB]

Host Read Commands:                 23,836,528
Host Write Commands:                19,141,439
Controller Busy Time:               19
Power Cycles:                       12
Power On Hours:                     12
Unsafe Shutdowns:                   3
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               34 Celsius
Temperature Sensor 2:               28 Celsius

Error Information (NVMe Log 0x01, 16 of 64 entries)
No Errors Logged

rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ smartctl -version
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.8.0-49-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=======> INVALID ARGUMENT TO -v: ersion
=======> VALID ARGUMENTS ARE:
    help
    N,raw8[:012345rvwz][,ATTR_NAME]
    N,raw16[:012345rvwz][,ATTR_NAME]
    N,raw48[:012345rvwz][,ATTR_NAME]
    N,hex48[:012345rvwz][,ATTR_NAME]
    N,raw56[:012345rvwz][,ATTR_NAME]
    N,hex56[:012345rvwz][,ATTR_NAME]
    N,raw64[:012345rvwz][,ATTR_NAME]
    N,hex64[:012345rvwz][,ATTR_NAME]
    N,raw16(raw16)[:012345rvwz][,ATTR_NAME]
    N,raw16(avg16)[:012345rvwz][,ATTR_NAME]
    N,raw24(raw8)[:012345rvwz][,ATTR_NAME]
    N,raw24/raw24[:012345rvwz][,ATTR_NAME]
    N,raw24/raw32[:012345rvwz][,ATTR_NAME]
    N,sec2hour[:012345rvwz][,ATTR_NAME]
    N,min2hour[:012345rvwz][,ATTR_NAME]
    N,halfmin2hour[:012345rvwz][,ATTR_NAME]
    N,msec24hour32[:012345rvwz][,ATTR_NAME]
    N,tempminmax[:012345rvwz][,ATTR_NAME]
    N,temp10x[:012345rvwz][,ATTR_NAME]
    9,halfminutes
    9,minutes
    9,seconds
    9,temp
    192,emergencyretractcyclect
    193,loadunload
    194,10xCelsius
    194,unknown
    197,increasing
    198,offlinescanuncsectorct
    198,increasing
    200,writeerrorcount
    201,detectedtacount
    220,temp
<=======

Use smartctl -h to get a usage summary

rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ sudo hdparm -I /dev/nvme0n1
[sudo] password for rootroot: 

/dev/nvme0n1:
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 


fdisk


http://www.kler.cn/a/452277.html

相关文章:

  • 赛博错题本
  • LSTM-SVM时序预测 | Matlab基于LSTM-SVM基于长短期记忆神经网络-支持向量机时间序列预测
  • 基于earthSDK三维地图组件开发
  • 《Cocos Creator游戏实战》非固定摇杆实现原理
  • TGRS | 可变形傅里叶卷积用于遥感道路分割
  • CentOS Stream 9 挂载Windows共享FTP文件夹
  • Diffusers使用笔记
  • 2024年河北省职业院校技能大赛云计算应用赛项赛题第2套(容器云)
  • 从tryLock()源码来出发,解析Redisson的重试机制和看门狗机制
  • 2024年OpenTiny年度人气贡献者评选正式开始
  • MFC用List Control 和Picture控件实现界面切换效果
  • leetcode hot100 翻转二叉树
  • golang实现yaml配置文件的解析
  • DVWA靶场第三关 CSRF
  • 【jvm】内存泄漏与内存溢出的区别
  • [Python3] Sanic中间件
  • 你比AI更有价值吗?
  • 微信小程序-基于Vant Weapp UI 组件库的Area 省市区选择
  • ESLint (10)
  • 低空经济的地理信息支撑:构建安全、高效的飞行管理体系
  • CSS|15 CSS3结构伪类border-collapse伪元素
  • PHP 微信棋牌开发全解析:高级教程
  • 解决Ascend上vllm运行时出现urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED]
  • redis和mysql的区别
  • 威尔克斯(Wilks)分布
  • 基于Pycharm与数据库的新闻管理系统(3)MongoDB