Page 1 of 1

Some options missed when dealing with a disk image

Posted: 10 Jan 2016, 20:41
by StefanS

I'm quite successfully dealing with the image of a corrupt ext3 partition (thanks!), but I have some questions:

When saving whole directories, is it possible to only copy the undeleted files/subdirectories? i.e., not those marked in red? Otherwise, I will have to either ignore these unwanted files, or I would have to find them on the regenerated directory structure, which would be very tedious (root partition with thousands of files in the directory tree...)

And can I get a complete listing of the files in the image as a text output, analogous to "ls -R --full-time > listing", enriched with additional markers (e.g., "not/partially/fully recovered", "deleted file")? Otherwise, it is hopeless to find out what I have to scrape from some backups or maybe reinstall...

Also, I was all missing symbolic links etc., these were just silently not created.

Maybe I'm just missing some existing options?

Thank you!

If it is of interest, some background information:
Root partition defective (could no longer boot; saving to a partition image with "dd if=/dev/sda5 of=sda5.img bs=..." failed at some place. I tried "dd conv=noerror...", which worked. Repairing this image with fsck: results in lots of entries in lost+found and no hints at all what happened. So I tried testdisk, which is much more appropriate and shows that most can be recovered. I also tried ddrescue instead of dd, but this resulted in an image which could neither be mounted nor be inspected by testdisk. (Maybe it is because disk errors are spreading, so I will not touch the physical disk unless I know why I should.)

I also tried extundelete and ext4magic. These do not work on either partition image ("Error 2133571364 while reading journal") but I might not have tried everything possible.


Re: Some options missed when dealing with a disk image

Posted: 11 Jan 2016, 07:30
by cgrenier
When listing the files, press 'h' to hide delete files.

The testdisk.log file will contains a copy of the file listing if you use

Code: Select all

testdisk /log /cmd image.dd advanced,list,recursive,fullpathname

Re: Some options missed when dealing with a disk image

Posted: 12 Jan 2016, 07:59
by StefanS

Thanks for the quick reply. But the process won't stop, the logfile becomes larger than the partition image. It has repeating sections about the log of an broken upgrade of a slackware package. I do not need this file, but it causes an endless loop, so I would like to exclude this file.

The logfile contains repeating lines: "ext2fs_dir_iterate failed with error 2133571363.". First seemingly at random, later in a repeating pattern interspersed with long temporary directory names.

Also, I do not see where the regenerated files are saved, if any.

I see two possibilities:

1. proceed interactively
2. proceed with batch processing, but excluding certain subdirs (which I can examine interactively later, if necessary) or certain files.

However, in any case it would be great if also symbolic links (and other other special file types) could be preserved.

Is there a possibility?


Re: Some options missed when dealing with a disk image

Posted: 17 Jan 2016, 15:45
by StefanS

I could recover the broken partition using a old backup, reinstalling packages from my Slackware Linux installation, and - most important - retrieving single directories/files from the broken partition image which were my additions. For the latter, I had to use testdisk interactively because otherwise the batch process was caught in an endless loop, causing an ever-growing log file. Luckily, the broken partition was a system partition with only few additions.

Thanks a lot to the testdisk team! Anyway, I'd still like to know some things - you never know what will happen...

(1) is testdisk able to recover symbolic links (which had been created by "ln -s") in an ext2/ext3/ext4 filesystem?
(2) can subdirectories be excluded from batch processing (e.g., when they are broken and cause an endless loop)?

Yours, Stefan