Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux? |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-08-2023, 04:56 PM
|
#1
|
Member
Registered: Oct 2006
Posts: 44
Rep:
|
Anyone know how to scan hard drives for bad sectors?
I need to find out the location of every last bad sector on this drive. I'm tired of getting trolled. The best help I've had thus far in Linux is journalctl because it screams the sector number every time there's an error, but I don't know how to make it save the sectors to a file. I'm sure there's a way to make a script to persistently scan journalctl while I abuse the drive and extract the sectors from there but I would have no clue how to do that. Perhaps there's some other tool already made for this purpose?
Thanks in advance!
Last edited by L-28C; 01-08-2023 at 04:58 PM.
|
|
|
01-08-2023, 05:18 PM
|
#2
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,177
|
First: On many, perhaps most, modern devices you do not need to do that. If they are S.M.A.R.T. technology compliant they self-detect and remap bad sectors and many low level tools do not report the remapping, you need the SMARTMON toolset, with which you can see the reported block reports for the information.
See this page for SMART tool hints https://linuxconfig.org/how-to-check...using-smartctl
If you run the information option and discover you have a device that is not SMART, then you need other tools.
Please verify what you are working with first. The report, replacing 'whatever' with the real device name for the drive in the following command should give us that information
Code:
sudo smartctl -i /dev/whatever
You can use the "blkid" report to find the real device name.
|
|
|
01-08-2023, 06:18 PM
|
#3
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,385
|
Perhaps the OP should describe their menagerie of "devices" first - previous threads may give some idea, but who knows.
|
|
|
01-08-2023, 09:47 PM
|
#4
|
Member
Registered: Oct 2006
Posts: 44
Original Poster
Rep:
|
Quote:
Originally Posted by wpeckham
First: On many, perhaps most, modern devices you do not need to do that. If they are S.M.A.R.T. technology compliant they self-detect and remap bad sectors and many low level tools do not report the remapping, you need the SMARTMON toolset, with which you can see the reported block reports for the information.
See this page for SMART tool hints https://linuxconfig.org/how-to-check...using-smartctl
If you run the information option and discover you have a device that is not SMART, then you need other tools.
Please verify what you are working with first. The report, replacing 'whatever' with the real device name for the drive in the following command should give us that information
Code:
sudo smartctl -i /dev/whatever
You can use the "blkid" report to find the real device name.
|
Oh yeah no I'm way past SMART. For some reason it only has a limited number of remappable sectors, after those are gone you're on your own. If I can't remap them then I'll just avoid going anywhere near them... unless perhaps there's some software remapping technology I'm not aware of?
edit: also yeah what @syg00 said LOL these drives are begging me to just let them die, and yes there are bad sectors but what about the good sectors? They deserve to continue serving. I might even pull up to guiness records one day and see if they have one for the most horrible SMART history in a still functioning drive, who knows I might get rich
Last edited by L-28C; 01-08-2023 at 10:05 PM.
|
|
|
01-08-2023, 11:03 PM
|
#5
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,177
|
The SMART utilities can still test your drive and report bad sectors, both remapped and current.
If you have a device that does not support SMART, then the vendors disk utilities would be the software of choice.
If bad sectors are propagating, then it is likely you have surface rust flaking and floating around in there, and should retire the drive anyway. Your data is not secure, and you cannot depend upon any disk utility or scan to tell you where the next rash of bad sectors will suddenly appear.
|
|
|
01-15-2023, 01:33 AM
|
#6
|
Senior Member
Registered: Mar 2010
Distribution: Slackware
Posts: 2,256
|
I eyeball it.
|
|
|
01-15-2023, 04:09 AM
|
#7
|
LQ Guru
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, OS/2, others
Posts: 6,502
|
Take a look at a ddrescue mapfile. Maybe you could use what it contains.
|
|
|
01-15-2023, 08:29 PM
|
#8
|
Senior Member
Registered: Aug 2016
Posts: 3,345
|
Quote:
Originally Posted by L-28C
Oh yeah no I'm way past SMART. For some reason it only has a limited number of remappable sectors, after those are gone you're on your own. If I can't remap them then I'll just avoid going anywhere near them... unless perhaps there's some software remapping technology I'm not aware of?
edit: also yeah what @syg00 said LOL these drives are begging me to just let them die, and yes there are bad sectors but what about the good sectors? They deserve to continue serving. I might even pull up to guiness records one day and see if they have one for the most horrible SMART history in a still functioning drive, who knows I might get rich
|
If the drive has already remapped all the available sectors as reported in smartctl then the only intelligent thing for a user to do is replace the drive. Bad sectors continuing to develop is 100% indication of progressive drive failure and it is only a matter of time until the drive is totally unusable -- with the inevitable loss of data.
I strongly suggest immediate drive replacement to avoid a potential total failure at the worst possible time.
The 'badblocks' command can do some of what you ask, but does not preclude further failure.
Last edited by computersavvy; 01-15-2023 at 08:31 PM.
|
|
|
01-15-2023, 08:40 PM
|
#9
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
Quote:
Originally Posted by L-28C
If I can't remap them then I'll just avoid going anywhere near them... unless perhaps there's some software remapping technology I'm not aware of?
|
If the bad block replacement mechanism has reached its limit, my suggestion would be to buy the replacement drive, remount the failing one as read-only, and begin copying everything to the new disk. And soon.
|
|
|
All times are GMT -5. The time now is 05:15 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|