New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Switcher Hangout The place for switchers to discuss their new machines, and how to work with OS X. General support can be had here for newbie stuff, like "How do I restart my new iMac?" :)

Help with GNU ddrescue in Terminal


Post Reply New Thread Subscribe

 
Thread Tools
demonbabies

 
Member Since: Apr 22, 2007
Posts: 6
demonbabies is on a distinguished road

demonbabies is offline
I am attempting to recover files off of a failing external hard drive onto another external and I have heard nothing but great things about 'gnu ddrescue'

I have spent the past 4 hours trying to grasp the concept of installing ddrescue into my computer and running it. I used the basic 'dd' command in the past and it was pretty simple. ddrescue is a bit more complex for me.

Could someone please guide me through this process step by step please...starting with the installation process and onto what code needs to be typed to clone one external to another??

THANKS!!!
QUOTE Thanks
Discerptor

 
Discerptor's Avatar
 
Member Since: Aug 02, 2005
Posts: 1,229
Discerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to all
Mac Specs: 2.6GHz Core i7 15" MacBook Pro - 8GB DDR3 SDRAM - 750GB 7200 RPM HDD - GeForce 650M GT 1GB VRAM

Discerptor is offline
INSTALLATION INSTRUCTIONS

There are two ways to do this. There's the manly emacs/vi/ed user's way, and then there's the poor excuse for a girly TextEdit user's way. First, the manly way:

1. Download and install the Xcode Developer Tools. If you want a slightly outdated but still perfectly usable free version, get it from developer.apple.com using a free account. If you want the latest and greatest and are willing to pay for it, get it from the Mac App Store.

2. Download the file named ddrescue-1.14.tar.gz from here.

