OSETC TECH

How to Check Hard Drive Health on FreeBSD

This post will guide you how to check your Hard Drive Health in FreeBSD operating system. How do I check my Hdds or SSDs Health using smartmontools tool from the command line in FreeBSD.

Smartctl Command


Smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into most ATA/SATA and SCSI/SAS hard drives and solid-state drives. The purpose of SMART is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests. smartctl also supports some features not related to SMART. This version of smartctl is compatible with ACS-3, ACS-2, ATA8-ACS, ATA/ATAPI-7 and earlier standards.

You can use the forms “/dev/ad[0-9]+” for IDE/ATA devices and “/dev/da[0-9]+” or “/dev/pass[0-9]+” for SCSI devices. For SATA devices on AHCI bus use “/dev/ada[0-9]+” format. For HP Smart Array RAID controllers, use “/dev/ciss[0-9]”.

Options:

-i, --info Prints the device model number, serial number, firmware version, and ATA Standard version/revision information.

-a, --all Prints all SMART information about the disk, or TapeAlert information about the tape drive or changer.

Installing Smartmontools Tool on FreeBSD


You can use the following command to install smartmontools package on your FreeBSD, type:

$ pkg install smartmontools

Outputs:

root@freebsd:~ # pkg install smartmontools
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
Fetching packagesite.txz: 100% 6 MiB 2.2MB/s 00:03
Processing entries: 100%
FreeBSD repository update completed. 32770 packages processed.
All repositories are up to date.
New version of pkg detected; it needs to be installed first.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
pkg: 1.10.5_5 -> 1.12.0

Number of packages to be upgraded: 1

The process will require 14 MiB more space.
7 MiB to be downloaded.

Proceed with this action? [y/N]:
[1/1] Fetching pkg-1.12.0.txz: 100% 7 MiB 1.7MB/s 00:04
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.10.5_5 to 1.12.0...
[1/1] Extracting pkg-1.12.0: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
smartmontools: 7.0_1

Number of packages to be installed: 1

The process will require 2 MiB more space.
499 KiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching smartmontools-7.0_1.txz: 100% 499 KiB 511.2kB/s 00:01
Checking integrity... done (0 conflicting)
[1/1] Installing smartmontools-7.0_1...
[1/1] Extracting smartmontools-7.0_1: 100%
=====
Message from smartmontools-7.0_1:

--
smartmontools has been installed

To check the status of drives, use the following:

/usr/local/sbin/smartctl -a /dev/ad0 for first ATA/SATA drive
/usr/local/sbin/smartctl -a /dev/da0 for first SCSI drive
/usr/local/sbin/smartctl -a /dev/ada0 for first SATA drive

To include drive health information in your daily status reports,
add a line like the following to /etc/periodic.conf:
daily_status_smart_devices="/dev/ad0 /dev/da0"
substituting the appropriate device names for your SMART-capable disks.

To enable drive monitoring, you can use /usr/local/sbin/smartd.
A sample configuration file has been installed as
/usr/local/etc/smartd.conf.sample
Copy this file to /usr/local/etc/smartd.conf and edit appropriately

To have smartd start at boot
echo 'smartd_enable="YES"' >> /etc/rc.conf

Once Smartmontools is installed on your FreeBSD system, and you can now use smartctl command to control and monitor SMART Disks.

Checking Hard Drive Health on FreeBSD


if you want to dispaly the hard driver disk information, and you can pass the -i option to the smartctl command, type:

$ smartctl -i /dev/ada0

Outputs:

root@freebsd:~ # smartctl -i /dev/ada0
smartctl 7.0 2018-12-30 r4883 [FreeBSD 12.0-RELEASE amd64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model: VBOX HARDDISK
Serial Number: VBc1a25919-08b8d87a
Firmware Version: 1.0
User Capacity: 33,286,127,616 bytes [33.2 GB]
Sector Size: 512 bytes logical/physical
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ATA/ATAPI-6 published, ANSI INCITS 361-2002
Local Time is: Fri Oct 11 14:55:13 2019 UTC
SMART support is: Unavailable - device lacks SMART capability.

If you want to check hard disk health for a disk /dev/ada0 in your FreeBSD, and you can pass the -a option to the smartctl command, type:

$ smartctl -a /dev/ada0

Conclusion


You should know that how to check hard drive health using smartctl command from the command line in your FreeBSD system.