很多朋友在问,买了国外的服务器后,怎么查看服务器提供商给配置的机子,尤其是硬盘是不是旧硬盘,或者说配置的硬盘使用了多少时间。其实,很多时候,不查还好,查了会吓你一跳的。因为很多基本上都是旧硬盘,有些使用时间真的是非常巨大……。现在跟我来吧,一起来学习如何查看服务器硬盘的使用时间。很简单的。
在之前先要先安装:smartmontools,关于smartmontools的介绍在这里:http://smartmontools.sourceforge.net/
其实很多服务器都是已经安装了的,如果没有安装,在centos下用下面这个命令,如果是其它操作系统,修改一下就成了。
1 | yum install smartmontools -y |
然后输入这个:
1 | smartctl -A /dev/sda |
如果提示有问题,或者不能查看的话,把sda换成你的硬盘的名称就可以了。具体你的硬盘的名称可以使用下面命令查看:
1 | df |
我的服务器输入命令后显示这个:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | SMART Attributes Data Structure revision number: 10 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x000f 111 100 006 Pre-fail Always - 41093440 3 Spin_Up_Time 0x0003 095 094 000 Pre-fail Always - 0 4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 80 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0 7 Seek_Error_Rate 0x000f 071 060 030 Pre-fail Always - 13735889 9 Power_On_Hours 0x0032 096 096 000 Old_age Always - 3737 10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always - 78 183 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 0 184 Unknown_Attribute 0x0032 100 100 099 Old_age Always - 0 187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0 188 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 3 189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0 190 Airflow_Temperature_Cel 0x0022 071 059 045 Old_age Always - 29 (Lifetime Min/Max 29/33) 191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 0 192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 77 193 Load_Cycle_Count 0x0032 097 097 000 Old_age Always - 7890 194 Temperature_Celsius 0x0022 029 041 000 Old_age Always - 29 (0 11 0 0) 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0 240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 106193066393916 241 Unknown_Attribute 0x0000 100 253 000 Old_age Offline - 184659636179 242 Unknown_Attribute 0x0000 100 253 000 Old_age Offline - 322824384168 |
找到:
1 | 9 Power_On_Hours 0x0032 096 096 000 Old_age Always - 3737 |
这一行的最后的那个数字,比如说我的3737,就是我的服务器的硬盘的使用时间,注意这个单位是Power_On_Hours,是小时。除以24就是对应的天数了。如果显示的是Power_On_Minutes,那就是分钟了。很简单吧。