Use a bad block tool on Linux to check the bad trackThe bad block tool allows the user to scan the device to check the bad track or bad block. A device can be a disk or an external disk
/dev/sdc
This file represents.
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<br>
List Linux File System partitions
Run the following command to check the Bad Sectors/blocks on your Linux Hard Disk:$ sudo badblocks -v /dev/sda10 > badsectors.txt
Scan Hard Disk Bad Sectors in Linux 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 operation result is redirected to the badsectors.txt file using the output direction.
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.
You need to execute e2fsck (for ext2/ext3/ext4 file system commands or fsckcommand, the command also uses the badsectors.txt file and the device file.
-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 ChannelsThis method is applicable (Self-monitoring and analysis report TechnologySelf-Monitoring, Analysis and Reporting Technology) The system's modern disks (ATA/SATA and SCSI/SAS hard disks and solid state disks) are more reliable and efficient. 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
Check Linux Hard Drive Health 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.
In this tutorial, we will discuss important topics about disk health diagnostics and hope to help you.
From: https://linux.cn/article-7961-1.html
Address: http://www.linuxprobe.com/check-linux-disk.html