LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 09-22-2021, 04:39 PM   #1
vmelkon
Member
 
Registered: Feb 2007
Location: Canada
Distribution: Kubuntu 22.04
Posts: 549

Rep: Reputation: 84
If a HDD has bad sectors


Hello everyone,
If a HDD has bad sectors, does this mean the HDD should be thrown out?
If I format the HDD in the ext3 format, does it keep information about which sectors are bad and avoids using them?

Also, which Linux tool can scan a HDD and look for bad sectors?

I have Kubuntu 20.04.
This is for a desktop PC.
 
Old 09-22-2021, 05:08 PM   #2
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,177

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
Bad sectors happen and the hard drive will have a pool of spare sectors to swap in place of bad ones as they are found. The issue is when you start getting lots of bad sectors and the spare pool runs out.
You can use the smartctl command to test and get a report of the drive. This link has a nice over view: https://linuxconfig.org/how-to-check...using-smartctl
 
Old 09-22-2021, 10:08 PM   #3
vmelkon
Member
 
Registered: Feb 2007
Location: Canada
Distribution: Kubuntu 22.04
Posts: 549

Original Poster
Rep: Reputation: 84
Quote:
Originally Posted by uteck View Post
Bad sectors happen and the hard drive will have a pool of spare sectors to swap in place of bad ones as they are found. The issue is when you start getting lots of bad sectors and the spare pool runs out.
You can use the smartctl command to test and get a report of the drive. This link has a nice over view: https://linuxconfig.org/how-to-check...using-smartctl
Who handles that pool of spare sectors? Is it done by the internal logic of the HDD or is it done by the OS at the filesystem format level?
 
Old 09-22-2021, 10:12 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,020

Rep: Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630Reputation: 3630
The OEM maker of the drive usually has diags to use.

badblocks might be used. There used to be some dos option to verify writes and if bad mark the area and try different. I think linux should do that but I can't find it just now.

https://en.wikipedia.org/wiki/Badblocks

"Modern disk drives will probably not show any defective sectors because they silently remap bad sectors to spare tracks,[5] but running the program with a new drive for several days will test the whole surface, and when reading it afterwards S.M.A.R.T. data will eventually show reallocated sectors."

https://www.tecmint.com/check-linux-...rs-bad-blocks/

Last edited by jefro; 09-22-2021 at 10:20 PM.
 
Old 09-23-2021, 10:14 AM   #5
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,177

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
Quote:
Originally Posted by vmelkon View Post
Who handles that pool of spare sectors? Is it done by the internal logic of the HDD or is it done by the OS at the filesystem format level?
Bad blocks is only handled by the drive controller firmware, the OS can just query it for info or ask it to run a test.
 
Old 10-01-2021, 07:26 AM   #6
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
A reported bad block/sector on a hdd can be as simple as a single ding on the platter. Or it could mean the hdd is about to self destruct (usually slowly). At best, and depending on importance (but what drive isn't important?), I would be replacing the drive. At the least, I would be making verified backups often, and watching for errors indicating imminent failure.
 
Old 10-07-2021, 09:20 AM   #7
ptf
LQ Newbie
 
Registered: Oct 2021
Posts: 15

Rep: Reputation: Disabled
Operating system management of bad sectors hasn't been appropriate for years, decades in fact - it is all handled automatically by the drives these days.

As mentioned you can use smartctl to look at the reallocated sector count. A few, especially on older drives, might be nothing to worry about as long as the number is not rising on a daily or weekly basis. If it is the drive is failing and will die probably sooner rather than later so get any important data off of it before it fails.

mke2fs does still have the "-c" argument to check sectors can be read but with the huge capacities of modern drives it's unlikely to be useful in practice.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HDD suddenly has a lot of bad sectors RoundedSquares Linux - Hardware 4 02-28-2018 06:51 AM
LVM: pvcreate fails on 5TB drive with "pe_align (2048 sectors) must not be less than pe_align_offset (8388607 sectors)" furryspider Slackware 12 10-14-2016 05:21 PM
LXer: Check Hard drive for bad sectors or bad blocks in linux LXer Syndicated Linux News 0 08-10-2014 12:21 AM
can't install latest ALSA driver in lucid 2.6.32-25 preempt, one hdd has bad sectors streams &dragonflies Ubuntu 2 11-16-2010 11:58 PM
re-allocated sectors count shows 2 bad sectors, in Ubuntu 10.04 disk utility james2b Linux - Hardware 4 10-12-2010 11:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 05:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration