ddrescue script

To reduce errors in running ddrescue, I wrote a script that takes most of my human typos out of the equation. I am actually better with the command line then most linux guis. The command line works on virtually all forms of linux the same.

.

I love scripting. Makes my life easier.

I hope it didn't offend you Mindful, but I added some very basic error checking.
Also, this will list the available disks for you, so no need to to peek in /dev

I love scripting too. Problem is, outside of rudimentary scripts, I'm not really very good at it. I can usually look at someone else's script and figure out how it works, but writing from scratch is a whole other matter :eek: So, thanks to both of you for contributing this.

Learning proper bash scripting is high on my list of things to do.
 
Cool. Thanks

Im assuming I copy and paste the text into some sort of file, name it, and then execute it from the terminal prompt in Linux?

So...

1. Whats the best path to store the file? user directory?

2. how does one execute the file from terminal? Can this be run from a desktop shortcut?

As you can see Im not overly confident with Linux. Years ago I played with all this stuff but long forgotten now. Seems I need to renew my interest though as so many knowledgeable people are pointing to this system as #1 for data recovery.

Would appreciate any help people can offer on the simpler aspects :p

Thanks

J

Being a script it is best to run it from the command line. You could create a desktop shortcut I suppose, but to be proper about it, the shortcut should open a terminal and execute the script... the output from the script can be rather useful and/or important.

So, copy the script as is and paste it into a new file named..... imagedrive.sh for good measure. No, you don't need the .sh, Linux/Unix doesn't give two squirts of Llama urine about the extension. But it does help identify it as a shell script quickly when you see it.

Put the script somewhere in your PATH. Old farts like me still have a ~/bin they store personal stuff in, but if /usr/local/bin is in your path that'd be the next best bet. If you just want to store it in your home directory you can execute it with ./imagedrive.sh <- that tells the shell that you want to execute something that is currently in the the directory you are in... that's what the "./" does.
If I've confused you already then just store it in /bin and call it a day.

Now tell the shell that the script is to be executed, do this by running the following commend:
chmod +x /bin/imagedrive.sh

After that, just type the command in a terminal and off it goes:
imagedrive.sh
 
Code:
#!/bin/sh -e

If I understand correctly the '-e' option causes the script to exit if any of its lines have an error. Without that option, the script would continue to run lines of code even if one line produces an error.

Edit added later //

Or you can do this
Code:
#!/bin/sh
set -e
 
Last edited by a moderator:
May I butt in.

One thing I found confusing when first learning to use "ddrescue", is there are actually 2 different "programs".

The OP mentions using ddrescue.

16K's recommendation of Bootmed Plus uses dd_rescue.

Two different programs, with ddrescue being more powerful and containing more options.

I started using Bootmed Plus and it works great, but lacks many of the features that may be needed in certain situations.

I'm not knocking Bootmed Plus, it's great and is what got me started. The original suggestion of using it came from 16k in another thread.

I finally had a chance to double check this today and not sure about where your information comes from so wanted to ask what the source was?

Looking on the bootmed help pages, the author is referencing GNU ddrescue, which is the 'latest' incarnation - stupidly named the same as the previous programs for a reason known only to its author, Antonio Diaz.

So from what Im seeing, BootMed is actually using "GNU ddrescue"

Confused.
 
I finally had a chance to double check this today and not sure about where your information comes from so wanted to ask what the source was?

Looking on the bootmed help pages, the author is referencing GNU ddrescue, which is the 'latest' incarnation - stupidly named the same as the previous programs for a reason known only to its author, Antonio Diaz.

So from what Im seeing, BootMed is actually using "GNU ddrescue"

Confused.


Yes,

I know they reference ddrescue, but as per the video and actual use, it is actually using dd_rescue, (with the underscore, and not GNU ddrescue). Apparently the person who created the GUI is a little confused.

Look at the video when it brings up the terminal window. Look closely at the command line. It is running dd_rescue not ddrescue as referenced in their material. This is also what I get when I use BootMed Plus.

http://www.bootmedplus.com/tutorials/image10/

Confused the heck out of me also!

Did you get to try the link showing how to use it with Parted Magic?
View that and try it......it will all make sense then. Try it, I think you will like it. Now that I understand it, I have a lot more options than what is offered in BootMed Plus. However, it was only $3.99 and got me started.
 
Back
Top