如何获取硬盘的总运行时间

Mor*_*mer 13 linux centos hard-drive

为了在服务器中进行磁盘轮换,我需要知道 Linux CentOS 6.3(最终版)系统上磁盘的当前运行时间(在线)时间。

磁盘与SATA(例如/dev/sdc)相连,是简单的旋转类型(Western Digital RE 类型的磁盘),并且没有以任何RAID 或类似方式组织。

我尝试使用smartctrl(如 superuser.com/questions/279412 中建议的那样)找到它,但无法找到信息。命令有什么建议吗?

Mor*_*mer 23

根据@Zoredache 的评论回答:

命令是smartctl --all /dev/sdc,要查看的部分是“Vendor Specific SMART Attributes with Thresholds”,它有一个名为“Power_On_Hours”的属性。

因此,仅在小时(运行)时获得电源的命令是:

smartctl --all /dev/sdc | grep Power_On_Hours
Run Code Online (Sandbox Code Playgroud)

然后可以显示如下内容:

9 Power_On_Hours          0x0032   087   087   000    Old_age   Always       -       10171
Run Code Online (Sandbox Code Playgroud)

因此运行时间为:10171 小时