cd /opt/program/bin rm -f program *OOPS!!!* extundelete --restore-file /dev/mmcblk0p2 /opt/program/bin/program
cp /opt/program/bin/RECOVERED_FILES/opt/program/bin/program /opt/program/bin rm -rf /opt/program/bin/RECOVERED_FILES
# Making the (40 MB) test file: dd if=/dev/zero of=testpartition.dd bs=4k count=1 seek=10k # Also, try with ext4 if e2fsprogs supports it # ext3 test file system mkfs.ext3 -b 4096 -I 256 -J size=4 testpartition.dd # ext3 with external journal test file system sudo mke2fs -O journal_dev -b 1024 /dev/ram0 65536 # Then do this, sudo mke2fs -b 1024 -J device=/dev/ram0 testpartition.dd # OR, # tune2fs -f -O ^has_journal testpartition.dd # sudo tune2fs -J device=/dev/ram0 testpartition.dd # Mount the test file: mkdir testpartition sudo mount -o loop -t ext3 testpartition.dd testpartition/ # Add files to the new filesystem: cd testpartition for (( n=1 ; n < 80 ; n++ )) ; do echo "The quick brown fox jumps over the lazy dog"; done > test.file1 for (( n=1 ; n < 50 ; n++ )) ; do echo "The quick brown fox jumps over the lazy dog"; done > test.file2 mkdir -p dir1/dir2 dir1/dir3/dir4 # Create a bunch of files to force dir4 to have an extended dir block. echo "Temporary file" > dir1/dir3/dir4/Supercalifragilisticexpialidocious.AntidisestablishmentarianismTreatise+ThereoncewasamanfromNantucket.Floccinaucinihilipilification echo "Temporary file" > dir1/dir3/dir4/AntidisestablishmentarianismTreatise+Supercalifragilisticexpialidocious-Floccinaucinihilipilification.ThereoncewasamanfromNantucket-AntidisestablishmentarianismTreatise+Supercalifragilisticexpialidocious echo "Temporary file" > dir1/dir3/dir4/ThereoncewasamanfromNantucket-Floccinaucinihilipilification.AntidisestablishmentarianismTreatise-Supercalifragilisticexpialidocious echo "Temporary file" > dir1/dir3/dir4/Floccinaucinihilipilification+ThereoncewasamanfromNantucket-AntidisestablishmentarianismTreatise.Floccinaucinihilipilification echo "Temporary file" > dir1/dir3/dir4/Supercalifragilisticexpialidocious.AntidisestablishmentarianismTreatise+ThereoncewasamanfromNantucket.Floccinaucinihilipilification2 echo "Temporary file" > dir1/dir3/dir4/AntidisestablishmentarianismTreatise+Supercalifragilisticexpialidocious-Floccinaucinihilipilification.ThereoncewasamanfromNantucket-AntidisestablishmentarianismTreatise+Supercalifragilisticexpialidocious2 echo "Temporary file" > dir1/dir3/dir4/ThereoncewasamanfromNantucket-Floccinaucinihilipilification.AntidisestablishmentarianismTreatise-Supercalifragilisticexpialidocious2 echo "Temporary file" > dir1/dir3/dir4/Floccinaucinihilipilification+ThereoncewasamanfromNantucket-AntidisestablishmentarianismTreatise.Floccinaucinihilipilification2 for (( n=1 ; n < 100 ; n++ )) ; do echo Lorem ipsum dolor sit amet.; done > dir1/dir3/dir4/test.file5 echo "This is a test" > dir1/dir3/dir4/trial1 sync # Wait a few seconds to ensure a new journal transaction sleep 6 # Delete objects from the file system rm -rf dir1/dir3/dir4 rm test.file2 sync # New tests mkdir -p dir5/dir6/dir7/dir8 for (( n=1 ; n < 80 ; n++ )) ; do echo "The quick brown fox jumps over the lazy dog"; done > dir5/dir6/dir7/dir8/newtest4a sync rm dir5/dir6/dir7/dir8/newtest4a sync # Unmount the test file: cd .. sudo umount testpartition # Run extundelete cd extundelete src/extundelete ../testpartition.dd --restore-file dir1/dir3/dir4/test.file5 # the following doesn't work yet src/extundelete ../testpartition.dd --restore-file dir5/dir6/dir7/dir8/test.file1 # but it will still find it on --restore-all src/extundelete ../testpartition.dd --restore-all