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!

  • You used the same log for both recoveries! /home/misi/recovery_log.txt when splitting you probably should use a different log file for each one, that may be why ddrescue's complaining. – Frankie Jun 20 '20 at 23:58

2 Answers2

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.

0

Edit: Not working fine.

Settings of -i200Gib -s200Mib creates a 200G file, extremely fast. Obviously I have not understood the paramters, so you'd be besst to ignore everything I said below. My bad. I am going to back to the drawing board - will do some testing and update if/when I sort it out.


Working fine for me. I use -i to indicate the initial position, and -s to indicate the stop position. I am currently processing a 4TB WD "MyPassport" portable drive that died. 200 GiB at a time, then using PhotoRec to extract the files in each 200GiB image. I was following the examples provided at the end of the Algorithm section at the online ddrescue manual I am chunking the output because:

  • I don't have enough space on my server array to stash a full 4TB image, and
  • It provides a bit of reassurance that I am recovering files as I go (rather than waiting Ages for a full-disk ddrescue parsing effort to complete before recovering files)

P.S. PhotoRec reckons it can extract files spanned across images (see end of this section) by using the question mark as a wildcard but I have not verified this.

Good luck!

JasonP
  • 1