In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge about "how to detect bad tracks and bad blocks on hard disk on Linux". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
Let's start with the definition of bad track and bad block, which are parts of a disk or flash memory that can no longer be read or written to, typically due to specific physical damage to the disk surface or failure of flash transistors.
As bad sectors continue to accumulate, they can have an unpleasant or destructive effect on your disk or flash capacity and may even cause hardware failure.
Also note that the presence of bad blocks alerts you to start thinking about buying a new disk, or simply mark bad blocks as unusable.
Therefore, in this article, we go through several steps necessary to determine whether a Linux disk or flash memory has bad sectors using a specific disk scanning tool.
Here are the steps:
Checking Bad Sectors with Bad Block Tool on Linux
The Bad Block tool allows users to scan devices for bad tracks or blocks. A 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 memories and their partitions:
$ sudo fdisk -l
List Linux file system partitions
Then check your Linux hard drive for bad sectors/blocks with the following command:
$ sudo badblocks -v /dev/sda10 > badsectors.txt
Scan hard disk for bad sectors on Linux
In the command above, badblocks scans devices/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 here to redirect the results of the operation to the file badsectors.txt.
If you find any bad sectors on your disk, unmount the disk and ask the system not to write data to the sectors that are returned as follows.
You need to execute the command e2fsck(for ext2/ext3/ext4 file systems) or fsck, which also requires the badsectors.txt file and the device file.
The-l option tells the command to add the sector numbers listed in the specified file badsectors.txt to the bad block list.
-------------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
Scanning Bad Sectors with Smartmontools on Linux
This method is more reliable and efficient for modern disks (ATA/SATA and SCSI/SAS hard drives and SSDs) with S.M.A.R. T(Self-Monitoring, Analysis and Reporting Technology) systems. The S.M.A.R.T. system can help detect, report, and possibly record their health so you can pinpoint any hardware failures that might occur.
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 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. The following command contains the parameter-H or--health to display the SMART Global Health Self-Assessment test results.
$ sudo smartctl -H /dev/sda10
Check Linux hard drive health
The results above indicate that your hard drive is healthy and that hardware failures are unlikely to occur in the near future.
To get an overview of disk information, use the-a or--all option 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.
"How to detect bad sectors and bad blocks on a hard disk on Linux" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.