1

I try to rescue data from my 1TB external drive using ddrescue because I accidentally deleted everything from it. Practically I have to face exactly the same situation like posted here: How to split a ddrescue disk image and how to use it again? but in that question, the first part, which is my whole question, has not been answered, and during reading the forums, I can find guides only to different situations than mine, i.e. resume to the same location, resume to other drive with exactly the same storage capacity than the first one, rescue multiple partitions to an external HDD with greater capacity than together all of them that have to be rescued etc.

So, my question is: I have to rescue data from my 1TB external HDD. For that purpose, I have an external HDD with around 935 GB (not GiB) free space on it, furthermore, on the windows partition on my laptop, which is currently empty, I have around 222 GB free space. I did the following: I started ddrescue with

/# ddrescue -n -s900GB /dev/sdc /media/misi/Maxtor/recovery/recovery_part1.img /home/misi/recovery_log.txt

to save just the first 900 GB to the external drive. Everything went fine, I received the following output:

GNU ddrescue 1.17
Press Ctrl-C to interrupt
rescued:   900000 MB,  errsize:       0 B,  current rate:   64104 kB/s
   ipos:   899999 MB,   errors:       0,    average rate:   38981 kB/s
   opos:   899999 MB,    time since last successful read:       0 s
Finished

Then, I continued to save the rest to the windows partition:

/# ddrescue -n /dev/sdc /windows/recovery_part2.img /home/misi/recovery_log.txt

But it did not work:

GNU ddrescue 1.17
Press Ctrl-C to interrupt
Initial status (read from logfile)
rescued:   900000 MB,  errsize:       0 B,  errors:       0
Current status
rescued:   900000 MB,  errsize:       0 B,  current rate:        0 B/s
   ipos:   900000 MB,   errors:       0,    average rate:        0 B/s
   opos:   900000 MB,    time since last successful read:       3 s
Copying non-tried blocks...
ddrescue: write error: Invalid argument

According to the question posted above and the other guides and man pages, however, it should. I was able to continue rescuing the file to the other external HDD and I was also able to restart the whole progress to the windows partition. I interrupted both processes since I just wanted to test if I have some problems with e.g. my windows partition. I also tried to use an other log file and manually specifying the starting position, retrieved from the first log file (it changed a bit since I continued rescuing there for a few seconds as mentioned before):

/# ddrescue -n -i900862115840 -o900862115840 /dev/sdc /windows/recovery_part2.img /home/misi/recovery_log_2.txt

and received the same Invalid argument error message as mentioned before. What am I doing wrong, and what is the correct mode to save the biggest part of my data to the other external drive, and the rest to my windows partition? Thanks for the replies in advance!

0

I think ddrescue was never designed to work this way. There's no point in analyzing what you did wrong, because the right way is indeed in this answer to the question you refer to. I admit its usage in this context may not be obvious, especially to a person who's not familiar with "everything is a file" concept in Unix.

The answer describes a way to concatenate two files a and b into one virtual device (special file) /dev/mapper/merge.

Create two files a and b (see how you can do this) in your two available filesystems, so the sum of their sizes equals or exceeds the size of your /dev/sdc.

Apply this fragment of the linked answer (using your proper paths to a and b):

losetup /dev/loop1 a
losetup /dev/loop2 b
s() { blockdev --getsize "$1"; }
dmsetup create merge << EOF
0 $(s /dev/loop1) linear /dev/loop1 0
$(s /dev/loop1) $(s /dev/loop2) linear /dev/loop2 0
EOF

Then use /dev/mapper/merge instead of recovery_part1.img in ddrescue invocation.

The content of /dev/mapper/merge is basically the same as the output of cat /your/path/to/a /your/different/path/to/b, but merge is writable and seekable.

Note: /dev/mapper/merge won't survive a reboot, however of course your files a and b will. You just have to recreate /dev/mapper/merge (using the above code) if you want to work with it after the reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.