الجمعة، 17 سبتمبر 2010

How to Testing the Hard Disk from SSH Using S.M.A.R.T information and testing read/write speed

Not everyone is familiar with the Linux shell.
Although many people use it in their server for economic reasons.

Often have the feeling that the hard disk is damaged.
To test the status of the disk in SSH, here are the various commands.

SMART Disk Monitoring Daemon.

smartd is a the software that use the SMART information to analysis, report and monitorate the disk.

That software can be installed on Linux, Windows, Solaris and *BSD.
Much distro come with smartd alrady installed on it.

To use it;
smartctl -i /dev/sda

With the argument -i we see the information of the version of the smartd, if the disk are compatible, the model of the disk.. (on that case the disk is /dev/sda)

My OutPut:
root@ethel [~]# smartctl -i /dev/hda
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Smartctl open device: /dev/hda failed: No such file or directory
root@ethel [~]# smartctl -i /dev/sda
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Device Model:     WDC WD7500AADS-00M2B0
Serial Number:    WD-WCAV51911761
Firmware Version: 01.00A01
User Capacity:    750,156,374,016 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   8
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Tue Dec  8 03:41:36 2009 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


To see if have any errors, run:
smartctl -l error /dev/sda


To test the disk, you can run 2 test, short and long.

the short take only 2min
smartctl -t short /dev/sda


The long test can take also more than 180min..
smartctl -t long /dev/sda


For see health and test result, run that command:
smartctl -Hc /dev/sda


My OutPut:
root@ethel [~]# smartctl -Hc /dev/sda
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

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

General SMART Values:
Offline data collection status:  (0x85) Offline data collection activity
                                        was aborted by an interrupting command from host.
                                        Auto Offline Data Collection: Enabled.
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:                 (15600) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        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:        ( 181) minutes.
Conveyance self-test routine
recommended polling time:        (   5) minutes.
SCT capabilities:              (0x303f) SCT Status supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.


For test write and read speed, run that command:
root@ethel [/home]# dd if=/dev/zero of=fakedisk bs=10k count=1000
1000+0 records in
1000+0 records out
10240000 bytes (10 MB) copied, 0.0188848 seconds, 542 MB/s


And for recive any alert of your disk, that command send you an email when there are any worng test..
/dev/sdb -m you@rv89.eu


For the moment, that's all ;)

ليست هناك تعليقات:

إرسال تعليق