0

I've got a HDD with unrecoverable bad blocks. HDD is part of Raid-0 array. If I access bad blocks by any means HDD hangs. Let's assume the HDD full capacity is 500,000,000,000 bytes, bad blocks are in range of 100,000,000,000 - 100,000,004,096 bytes (8 LBAs). How using dd or ddrescue can I clone this HDD to another HDD or to an image file without accessing bad blocks? I need bytes 0 - 99,999,999,999, then 4096 bytes of zeroes, then bytes 100,000,004,097 - 500,000,000,000.

Thanks!

FelisManulus
  • 163
  • 2
  • 9
  • 2
    [related](http://superuser.com/questions/347916/rescuing-a-hdd-with-bad-sectors-dd-vs-gddrescue). [manual](http://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html) is helpful. What syntax have you tried exactly? – Ramhound Jun 10 '15 at 18:10
  • Possible duplicate of [Faster recovery from a disk with bad sectors](https://superuser.com/questions/905811/faster-recovery-from-a-disk-with-bad-sectors) – Kamil Maciorowski Jul 25 '19 at 22:01

2 Answers2

2

I have done this today, I hope it works for you. I was having problems duplicating (backing up a disk) with about 30 bad blocks. The first thing I have done is backup files using regular Filezilla to backup all good data. I notice that one big file was not copying correctly (Stopping in the middle and restarting the transfer). Luckly I have a previous backup of same file. To duplicate the disk, then I had to find the bad blocks on the disk using this procedure:

1st find out the problem disk identifying the HD info using fdisk -l

2nd if lets say your disk is /dev/sdb then you need to run the command badblocks -v /dev/sdb it will list all you bad blocks on the drive. Luckily there will be a few. If no bad blocks are found, then your drive blocks are OK and need to figure something else out. My block size is 512 so I use that default number to run DD

3rd each block is 512 size, so what I done is to set bs=512

Each time I runned DD regularly as I always do, my data, after the errors, will come out corrupted. So I then use the parameters as explained on the page https://www.gnu.org/software/coreutils/manual/html_node/dd-invocation.html search the "For failing disks" part.

dd if=/dev/sdb of=/dev/sda bs=512 conv=noerror,sync iflag=fullblock 

It took a while. Each bad block encountered sound like a banging on the faulty drive. It does copy block by block, and thru all my bad blocks made the same noise. The amount of times made a noise, was because it found another bad block and tells you about on display error msg. What the ‘conv=noerror,sync’ does, is to pad out bad reads with NULs, while ‘iflag=fullblock’ caters for short reads, but keeps in sync your data up to the end. No corruption at all, it just does not copy the faulty blocks and fills it with empty NULs.

After the copy with DD was done, I just replace that bad file reverting Filezilla from a past backup and everything worked OK. I hope this will be usefull for others trying to backup faulty drives.

NOTE: My bad blocks where pretty much close to each other. About 4 blocks at a time together in groups where detected bad. If your blocks are all over the disk, several files could be affected. Luckly, on my case, a big database 4gb file was only affected.

  • If the same answer address multiple questions, there's a good chance the questions are duplicates. If so, it's better to answer one and flag the other as a possible duplicate. That avoids bloat of repetitious answers, and linking the questions makes it easier for readers to find all the answers. – fixer1234 Jul 25 '19 at 22:35
  • Same issue, same answer, you let me know I will be glad to delete but my answer fixed my issue and could be the solution for others. Best regards – Luis H Cabrejo Jul 25 '19 at 23:33
  • It seems that you downvoted me not for the answer, but just because I answered on three posts with very similar questions. The downvotes where at the same time and you have reply on all of them. The answer apply so I dont think its wrong to answer very related questions. I dont care about downvotes, I care fixing the problem and if it worked for me, could work for many others. Take care fixer. – Luis H Cabrejo Jul 25 '19 at 23:37
  • Just FYI, a couple of these attracted downvotes, but they weren't mine. I only commented to alert you about how the site works (the posts showed up in a review queue). Hard to know if the downvoter's issue related to the answer content or they noticed the same pattern of posting very similar answers. Typically, new users (or like in your case, someone who's been around for awhile but hasn't posted much), gets cut some slack on stuff like this. :-) – fixer1234 Jul 25 '19 at 23:47
  • Well its just a coincidence, sorry. 3 of your comments, inmediately after a downvote. No problem. I dont live for a vote. Let me know if my answer is wrong and downvote, thats the way it should work here. Anyway, let me know so I proceed to delete my answer. Take care. – Luis H Cabrejo Jul 25 '19 at 23:57
  • 1
    Your posts were on the main page and also in a review queue, so they got a lot of scrutiny. Now that you know about dupes, use your own judgement on how best to handle them. If you think the questions are different, it would be helpful to better focus each answer on the specific question so it reflects the differences and doesn't look like virtually the same answer. – fixer1234 Jul 26 '19 at 02:03
1

OK, maybe this can be done with dd too, but I solved my problem using WinHex (I selected physical device). It can clone any parts of disk to images and concatenate them.

FelisManulus
  • 163
  • 2
  • 9