3. Open the file by double-clicking it, and you should have a folder named ddrescue-1.14 in your Downloads folder now (assuming that's where your downloads are set to go).

4. Open Terminal. You can Spotlight it or navigate to /Applications/Utilities/Terminal.app. Your choice.

5. Enter the following command to get into that folder you created:

Code:
cd ~/Downloads
6. Now that you're inside, you do the standard stuff. I normally put this all together, but since you seem new to this, I'll explain what each step does after typing it out.

Code:
./configure
That command runs a script in the folder that checks your system setup, including what versions of what compilers are on your computer, default flags for certain options you don't care about, and whether you have the packages that are dependencies for installing ddrescue and any optional features. If you see an error message that says you're missing a dependency, then find that package and install it. When that's all done, it creates a Makefile with all the instructions your computer needs to compile and later install the source code properly when you type in the next command (which you only have if you installed Xcode).

Code:
make
Exactly what it sounds like. It uses the newly created Makefile to build your shiny new executables and whatnot. Do not continue to the next step if this does not complete successfully and it exits with an error.

Code:
sudo make install
This is slightly loaded since it includes two things you don't know about. In UNIX systems, typing "sudo" before a command allows you to run just that command with superuser privileges. This means you'll be allowed to, for instance, write to folders outside your home folder (which this is going to do). make install is using the make command you typed before, but specifically asking it to run a certain set of instructions in the Makefile labeled "install." As you might imagine, this section of the Makefile has the instructions needed to properly install the files you've built to their appropriate locations. Strictly speaking, you could have skipped the previous step, but if something goes wrong in the build process, I prefer to keep the permissions outside the superuser domain since weird permissions issues might pop up the next time you try it.

7. Once this is all done, you should now be able to run ddrescue right from the Terminal.

And NOW, the other way:

1. Download and install Fink using the instructions appropriate to your OS X version here. Note that if you're running 10.6, you will have to do a source install, which means you will have to install the Xcode Developer tools as in Step 1 in the first method.

2. From Terminal, type:

Code:
sudo fink install ddrescue
3. Now you'll be able to run ddrescue right from the Terminal.

USE INSTRUCTIONS

The typical way to use ddrescue is to, from the commandline, type:

Code:
ddrescue -v infile outfile
All that said, not to sound like people on Linux forums, but your description of what exactly you're trying to do is likely incomplete, so my best advice to you for picking all the options that might best suit you and whatnot is to RTFM.
QUOTE Thanks
demonbabies

 
Member Since: Apr 22, 2007
Posts: 6
demonbabies is on a distinguished road

demonbabies is offline
Wow, thank you!! Very helpful!!

Couple quick questions.

The first way you explained the installation process...that is without having to d/l Xcode, correct? It is a 4gb file...trying to find a way to not have to wait all day while it downloads.

Next question is during the 'infile outfile' part...how do I specify which drive is bad and which drive is good? Do I just enter in the volume path?

thanks!!!!
QUOTE Thanks
Discerptor

 
Discerptor's Avatar
 
Member Since: Aug 02, 2005
Posts: 1,229
Discerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to all
Mac Specs: 2.6GHz Core i7 15" MacBook Pro - 8GB DDR3 SDRAM - 750GB 7200 RPM HDD - GeForce 650M GT 1GB VRAM

Discerptor is offline
The first way, without Fink, is the one where you definitely have to install Xcode. The second way, with Fink, is the one where you probably have to install Xcode (since it is necessary if you're running Snow Leopard, which you probably are). If you're worried about the download size, Xcode is an optional install with your OS X discs. I'd recommend installing it first regardless. It makes the tools you can access through the command line interface that much more powerful.

When you specify a file, you have to enter the entire path to the file (unless it's in the working directory you're in with Terminal at that moment). Easy way to get the full path written out properly is to open a Finder window and drag the file from there into the Terminal window. The infile would be the original file you're copying, and the outfile would be the path/name of the file you want to copy it to (if it doesn't exist, it'll create a file with that name for you).
QUOTE Thanks
demonbabies

 
Member Since: Apr 22, 2007
Posts: 6
demonbabies is on a distinguished road

demonbabies is offline
Cool! Thanks!!! So I end the 'outfile' with a DMG filename then, correct? Much like DD?

Has anyone ever experienced issues with Terminal crashing out 1/4 way through this process?? When I tried DD I would get about 100gb into a 1tb drive and it would freeze up or crash. I am hoping this will not happen with ddrescue.
QUOTE Thanks
Discerptor

 
Discerptor's Avatar
 
Member Since: Aug 02, 2005
Posts: 1,229
Discerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to all
Mac Specs: 2.6GHz Core i7 15" MacBook Pro - 8GB DDR3 SDRAM - 750GB 7200 RPM HDD - GeForce 650M GT 1GB VRAM

Discerptor is offline
You want to use the device file path to the hard drive ideally, not /Volumes. You can see this most readily by typing in Terminal:
Code:
diskutil list
And you will see /dev/blahblah as the names for your attached drives. Note that if you don't see your damaged hard drive there, chances are it ain't getting saved by ddrescue.
QUOTE Thanks
Discerptor

 
Discerptor's Avatar
 
Member Since: Aug 02, 2005
Posts: 1,229
Discerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to allDiscerptor is a name known to all
Mac Specs: 2.6GHz Core i7 15" MacBook Pro - 8GB DDR3 SDRAM - 750GB 7200 RPM HDD - GeForce 650M GT 1GB VRAM

Discerptor is offline
And by popular demand, I have an alternate version of steps if you're more of a GUI-inclined person that doesn't want to use ddrescue.

INSTALLATION INSTRUCTIONS

1. Download Carbon Copy Cloner from here.

2. Mount the Disk Image file and drag the app to your Applications folder.

USE INSTRUCTIONS

1. Open Carbon Copy Cloner.

2. Pick the failing hard drive from the drop down menu under "Source Disk."

3. Pick "New disk image..." under "Target Disk" and pick a location/name for it.

4. Hit the "Clone" button.

5. Profit. And pray. But mostly Profit.
QUOTE Thanks
bobtomay

 
bobtomay's Avatar
 
Member Since: Dec 22, 2006
Location: Texas, where else?
Posts: 24,592
bobtomay has a reputation beyond reputebobtomay has a reputation beyond reputebobtomay has a reputation beyond reputebobtomay has a reputation beyond reputebobtomay has a reputation beyond reputebobtomay has a reputation beyond reputebobtomay has a reputation beyond reputebobtomay has a reputation beyond reputebobtomay has a reputation beyond reputebobtomay has a reputation beyond reputebobtomay has a reputation beyond repute
Mac Specs: 15" MBP 2.33 C2D 256 4GB, MBA 13" i7 1.8, MB 2.0 2GB, Nano 4th, 3GS, iPad 1

bobtomay is offline
lol, thanks from us wimps out here

I cannot be held responsible for the things that come out of my mouth.
In the Windows world, most everything folks don't understand is called a virus.
QUOTE Thanks
chas_m

 
chas_m's Avatar
 
Member Since: Jan 22, 2010
Location: Victoria, BC
Posts: 15,708
chas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond repute
Mac Specs: 2009 MBP, Black speakers, Black Benq second monitor, black(ish) iPhone 5s, Black 2012 iPad, etc.

chas_m is offline
+1 for the CCC alternative!
QUOTE Thanks
bernk

 
Member Since: Oct 26, 2011
Posts: 3
bernk is on a distinguished road

bernk is offline
This has been a very useful thread, thank you guys!

I have managed to install and run ddrescue. I have read most of the manual as suggested so subtly by Discerptor

I have a 1TB WD Elements external USB HDD which fell from a coffee table and suffered some sort of mechanical damage. It can no longer write, and reads very, very slowly. I'm trying to copy it to an almost identical 1TB WD drive using:
Code:
ddrescue -f -n -v /dev/disk2 /dev/disk1 logfile
I've left it running overnight and it has so far only rescued 1093 MB! The average rate is a staggering 24376 B/s… is there anything else I can try? Or am I doing something wrong? …at this rate it will take 1.42 years!

Thank you.
QUOTE Thanks
bernk

 
Member Since: Oct 26, 2011
Posts: 3
bernk is on a distinguished road

bernk is offline
Is it possible to use ddrescue to rescue a specific directory from one external HDD to another?
QUOTE Thanks
chas_m

 
chas_m's Avatar
 
Member Since: Jan 22, 2010
Location: Victoria, BC
Posts: 15,708
chas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond reputechas_m has a reputation beyond repute
Mac Specs: 2009 MBP, Black speakers, Black Benq second monitor, black(ish) iPhone 5s, Black 2012 iPad, etc.

chas_m is offline
Quote:
Originally Posted by bernk View Post
I've left it running overnight and it has so far only rescued 1093 MB! The average rate is a staggering 24376 B/s… is there anything else I can try? Or am I doing something wrong? …at this rate it will take 1.42 years!

Thank you.
It is a FAILING hard drive, didn't you say? If it's FAILING, then reading data CORRECTLY off of it is very difficult and time-consuming. You're just going to have to give it time (I doubt it will actually take 1.42 years, but if you have a LOT of stuff that ALL has to be rescued, then it might!).

As for other things to try, you might consider smacking yourself upside the head for not having backed up all this important material earlier. It won't actually help this situation, but may remind you not to let that happen again.

Good luck!
QUOTE Thanks
bernk

 
Member Since: Oct 26, 2011
Posts: 3
bernk is on a distinguished road

bernk is offline
Quote:
Originally Posted by chas_m View Post
It is a FAILING hard drive, didn't you say? If it's FAILING, then reading data CORRECTLY off of it is very difficult and time-consuming. You're just going to have to give it time (I doubt it will actually take 1.42 years, but if you have a LOT of stuff that ALL has to be rescued, then it might!).

As for other things to try, you might consider smacking yourself upside the head for not having backed up all this important material earlier. It won't actually help this situation, but may remind you not to let that happen again.

Good luck!
No need for the condescending tone. I'm new to the ddrescue command and by no means a *nix pro, but I'm not an idiot. I was simply asking if there is anything I could change in my command that might speed up the process.

I haven't actually lost any data, because I do have it stored on 2 other drives at a different geographical location. I just thought it would be a good learning experience to see what could be done about a damaged drive.

The strange thing is I'm seeing far, far better performance simply copying files from the damaged drive to another in the Finder. Theoretically there shouldn't be any damaged or corrupted files on the drive as it was very new and running perfectly until its unfortunate little accident. It still takes a very long time to copy a few GBs, but not months or years.
QUOTE Thanks

Post Reply New Thread Subscribe


« iPhoto and duplicates | Movies & Pictures »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Terminal Won't Open icefall5 OS X - Operating System 7 08-25-2010 08:26 AM
Hello World app takes 45s to start from the terminal, gcc, gdb and dtrace problems Ethan asdf OS X - Development and Darwin 5 02-12-2009 05:03 PM
C++ in terminal frike OS X - Development and Darwin 2 04-04-2008 10:52 AM
Terminal problems please help CliveO OS X - Operating System 6 03-20-2007 10:04 AM
Terminal Help rs2sensen OS X - Apps and Games 1 04-25-2005 10:52 PM

All times are GMT -4. The time now is 07:58 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?