Smart tools for Hard disk

smartctl -i /dev/sda – информация о диске

smartctl -d TYPE -i /dev/sda -тоже самое , но с указанием типа диска

Now that smartctl can access the drive, let’s turn on some features. Run the following command:

smartctl -s on -o on -S on /dev/sda

-s on: This turns on S.M.A.R.T. support or does nothing if it’s already enabled.

-o on: This turns on offline data collection. Offline data collection periodically updates certain S.M.A.R.T. attributes. Theoretically this could have a performance impact. However, from the smartctl man page:

Normally, the disk will suspend offline testing while disk accesses are taking place, and then automatically resume it when the disk would otherwise be idle, so in practice it has little effect.

-S on: This enables “autosave of device vendor-specific Attributes”.

check the overall health:

smartctl -H /dev/sda

run the short test:

smartctl -t short /dev/sda

smartctl -l selftest /dev/sda

run the long test::

smartctl -t long /dev/sda

Using daemon smartd (config file /etc/smard.conf)

DEVICESCAN – лучше закомментировать.

/dev/sda -a -d sat -o on -S on -s (S/../.././02|L/../../6/03) -m root -M exec /usr/share/smartmontools/smartd-runner

Here’s what each option does:

  • /dev/sda: Replace this with the device file you’ve been using in smartctl commands.
  • -a: This enables some common options. You almost certainly want to use it.
  • -d sat: On my system, smartctl correctly guesses that I have a serial ata drive. smartd on the other hand does not. If you had to add a “-d TYPE” parameter to the smartctl commands, you’ll almost certainly have to do the same here. If you didn’t, try leaving it out initially. You can add it later if smartd fails to start.
  • -o on, -S on: These have the same meaning as the smartctl equivalents
  • -s (S/../.././02|L/../../6/03): This schedules the short and long self-tests. In this example, the short self-test will run daily at 2:00 A.M. The long test will run on Saturday’s at 3:00 A.M. For more information, see the smartd.conf man page.
  • -m root: If any errors occur, smartd will send email to root. On my system, mail for root is forwarded to my normal email account. If you don’t have a similar setup, replace root with your normal email address. This option also requires a working email setup. Most Linux distributions automatically have working outbound email.
  • -M exec /usr/share/smartmontools/smartd-runner: This last part may be specific to the Debian and Ubuntu smartmontools packages. Check if your system has /usr/share/smartmontools/smartd-runner. If it doesn’t, remove this option. Instead of sending email directly, “-M exec” makes smartd run a different command when errors occur. On Debian, smartd-runner will run each script in /etc/smartmontools/run.d/, one of which emails the user specified by the “-m” option.

# HERE IS A LIST OF DIRECTIVES FOR THIS CONFIGURATION FILE.

# PLEASE SEE THE smartd.conf MAN PAGE FOR DETAILS

#

# -d TYPE Set the device type: ata, scsi, marvell, removable, 3ware,N, hpt,L/M/N

# -T TYPE set the tolerance to one of: normal, permissive

# -o VAL Enable/disable automatic offline tests (on/off)

# -S VAL Enable/disable attribute autosave (on/off)

# -n MODE No check. MODE is one of: never, sleep, standby, idle

# -H Monitor SMART Health Status, report if failed

# -l TYPE Monitor SMART log. Type is one of: error, selftest

# -f Monitor for failure of any ‘Usage’ Attributes

# -m ADD Send warning email to ADD for -H, -l error, -l selftest, and -f

# -M TYPE Modify email warning behavior (see man page)

# -s REGE Start self-test when type/date matches regular expression (see man page)

# -p Report changes in ‘Prefailure’ Normalized Attributes

# -u Report changes in ‘Usage’ Normalized Attributes

# -t Equivalent to -p and -u Directives

# -r ID Also report Raw values of Attribute ID with -p, -u or -t

# -R ID Track changes in Attribute ID Raw value with -p, -u or -t

# -i ID Ignore Attribute ID for -f Directive

# -I ID Ignore Attribute ID for -p, -u or -t Directive

# -C ID Report if Current Pending Sector count non-zero

# -U ID Report if Offline Uncorrectable count non-zero

# -W D,I,C Monitor Temperature D)ifference, I)nformal limit, C)ritical limit

# -v N,ST Modifies labeling of Attribute N (see man page)

# -a Default: equivalent to -H -f -t -l error -l selftest -C 197 -U 198

# -F TYPE Use firmware bug workaround. Type is one of: none, samsung

# -P TYPE Drive-specific presets: use, ignore, show, showall

# # Comment: text after a hash sign is ignored

# \ Line continuation character

http://blog.shadypixel.com/monitoring-hard-drive-health-on-linux-with-smartmontools/

Print Friendly, PDF & Email
guest

0 Comments
Inline Feedbacks
View all comments