Jump to content

Restore Image to HDD - help needed trying to use DDRescue command lines


Recommended Posts

Posted

First off I am in way over my head on this but thought it was worth trying.

 

Old laptop with encrypted HDD which refused to boot to OS. Read up on some articles and then used Clonezilla to boot and dd rescue to make an image of the disk on to an external HDD - following I thought closely instructions/commands in a specific article. ( https://html5.litten.com/make-full-image-of-broken-raw-infected-or-encrypted-hard-drive-with-free-tools/ )

 

Played around with the original disk and ended up completely cleaning it and formatting it and putting it back in the laptop.

 

Now I have been trying to run the commands in the article to copy the image from an external HDD back to the original disk. I cannot seem to get the source file to show up so not sure how I can get it to copy across......

On my externall HDD the file just shows as image.dd - there is a separate rescue log file as well. I don't seem to have the file structure suggested in the article which makes me wonder if I simply screwed up when copying the image across but the log file shows the same command........?

Quote

# Mapfile. Created by GNU ddrescue version 1.23
# Command line: ddrescue -r 3 /dev/sda /home/user/imgdrive/image.dd /home/user/imgdrive/rescuelog.log
# Start time:   2019-03-28 20:12:01
# Current time: 2019-03-28 22:13:41
# Finished
# current_pos  current_status  current_pass
0x25433D0000     +               1
#      pos        size  status
0x00000000  0x25433D6000  +
 

When I use the command "/imgdrv/dev/images$ ls" as per the article I get back

-bash: /imgdrv/devimages$: No such file or directory

 

Tried variations on the command without success and spent hours looking online making me even more confused. Can anybody shed any light or know if I can use Clonezilla to put the image back? (just tried this and cannot get past the directory for the image repository - only option is the Recycle bin. Is my brand new HDD faulty or do I need to partition it with the image?)

 

 

Posted

The guy on the linked website is quite inconsistent in his descriptions. In the “Restoring Image…” section he does not use the same location as he backed up to.

Let me see if I can clear up some confusion first. The “/imgdrv/dev/images$” is not part of the command. It is part of the command prompt. In Unix/Linux (Debian too) “~” will expand to your home location, in your case probably “/home/user”, the $ is the shell prompt, the dollar sign indicating that you’re logged in as a non root user. If unsure, you can always find out where you are with the “pwd” command.

The website inconsistency is that he is backing up to “/home/user/imgdrive/” but restoring from a different one, “/home/user/imgdrive/dev/images/”.

I am assuming that you followed Step 5 in the backup section to mount your partition. So assuming that “user/imgdrive” directory is already there, you should just mount the partition (this assuming /dev/sdc1 is your external drive):

 

sudo ntfs-3g /dev/sdc1 /home/user/imgdrive

You can then change directory into the mounted partition:

 

cd imgdrive

The command prompt would then be:

user@debian:~/imgdrive$     <--- This is your mounted external drive partition

You can then list the files in that directory with list file command “ls”

Again, assuming that you followed the instructions in the Backup section, and judging from the log file, you should be able to restore your image with the following command:

sudo ddrescue --force /home/user/imgdrive/image.dd /dev/sda

I am doing a lot of assuming, so if I am unclear somewhere, let me know.

Posted
11 hours ago, SpaceKadet said:

The guy on the linked website is quite inconsistent in his descriptions.

Thanks for taking the trouble to help. Yes I noticed this when I came to try and restore the image and confused me even more. Especially as I had no previous knowledge of Linux commands or how to use them..............to the extent I ended up creating a new partition on the external disk and copying the image across to it to see if that made any difference........????

 

After literally days of googleing and reading articles and forums to try and understand what I was trying to do I think I finally cracked it yesterday - all be it still don't really understand.

 

As you say I needed to mount the image but could not seem to find it using any of the commands. So finding an article yesterday just created a new directory - 

sudo mkdir /media/external

sudo mount -t ntfs-3g /dev/sdb2 /media/external

sudo ddrescue --force /media/external/image.dd /dev/sda

 

and it started to copy back.

Unfortunately the laptop just died which I think/hope was just due to overheating. The third time it got to around 60% and I am trying again now. Each time however I have had to reuse the mkdir command before the mount command so it does not seem to maintain the new directory/partition - perhaps because using the Clonezilla command line interface?

 

On the mount command do you know what the -t means?

 

Thanks again

Posted

Good that you're making progress.

Yes, I realized that you lost the directory you created. This is because you are booting from the thumb drive. Any changes to the file system will not be persistent across the boots. Your thumb drive is read only and any changes are done within a virtual file system within the computer's memory.

 

The -t options on the mount command stands for type of the file system to be mounted. In your case MS NTFS.

Posted
4 hours ago, SpaceKadet said:

Good that you're making progress.

Yes, I realized that you lost the directory you created. This is because you are booting from the thumb drive. Any changes to the file system will not be persistent across the boots. Your thumb drive is read only and any changes are done within a virtual file system within the computer's memory.

 

The -t options on the mount command stands for type of the file system to be mounted. In your case MS NTFS.

Thanks for the explanation. Makes a lot more sense to me now.

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.



×
×
  • Create New...