Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Clone / repair hard drive w/ bad sectors using backup drive and ddrescue?


  • Please log in to reply
7 replies to this topic

#1 DChronos

DChronos

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:02:45 PM

Posted 18 July 2016 - 08:35 PM

Hi, I need help with something very important that I'm very new at doing that I'd rather not try manually with a hex editor first if I can have it done for me and see if it works.

 

Here's the situation... I have an old computer with a hard disk that got knocked over and the heads must have crashed onto the platter because it suddenly made about 1400 bad sectors in a single spot near the beginning of the hard drive, right amidst the old windows XP program files.  The MBR is fine, the $MFT is fine (and its backup is far from the bad sectors) and the boot sector can be repaired.

 

What I have:

- Source drive with bad sectors

- Replacement drive of the exact same make and model (after I image the OS from that), which is error free as well.

- Original drive of this computer which was removed after cloning it to a new drive... saved just in case of this situation

- UBCD 5.5, which I'm going to use Parted Magic from to use ddrescue

 

 

 

What I want to do:

 

I read that ddrescue within Parted Magic can fully clone a hard drive with bad sectors, either to an image file or directly to disk, and it makes a mapfile to map where all the good and bad sectors are... and you can even make it mark bad sectors with custom text, like BADSECTOR at the start of the unreadable sector when it writes to the cloned disk / image.

 

>>> I want to use this specifically because it also says that it can use the mapfile and an undamaged backup copy of a disk to replace the bad sectors from the backup copy. <<<

 

 

So....  in order, I want to...

1. Use ddrescue to clone my damaged drive (in reverse) to the replacement drive of the same make and model, have it store the mapfile to my USB drive (I think I understand how to do this already thanks to a good tutorial page)

 

2. unhook the damaged drive and hook up the original hard drive my damaged drive was cloned from

 

3. The part I am not sure how to do... use ddrescue with the mapfile to copy from the original drive all sectors that were marked bad during the cloning process... and ONLY those sectors.

 

And also, on step 1, if I can do this while cloning, have it write BADSECTOR to the cloned replacement drive at every bad sector to make it easy to find the bad sectors with a hex editor.

 

 

 

The reason I want to try this first is because, before I cloned the original drive to this now damaged drive, I believe I used a program to defrag the original drive. I checked a number of random areas, especially around many bad sectors, on both this damaged drive and the original drive, and it appears that most, if not all the data that got damaged is still the exact same data in the same place on both drives, since I never did anything to windows after I cloned the original drive.

 

I wanted to try cloning the undamaged sectors from the original drive onto the bad sectors after I clone the damaged drive and see if my drive is whole again, and then probably try a system restore just in case so it replaces all the drivers and programs and stuff from its backups... the latest I believe is far from the bad sectors as well. Also doing a repair of the boot sector before booting to windows, just in case.

 

 

 

I also wanted to have it write BADSECTOR to the start of every bad sector so I can check to be sure it filled them in, but also want to know how just in case this doesn't work and I can go and look at the discrepencies in the PTS Disk Editor between both drives.

 

 

Sorry this sounds complex... the short of it is I don';t know how to make it write BADSECTOR at bad sectors to the new drive while coning the bad drive so I don't have to run the bad drive again... and more importantly, I don't know how to make ddrescue use the mapfile to clone only sectors marked bad during cloning from a good backup to the clone with the bad sector data holes.



BC AdBot (Login to Remove)

 


#2 JohnC_21

JohnC_21

  • Members
  • 24,623 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:45 PM

Posted 18 July 2016 - 09:26 PM

I don't have a lot of experience with ddrescue but from your post I gather you want to clone the bad drive to a new drive and then replace the bad sectors with sectors from the original drive, correct? 

 

My question is if after all this time you have defragged the disk with bad sectors how do you know the files on the original drive will match the sectors on the drive with bad sectors. Defragging will move files on the disk so there is no way of knowing if the sectors you are replacing are the correct ones but I may be wrong.



