How bad sectors or bad blocks on the hard drive Linux in check

Let us first define a bad sector / block, which is a portion of a disk drive or a flash memory, since the disk surface on a fixed physical damage or malfunction flash transistors, and therefore can no longer be read.

With the accumulation of bad sectors, they do not want or have a devastating impact on your disk drive or flash memory capacity, and may even lead to hardware failure.

It is also important to note that the presence of bad blocks will remind you to start thinking about buying a new disk drive, or just the bad block is marked as unavailable.

Therefore, in this article, we will perform the necessary steps to enable you to use a disk scanning utility to determine if there are bad sectors on the Linux disk drive or flash memory.

In other words, the following method:

Linux use badblocks tool to check the disk for bad sectors

Badblocks a program, the user can scan device bad sectors or blocks. The device may be a hard disk, it may be an external disk drive, represented by the file / dev / sdc like.

First, with superuser privileges fdisk command to display information about all disk drives or flash memory and its partitions:

$ sudo fdisk -l

Lists the Linux file system partition

Linux then scan disk drive by typing the following to check if there are bad sectors / block:

$ sudo badblocks -v / dev / sda10> badsectors.txt

Scanning Linux hard disk bad sectors

In the above command, badblocks is scanning device / dev / sda10 (please remember to specify your actual device), and -v it can display detailed information on the operation. In addition, by outputting the operation result stored in the file redirection in badsectors.txt.

If you find any bad sectors on the disk drive, Uninstall disk and operating system indicating that the sector not to write the report in the following manner.

You will need to use the e2fsck (for ext2 / ext3 / ext4 file system) or a fsck command, as shown on the following command file and the device file badsectors.txt.

The -l option tells the command to add the block number of the file name (badsectors.txt) are listed in the file specified by the bad block list.

------------ specifically for ext2 / ext3 / ext4 file system ------------

$ sudo e2fsck -l badsectors.txt / dev / sda10

 

Or

 

------------ For other file systems ------------

$ sudo fsck -l badsectors.txt / dev / sda10

Use Smartmontools bad sectors on the disk scanning Linux

For modern disk (ATA / SATA and SCSI / SAS hard disk drives and solid state drives), which with the SMART (Self-Monitoring, Analysis and Reporting Technology) system provides together, can help detect, report and may provide greater reliability and efficiency . Record their health so that you can identify any impending hardware failures.

You can install smartmontools by running the following command:

------------ based Debian / Ubuntu the system ------------

$ sudo apt-get install smartmontools

 

------------ based RHEL / CentOS on the system ------------

$ Sudo yum AnSo smartmontools

After installation is complete, use smartctl to control integrated into the SMART system disk. You can browse the following manual pages or help page:

to $ smartctl

$ smartctl -h

Smartctrl now execute command and name your specific device parameters, as shown in the following command, the flag contains -H or --health to display the overall health of SMART self-assessment test results.

$ sudo smartctl -H / dev / sda10

Check the Linux hard drive health

The above results indicate that your hard disk running in good condition, and hardware failure may not occur quickly.

For an overview of disk information, use -a or --all option to print out all the information about the disk's SMART -x or --xall it displays information about all SMART and non-intelligent disk.

在本教程中,我们涵盖了有关磁盘驱动器运行状况诊断的非常重要的主题,您可以通过下面的反馈部分与我们联系,以分享您的想法或提出任何问题,并记住始终与Tecmint保持联系。

 

发布了942 篇原创文章 · 获赞 35 · 访问量 16万+

Guess you like

Origin blog.csdn.net/allway2/article/details/104301051