Professional Documents
Culture Documents
Badblocks Linux Use HD
Badblocks Linux Use HD
com/check-linux-hard-disk-bad-sectors-bad-blocks/
RedHat RHCSA and RHCE Certi�cation Preparation Guide - Get This Book
Menu
Menu
Aaron Kili Last Updated: October 26, 2016 Linux Commands 31 Comments
Let us start by de�ning a bad sector/block, it’s a section on a disk drive or �ash memory that can not be read from or
written to anymore, as a result of a �xed physical damage on the disk surface or failed �ash memory transistors.
As bad sectors continue to accumulate, they can undesirably or destructively affect your disk drive or �ash memory
capacity or even lead to a possible hardware failure.
It is also important to note that the presence of bad blocks should alert you to start thinking of getting a new disk
drive or simply mark the bad blocks as unusable.
Therefore, in this article, we will go through the necessary steps that can enable you determine the presence or
absence of bad sectors on your Linux disk drive or �ash memory using certain disk scanning utilities.
program enables users to scan a device for bad sectors or blocks. The device can be a hard disk or an
1 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
Firstly, use the fdisk command with superuser privileges to display information about all your disk drives or �ash
memory plus their partitions:
$ sudo fdisk -l
Then scan your Linux disk drive to check for bad sectors/blocks by typing:
In the command above, badblocks is scanning device /dev/sda10 (remember to specify your actual device) with the
-v enabling it to display details of the operation. In addition, the results of the operation are stored in the �le
badsectors.txt by means of output redirection.
In case you discover any bad sectors on your disk drive, unmount the disk and instruct the operating system not to
write to the reported sectors as follows.
You will need to employ e2fsck (for ext2/ext3/ext4 �le systems) or fsck command with the badsectors.txt �le and the
device �le as in the command below.
The -l option tells the command to add the block numbers listed in the �le speci�ed by �lename (badsectors.txt
to the list of bad blocks.
2 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
OR
Once the installation is complete, use smartctl which controls the S.M.A.R.T system integrated into a disk. You can
look through its man page or help page as follows:
$ man smartctl
$ smartctl -h
Now execute the smartctrl command and name your speci�c device as an argument as in the following command,
the �ag -H or --health is included to display the SMART overall health self-assessment test result.
3 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
The result above indicates that your hard disk is healthy, and may not experience hardware failures any soon.
For an overview of disk information, use the -a or --all option to print out all SMART information concerning a
disk and -x or --xall which displays all SMART and non-SMART information about a disk.
In this tutorial, we covered a very important topic concerning disk drive health diagnostics, you can reach us via the
feedback section below to share your thoughts or ask any questions and remember to always stay connected to
Tecmint.
Linux Tricks
3 Ways to Delete All Files in a Directory Except One Deal: Become a Java Ninja with This 4-Course Novice to
or Few Files with Extensions Expert Java Bundle
If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts?
do ask for help in the comments section.
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles,
Guides and Books on the web. Millions of people visit TecMint! to search or browse the
thousands of published articles available FREELY to all.
4 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of
appreciation.
Related Posts
5 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
6 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
7 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
Install Linux from USB Device or Boot into Live Mode Using Unetbootin and dd Command
8 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
umibozu
October 1, 2020 at 11:18 pm
Reply
breng
September 29, 2020 at 9:07 am
How do you mount Ubuntu ISO in Ram in the grub boot menu?
Reply
Ravi Saive
September 29, 2020 at 10:55 am
@Breng,
Check this article – How to Run Any Linux Distribution Directly from Hard Disk in Ubuntu Using Grub Menu
Reply
Michael Macha
June 26, 2020 at 9:52 pm
I was doing this for a slightly impaired external drive, and it worked �ne up until the actual call to fsck. Using
9 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
gave me a message that “fsck: the -l option can be used with one device only — ignore“; apparently
because it was interpreting the text �le as an additional device. However, thinking it over,
with an opening angle bracket before the �le, in case it gets edited out) worked perfectly. I think you may
have lost a symbol to HTML formatting there.
Reply
Aaron Kili
June 29, 2020 at 10:39 am
@Michael
Okay, many thanks for sharing this. Allow us to check this out.
Reply
J. Zumwalt
June 5, 2020 at 10:00 am
# df
Device Start End Sectors Size Type
/dev/sda6 614612992 11618643967 11004030976 5.1T Linux �lesystem
badblocks: Value too large for de�ned data type invalid end block (5502015488): must be 32-bit value
Reply
Aaron Kili
June 5, 2020 at 11:16 am
10 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
@J
Oops, we will investigate this further. Thanks for the useful feedback.
Reply
Antonio
May 12, 2020 at 2:36 am
Very useful information! Help me to recover from an “Emergency mode” on Opensuse. Thanks
Reply
Jonathan
April 29, 2020 at 9:09 pm
Whenever I try to start my pc, it shows like I/O buffer error, logical block error fsck exited with status code 8,
Could this be a zero-length partition? I am completely new to it. So please help me I had some important
documents in there. I don’t wanna format my hard drive as well. I would be really grateful if anyone could
help me
Reply
Aaron Kili
April 30, 2020 at 11:15 am
@Jonathen
Reply
Jonathan
April 30, 2020 at 2:46 pm
/dev/sda1 I don’t wanna lose any of the data as some are very important. I hadn’t formatted anything
before. So please help me �gure it out.
11 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
Reply
Kyosuke
May 12, 2020 at 7:04 pm
I think what Aaron means is which formatted system have you use for your device /dev/sda1?
$ df -Th /dev/sda1
Reply
← Older Comments
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Notify me of followup comments via e-mail. You can also subscribe without commenting.
Post Comment
This site uses Akismet to reduce spam. Learn how your comment data is processed.
12 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
13 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
14 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
15 of 16 04/11/2020 09:19
How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
11 Best Graphical Git Clients and Git Repository Viewers for Linux
Donate to TecMint Contact Us Advertise on TecMint Linux Services Copyright Policy Privacy Policy Career
Sponsored Post
Tecmint: Linux Howtos, Tutorials & Guides © 2020. All Rights Reserved.
The material in this site cannot be republished either online or of�ine, without our permission.
16 of 16 04/11/2020 09:19