Use Smartmontools to detect Bad Sectors on Hard Disks

Source: Internet
Author: User
Tags superuser permission

Use Smartmontools to detect Bad Sectors on Hard Disks
GuideA bad track is a part of a disk or flash memory that can no longer be read or written. It is generally caused by physical damage to the disk surface or flash transistor failure. As Bad channels continue to accumulate, they will have an unpleasant or destructive impact on your disk or flash capacity, and may even cause hardware failure. The existence of Bad blocks warns you to consider buying new disks.

In this article, we take several necessary steps to use a specific disk scan tool to determine whether a Linux disk or flash memory has a bad track.

Use a bad block tool on Linux to check the bad track

A bad block tool allows users to scan devices to check bad track or bad blocks. A device can be a disk or an external disk, represented by a file such as/dev/sdc. First, run the fdisk command with the superuser permission to display all your disk or flash memory information and their partition information:

sudo fdisk -l

Run the following command to check the Bad Sectors/blocks on your Linux Hard Disk:

In the above command, badblocks scans the device/dev/sda10 (remember to specify your actual device), and the-v option displays the operation details. In addition, the output redirection is used to redirect the operation result to the badsectors.txt file.

If you find any bad sectors on your disk, detach the disk and prevent the system from writing data to the sector in return as follows.

Run the e2fsck (for ext2/ext3/ext4 File System) or fsck command. The badsectors.txt file and the device file must also be used in the command.

-L indicates that the command adds the slice number listed in the specified badsectors.txt file to the bad block list.

------------ For ext2/ext3/ext4 File System ------------ $ sudo e2fsck-l kernel/dev/sda10 or ---------- for other file systems ------------ $ sudo fsck-l badsectors.txt/dev/sda10
Use the Smartmontools tool on Linux to scan bad Channels

This method is more reliable and efficient for modern disks (ATA/SATA and SCSI/SAS hard disks and solid state disks) with the S. M.A. R. T system. The S. M.A. R. T system can help detect, report, and possibly record their health status so that you can identify any possible hardware failures.

Run the following command to install smartmontools:

------------ On Debian/Ubuntu-based systems ------------ $ sudo apt-get install smartmontools ---------- on RHEL/CentOS-based systems ---------- $ sudo yum install smartmontools

After the installation is complete, use smartctl to control the disk-integrated S. M.A. R. T system. You can view its manual or help as follows:

$ man smartctl$ smartctl -h

Then run the smartctrl command and specify your device as the parameter in the command. The following command contains the parameter-H or -- health to display the SMART overall health self-evaluation test result.

$ sudo smartctl -H /dev/sda10

The above results indicate that your hard disk is healthy and hardware failure is unlikely to happen in the near future. To obtain the disk information overview, use the-a or -- all option to display all SMART information about the disk,-x or -- xall to display all SMART information about the disk and non-SMART information.

From: http://www.centoscn.com/CentOS/Intermediate/2016/1119/8218.html

Address: http://www.linuxprobe.com/smartmontools-detect-harddisk.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.