In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to detect bad tracks and blocks on the hard disk under CentOS". In daily operation, I believe many people have doubts about how to detect bad tracks and blocks on the hard disk under CentOS. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to detect bad tracks and blocks on the hard disk under CentOS". Next, please follow the editor to study!
Let's start with the definition of bad channels and bad blocks, which are parts of a disk or flash memory that can no longer be read or written, usually due to specific physical damage on the disk surface or flash transistor failure.
As bad roads continue to accumulate, they can have an unpleasant or destructive impact on your disk or flash capacity, and may even lead to hardware failure.
Also note that the presence of bad blocks warns you that you should start thinking about buying a new disk, or simply mark the bad block as unavailable.
Therefore, in this article, we take a few necessary steps to use a specific disk scan tool to enable you to determine if there is a bad path in Linux disk or flash memory.
Here are the steps:
Use the Bad Block tool to check for Bad channels on Linux
The Bad Block tool allows the user to scan the device for bad tracks or blocks. The device can be a disk or an external disk represented by a file such as / dev/sdc.
First, execute the fdisk command with superuser privileges to display information about all your disks or flash memory and their partitions:
Sudo fdisk-l
List Linux file system partitions
Then check for bad tracks / blocks on your Linux hard drive with the following command:
Sudo badblocks-v / dev/sda10 > badsectors.txt
Scan the hard drive for bad tracks on Linux
In the above command, badblocks scans the device / dev/sda10 (remember to specify your actual device), and the-v option lets it display the details of the operation. In addition, output redirection is used to redirect the result of the operation to the file badsectors.txt.
If you find any bad tracks on your disk, uninstall the disk and tell the system not to write data to the return sector as shown below.
You need to execute the e2fsck (for the ext2/ext3/ext4 file system) or fsck command, and the badsectors.txt file and device file are also used in the command.
The-l option tells the command to add a list of bad blocks to the sector numbers listed in the specified file badsectors.txt.
-for for ext2/ext3/ext4 file systems-$sudo e2fsck-l badsectors.txt / dev/sda10 or-for other file systems-$sudo fsck-l badsectors.txt / dev/sda10
This method is more reliable and efficient for modern disks (ATA/SATA and SCSI/SAS hard drives and solid state drives) with S.M.A.R.T (self-monitoring analysis and reporting technology Self-Monitoring, Analysis and Reporting Technology) system. The S.M.A.R.T system can help detect, report, and possibly record their health, so you can identify any possible hardware failures.
You can install smartmontools using the following command:
-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 check its manual or help like this:
$man smartctl $smartctl-h
Then execute the smartctrl command and specify your device as a parameter in the command, which includes the parameter-H or-- health to display the results of the SMART overall health self-assessment test.
$sudo smartctl-H / dev/sda10
Check the health of Linux hard drives
The above results indicate that your hard drive is healthy and hardware failures are unlikely to occur in the near future.
To get an overview of disk information, use the-an or-- all options to display all SMART information about the disk, and-x or-- xall to display all SMART information about the disk as well as non-SMART information.
At this point, the study on "how to detect bad paths and blocks on the hard disk under CentOS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.