In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Xiaobian to share with you the use of linux badblocks command to check the disk device damaged blocks, I hope you read this article after a big harvest, let us discuss it together!
badblocks is a command to check for bad blocks in a disk drive. When executed, the command simply specifies the disk drive to be checked and the number of disk blocks for that drive.
Syntax format: badblocks [parameter]
Common parameters:
-b Specifies the chunk size of the disk in bytes-o Writes the results of the check to the specified output file-s Displays progress during check-v Displays detailed information during execution-w Performs a write test during check
Reference Example
Scan the hard disk by command:
[root@linuxcool ~]# badblocks -s -v /dev/sdnx
where n represents the hard disk device name, x represents the partition number corresponding to the hard disk, for example, you need to check "/dev/sda2":
[root@linuxcool ~]# badblocks -s -v /dev/sda2 Checking blocks 0 to 30681000 Checking for bad blocks (read-only test): 306809600674112/ 306810000000 30680964306809653068096630680967306809683068096930680970306809713068097230680973 ... done Pass completed, 37 bad blocks found. where "37 bad blocks found" means there are 37 bad blocks on the hard drive.
Take 4096 bytes as a "block", check each "block" once, output the result to the file "hda-badblocks-list.1", starting with block 51000 and ending with block 63000:
[root@linuxcool ~]# badblocks -b 4096 -c 1 /dev/hda1 -o hda-badblocks-list.1 63000 51000
Scan the hard disk for damaged sectors or blocks and write to the bad-blocks.txt file under the temporary folder:
[root@linuxcool ~]# badblocks -v -o /dev/sdb > /tmp/bad-blocks.txt
If a bad track is found, a write scan can be performed to repair it. Write scan will automatically remap when bad track is encountered. Write scan will overwrite the original data, so please backup first. Write scanning speed is very low, so you should only scan the parts where errors are found during read-only scanning:
[root@linuxcool ~]# badblocks -w -s /dev/sdb END START
Replace END and START with the block numbers of the end and start.
After reading this article, I believe you have a certain understanding of using the badblocks command in linux to check the damaged blocks in the disk device. If you want to know more about it, welcome to pay attention to the industry information channel. Thank you for reading!
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.