#3 DChronos

DChronos
  • Topic Starter

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:02:45 PM

Posted 19 July 2016 - 12:40 AM

I didn't defrag the bad drive.... let me clarify.

 

I got this computer years ago for free because it ran really slow and had problems doing a lot.  I fixed it all up and got rid of the problems, mostly caused by too many antivirus programs interfering with eachother, but I didn't like the way the drive sounded.  So, I went and cleaned the drive up (files and registry), uninstalled a few things I didn't want and installed a few things I did, including Marcrium Reflect, defragged the drive, and then after I had all my data at a set kind of main restore point I wanted to keep, I cloned the original hard drive it came with onto a newer drive that was in better shape with more space.  Then I took out the original hard drive this machine came with and stored it away to keep everything safe and used the cloned drive.

 

Since then, I have installed a few more programs and had tons of mostly just data gained onto the drive, but haven't done anything to windows itself, didn't update any drivers or files or anything, which is where the bad sectors are at... then a few days ago is when this happened, the drive was perfectly fine, but the head crash caused a bunch of bad sectors.  I wish I knew what actually happened before I followed the instructions of using chkdsk and then fixboot since I was getting the unmountable boot volume error at the time and most places said that many things can cause that and the easy fix is to do as mentioned (I didn't get past trying chkdsk since it failed at 75% twice).

 

I've since found out it had bad sectors caused by the tower falling back off the table it was on and smacking backwards against the wall, it didn't seem like it hit hard enough to cause that, but it did.  So now, I got a second drive that came from the same type of eMac as this bad drive, same make and model and everything.  I wanted to save the Mac OS from this drive first, then clear it and use it to clone my bad drive to it.

 

Now, I wanted to clone this bad drive and also have ddrescue write BADSECTOR or something to each area it finds is a bad sector, and then check it out using the Grep command (I just learned I can do this) to find all the affected files that now have BADSECTOR text in their data, which will help me figure out for certain that the data there is the same data as the old original hard drive I pulled out of the machine.

 

I've already looked at the data near the start and end of where the bad sectors begin to appear and stop appearing, and at data in random places in the middle of the bad sector region and then got out the original hard drive I put away, then compared the same data to sectors from the original hard drive this now-bad drive was cloned from, and all the data I compared was identical.  Seeing as this is in the first 2-5.5GB of data on the drive, and the original drive already had about 30G... AND I had defragged it, moving all that data closer to the beginning of the drive before I cloned the original, and I haven't deleted anything from the original data or programs since then on the clone, I am sure most of the bad sectors' lost data is still in perfect shape in the same locations on the original hard drive.

 

If so, then I should be able to plug in the bad drive, plug in the free drive, clone the bad to the free one... then take out the bad drive and plug in the old original drive with the same data and have it copy the still-intact data from the original drive into the missing spots from the bad sectors on the clone, the same way you'd rescue a CD / DVD with scratches if you had multiple copies.

 

I'm still reading up, but I may alter my plan and copy the bad drive into an image file on my USB first, then do the last steps and copy the image to the new drive and then try copying only the missing data from the original drive... or better, if I can also copy only the first 7GB from the original so I don't have to risk messing up my original drive, but I don't yet know how to copy only part of a drive without just using a hex editor, let alone restoring pieces of data from the smaller file... but knowing which files are actually bad will help me a lot.

 

 

Sorry for the verbose post... I'm still not sure how to copy just the good parts of data from a backup copy into all the places the mapfile marks as bad after cloning, I just know you can because it talks about it in the help page. The commands and stuff are still confusing since I've never worked with linux stuff before now.  I also know only how to make it write BADSECTOR to the bad sectors after it does the clone, not during... I suppose I can just do that instead.


Edited by DChronos, 19 July 2016 - 12:40 AM.


#4 JohnC_21

JohnC_21

  • Members
  • 24,623 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:45 PM

Posted 19 July 2016 - 07:32 AM

From my understanding you still have the original drive. You stated you only added a few programs and a lot of data to the bad drive. Why not clone the original drive to the free drive.

 

From your post you said the computer no longer boots.You can attach the bad drive using an enclosure,USB adapter, or boot a live linux disk on the tower with the bad drive and copy the data to an external drive. If the bad drive still spins up the live linux disk will see your data and be able to copy it as long as it's not on a bad sector. Copy the data from the external to your newly cloned drive and install any other programs.

 

I am only advising this because I looked at the manual and copying what sectors you want is out of my skill level though somebody else on the forum may have used this option of ddrescue.

 

As a note, the ddrescue on UBCD is an older version than the current one. You did see the ddrescue manual, correct? Here is the version history.



#5 DChronos

DChronos
  • Topic Starter

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:02:45 PM

Posted 19 July 2016 - 08:49 AM

Because the now-bad drive has saved sessions in programs that I don't want to lose, if I can help it, and those didn't exist on the original drive.

 

I used ddrescue to clone the mac drive and stored that on my external backup. I also used HDAT2 to fill the area on the replacement drive where the bad sectors are going to be with HDAT, so if ddrescue doesn't copy the bad sector areas, I can find them in a hex editor... but not sure about how it'll act when restoring a disk image from file to a disk, if it will overwrite those anyway or not write sectors that were marked bad... I don't know.

 

Now I need to do the clone... probably to disk image file first.

 

I've read through the changelogs and don't see anything added or changed of the functions I need to use, save for changing long names of commands that already existed at the last update of parted magic.  Do you know what version of ddrescue is in UBCD's current parted magic?



#6 JohnC_21

JohnC_21

  • Members
  • 24,623 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:45 PM

Posted 19 July 2016 - 09:24 AM

Can you get a version with this command

ddrescue --help


#7 DChronos

DChronos
  • Topic Starter

  • Members
  • 7 posts
  • OFFLINE
  •  
  • Local time:02:45 PM

Posted 19 July 2016 - 07:51 PM

It's 1.17.

 

Right now, I'm trying to figure out how to clone only part of my original drive so I can compare the good drive data with the bad sector area in HxD... I just need up to the first 6GB of the original drive to do a file comparison, the rest is error free. Can I use ddrescue or another program in Parted Magic to clone only the first 6GB of sectors? Hexedit might work, too, if I can change the line width to 16 bytes.

 

Edit: Actually, if I specify -s and give the byte number in the sector in the 6th GB of data I want to copy to, would that work?

 

Edit 2: I figured it out, -s does work, but I think it needs to be a byte value in a multiple of 512, or whatever the sector size happens to be set to. I just tested ddrescue -d -s 1024 /dev/sda test.img test.txt and it created a 1024 byte binary file cloning the first 1024 bytes of the drive I'm toying around with.


Edited by DChronos, 19 July 2016 - 08:33 PM.


#8 RolandJS

RolandJS

  • Members
  • 4,539 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Austin TX metro area
  • Local time:01:45 PM

Posted 02 August 2016 - 09:45 AM

This thread's way above my pay-grade, however, it's my understanding:

-- one either clones the entire source hard-drive onto a target hard-drive; or

-- one makes a full image of any source HD's partition which can be restored onto an equal or larger target HD; or

-- one makes an image of hand-picked folders/files from a source HD and restore that image onto any target HD

Now, concerning bad sectors on source HD, I have seen some very deep and thorough threads over in hddguru.com forums about this.  From scuttlebutt here and elsewhere, you are probably going to do ok with making precise targeted images, not clones.

DChronis, I'd like to learn from you!  I'll be watching this thread, you are a grandmaster, I'm only a grasshopper.


"Take care of thy backups and thy restores shall take care of thee."  -- Ben Franklin revisited.

http://collegecafe.fr.yuku.com/forums/45/Computer-Technologies/

Backup, backup, backup! -- Lady Fitzgerald (w7forums)

Clone or Image often! Backup... -- RockE (WSL)





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users