You are not logged in.

#1 2025-05-17 18:33:57

Kepis
Member
Registered: 2021-12-15
Posts: 86

Recover a folder from deletion on ext4

I just accidentaly deleted my photos folder because ranger broke on me and was showing me different filenames, then I was actually manipulating. As soon as I realized it I force-closed it and pressed the poweroff button until the laptop powered off.
Now I'm using my backup system on my flash drive.

I remember I managed to save some files once. But since then I haven't been able to find the app I used, nor match the quality of the restoration (old files back in the original folder structure) with any other software.

My system is on ext4. What can I do, given I know the file/folder name and the folder structure under it?
I assume it should be possible (since no change since the deletion was done to the disk) to find an old node in the home directory, that would contain the name of the deleted folder? Or maybe not, but since I know the names of files inside the folder, I could use that to scan the disk and find the node of the Pictures folder containing those files?

Last edited by Kepis (2025-05-17 18:39:12)

Offline

#2 2025-05-17 18:54:31

seth
Member
Registered: 2012-09-03
Posts: 64,087

Re: Recover a folder from deletion on ext4

You restore it from your backup… ? You do have backups?

and pressed the poweroff button

sad
Though extundelete and ext4magic are considered bitrot https://aur.archlinux.org/packages/extundelete is claimed to have worked for https://bbs.archlinux.org/viewtopic.php … 5#p2221065
Otherwise see https://wiki.archlinux.org/title/File_r … d_PhotoRec

Online

#3 2025-05-17 19:45:00

Kepis
Member
Registered: 2021-12-15
Posts: 86

Re: Recover a folder from deletion on ext4

seth wrote:

You restore it from your backup...?

Usually, I could. But I was getting to the end of editing a large batch of photos and I haven't backed up those edits yet.

I found this link: Hetman recovery tools test, but their software seems to be relient on snap, because it crashes with libgtk3 access violation errors.
Photorec I tried before. Maybe I was using it wrong, but it basically tried to copy all files from the disk to some recovery directory. And since it ignores the filesystem, there were no filenames to look for, nor any structure and I couldn't limit the recovery to some filetypes so it just filled my recovery folder with junk and I had to give up.

At some point in the past I made the unfortunate decission to disable journaling on my system. Do you know if extundelete/ext4magic can cope with that?

Edit: both ext... tools rely on the journal.

Last edited by Kepis (2025-05-17 20:12:16)

Offline

#4 2025-05-17 20:16:21

seth
Member
Registered: 2012-09-03
Posts: 64,087

Re: Recover a folder from deletion on ext4

The tool of choice would be testdisk.

Online

#5 2025-05-18 09:38:50

Kepis
Member
Registered: 2021-12-15
Posts: 86

Re: Recover a folder from deletion on ext4

Unfortunately testdisk can undelete only on ext2 partitions and photorec recognized many unusual file extensions, except actual photo extensions like jxl, avif, or dng. So I think this might be a lost cause.

Last edited by Kepis (2025-05-18 09:40:23)

Offline

#6 2025-05-18 15:04:21

seth
Member
Registered: 2012-09-03
Posts: 64,087

Re: Recover a folder from deletion on ext4

https://www.cgsecurity.org/testdisk_doc … e_fat.html
ext2/3/4 are the same basic thing => try.

Online

#7 2025-05-18 19:15:36

Kepis
Member
Registered: 2021-12-15
Posts: 86

Re: Recover a folder from deletion on ext4

I would love to, but the button in the TUI doesn't show up.

I tried the button on my FAT32 sdcard, where I previously had the raw files. And, although it saw the structure of files and names etc, all the files it recovered were recognized just as some data and none of the appropriate apps can read the files.

Last edited by Kepis (2025-05-18 19:16:03)

Offline

Board footer

Powered by FluxBB