Package: e2fsprogs
Version: 1.44.5-1+deb10u3 (armhf)

A deleted file can not be recovered on EXT4 partitions when created
using the  "64bit" and "metadata_csum" flags.
See test case below, I run Debian 10 buster on a BananaPi BPI-M1.
The EXT4 partition is re-created on the same drive and partition. I
re-tried this multiple times always with the same result, the test
file could always be recovered when both "64bit" and "metadata_csum"
were unset in the file system, and it could not be recovered when they
were set.

mkfs.ext4 -O 
has_journal,ext_attr,resize_inode,dir_index,filetype,extent,flex_bg,sparse_super,large_file,huge_file,uninit_bg,dir_nlink,extra_isize,^64bit,^metadata_csum
/dev/sdl1
mke2fs 1.44.5 (15-Dec-2018)
/dev/sdl1 contains a ext4 file system
        last mounted on /mnt on Thu Sep  3 20:15:24 2020
Proceed anyway? (y,N) y
Creating filesystem with 366284390 4k blocks and 91578368 inodes
Filesystem UUID: 6072e511-7f38-4685-9e5b-e168bfef5ed4
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

mount /dev/sdl1 /mnt && echo "delete" > /mnt/un && sync && rm /mnt/un
&& sync && umount /mnt

rm restore/* && extundelete --restore-all -o restore /dev/sdl1 && cat restore/un
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 11179 groups loaded.
Loading journal descriptors ... 15 descriptors loaded.
Searching for recoverable inodes in directory / ...
1 recoverable inodes found.
Looking through the directory structure for deleted files ...
0 recoverable inodes still lost.
delete

mkfs.ext4 -O 
has_journal,ext_attr,resize_inode,dir_index,filetype,extent,flex_bg,sparse_super,large_file,huge_file,uninit_bg,dir_nlink,extra_isize,64bit,metadata_csum
/dev/sdl1
mke2fs 1.44.5 (15-Dec-2018)
/dev/sdl1 contains a ext4 file system
        last mounted on /mnt on Thu Sep  3 20:18:22 2020
Proceed anyway? (y,N) y
Creating filesystem with 366284390 4k blocks and 91578368 inodes
Filesystem UUID: 5e744287-578e-4dc5-adf0-5e780bee2fdf
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

mount /dev/sdl1 /mnt && echo "delete" > /mnt/un && sync && rm /mnt/un
&& sync && umount /mnt

rm restore/* && extundelete --restore-all -o restore /dev/sdl1 && cat restore/un
NOTICE: Extended attributes are not restored.
Loading filesystem metadata ... 11179 groups loaded.
Loading journal descriptors ... 0 descriptors loaded.
Searching for recoverable inodes in directory / ...
0 recoverable inodes found.
Looking through the directory structure for deleted files ...
0 recoverable inodes still lost.
No files were undeleted.
cat: restore/un: No such file or directory

   Jonas

Reply via email to