LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
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


Reply
  Search this Thread
Old 01-10-2022, 08:39 PM   #1
Tem2
Member
 
Registered: Dec 2011
Posts: 243

Rep: Reputation: Disabled
Can the space of a partition with bad sectors be reclaimed


I have a 500 gb solid state hard drive on my laptop which has issues. It has a "Power-On Hours" value of 1 year 4 months. My system partition has catastrophic failures which have resulted in a situation where I can no longer use it.

When I run the following command, I get a list of many thousands of bad sectors on my sda device:

Code:
sudo badblocks-v /dev/sda > bad_sectors.txt
When I go into the SMART Data & Self Tests function of the Disks application, the Overall Assessment says: Disk is OK, 15,365 bad sectors. This number is incrementing while I perform a short self-test which says that 90% of the test remains to finish.

I'm trying to understand what that means more specifically. Here are my questions:

1. Is there a way to determine which partitions have the bad sectors?
2. Is there a way to determine which bad sectors are repairable?
3. If I can successfully copy a file, does that mean it is usable and not affected by bad sectors?

If there are a total of over 975 million sectors on a 500gb drive (which is a number I found in my Google searching), it would take over 9 million bad sectors to affect only 1% of the drive. My drive shows 15,000 bad sectors with 90% of the self-test remaining. So I estimate conservatively that I have as many as 250,000 bad sectors, which is far less than 1% of the total drive. I'm guessing that some of these bad sectors are "soft" and repairable. I admit that my only reason for believing this is wishful thinking.

I realize that a new disk is relatively inexpensive, but I'd prefer to salvage whatever part of the drive is usable. I want to believe that if 99% of the drive is not affected by bad sectors, it must still have some value.

Last edited by Tem2; 01-10-2022 at 08:41 PM.
 
Old 01-10-2022, 09:58 PM   #2
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, OS/2, others
Posts: 6,496
Blog Entries: 1

Rep: Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230
When there are a lot of bad sectors already, you can expect more to go bad. When the wrong sector goes bad, you lose everything. I'd replace it ASAP.

FWIW, just yesterday I replaced a SSD that had been in 24/7 use about 18 months. Bad sectors weren't the problem, but performance was erratic, with 2-digit numbers on some partitions on hdparm -t, where when new they were upwards of 520.
 
Old 01-10-2022, 10:08 PM   #3
Tem2
Member
 
Registered: Dec 2011
Posts: 243

Original Poster
Rep: Reputation: Disabled
I plan to replace it. I just wonder if there is any way to salvage a drive which has 99% good sectors.
 
Old 01-10-2022, 10:14 PM   #4
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, OS/2, others
Posts: 6,496
Blog Entries: 1

Rep: Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230
Use ddrescue to clone it to the new SSD, and see what you get. It might turn out OK. It depends on whether or not those bad sectors are in use anywhere that matters.
 
Old 01-10-2022, 10:55 PM   #5
Tem2
Member
 
Registered: Dec 2011
Posts: 243

Original Poster
Rep: Reputation: Disabled
If a file gets copied cleanly from the bad disk, can I assume that the copied file is usable? In other words, if a file happens to be located in a bad sector, will that file be copiable, or will the copy attempt just fail with an error?
 
Old 01-10-2022, 11:12 PM   #6
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, OS/2, others
Posts: 6,496
Blog Entries: 1

Rep: Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230Reputation: 2230
There's no clear cut answer. If a sector was completely unreadable by ddrescue, the copy would contain something other than what it's supposed to contain. If it's a sector that matters, the file containing it would be damaged. Whether any portion of that file remains usable depends on the nature of the file. If a binary, it's probably completely worthless. If it's an image or audio or video file, likely it would just result in a blemish of some kind. In most cases, IIUC, a file portion contained by a bad sector will be copyable, just not with expected data. I suppose it may be that the bad sector could be omitted, leaving the file a shorter length. I don't have that much experience with errors trying to clone. I usually find the disk's problem before it gets so bad that ddrescue can't come through with a 100% copy.
 
1 members found this post helpful.
Old 01-10-2022, 11:31 PM   #7
Tem2
Member
 
Registered: Dec 2011
Posts: 243

Original Poster
Rep: Reputation: Disabled
Thanks for your help!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
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-11-2014 08:00 AM
LXer: Check Hard drive for bad sectors or bad blocks in linux LXer Syndicated Linux News 0 08-10-2014 12:21 AM
re-allocated sectors count shows 2 bad sectors, in Ubuntu 10.04 disk utility james2b Linux - Hardware 4 10-12-2010 11:16 PM
Windows reclaimed daul booted drive tkofkc Linux - Newbie 4 12-05-2002 12:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:53 AM.

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