Some options missed when dealing with a disk image

Using TestDisk to repair the filesystem
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read
Post Reply
Posts: 3
Joined: 10 Jan 2016, 18:52

Some options missed when dealing with a disk image

#1 Post by StefanS » 10 Jan 2016, 20:41


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.


Sponsored links

User avatar
Site Admin
Posts: 4186
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France

Re: Some options missed when dealing with a disk image

#2 Post by cgrenier » 11 Jan 2016, 07:30

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

Posts: 3
Joined: 10 Jan 2016, 18:52

Re: Some options missed when dealing with a disk image

#3 Post by StefanS » 12 Jan 2016, 07:59


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?


Posts: 3
Joined: 10 Jan 2016, 18:52

Re: Some options missed when dealing with a disk image

#4 Post by StefanS » 17 Jan 2016, 15:45


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

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests