Notices


Reply
Thread Tools
b-man's Avatar
Posts: 549 | Thanked: 502 times | Joined on Feb 2008 @ Bowling Green Ohio (united states)
#1
This is a debianized/optified/optimized port of the wonderful work done by Nic Case on SourceForge.net.

now for the big fat warning


NOTICE: THIS PROGRAM PERFORMS LOW-LEVEL OPERATIONS ON YOUR DEVICE. ME, NOR THE ORIGINAL AUTHOR OF THIS SOFTWARE ARE RESPONSIBLE IF THIS PROGRAM WRECKS YOUR eMMC OR MicroSD. USE THIS SOFTWARE AT YOUR OWN RISK.


How It Works:
  • Extundelete works by reading inode tables on a journalized filesystem (ext3 or ext4) to help in recovering deleted files/directories.

Basic Usage:
  • Here is a basic example of how to use Extundelete.
    In this example we will assume that you accidentally deleted an important file in the application partition (/dev/mmcblk0p2), which is mounted on /opt:

NOTE: It is recommended that you recover files and/or directories as root.

Code:
cd /opt/program/bin

rm -f program        *OOPS!!!*

extundelete --restore-file /dev/mmcblk0p2 /opt/program/bin/program
  • Now that we have recovered our deleted file, we will retrieve it from the generated RECOVERED_FILES directory and clean up:

Code:
cp /opt/program/bin/RECOVERED_FILES/opt/program/bin/program /opt/program/bin

rm -rf /opt/program/bin/RECOVERED_FILES
Advanced Examples:

NOTE: Be very, very careful if you are planning on running the following tests!

  • Here is a list of tests archived from testing.txt from extundelete's source tree:

Code:
# 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
Installation:
  • You can donload the deb pakage from here, the debianized source from here, or the raw, unmodified source from here.

Simply download the package to your device and open it through the filemanager for installation.

* I will be uploading the source/package to extras-devel as soon as i can - Just need to get some finalized tweaking done
__________________
I'm an advanced user and a bit of a modder.
----------------------------------------------
I am involved with Mer, Deblet, and NITdroid.
My ports/creations/hacks: GNOME (for Deblet), Cdeb2», Ubuntu, playable flash games in the "Get Started" app, DBS, ect...


enhanced fedora port has been canceled in favor of NITDebian (TBA)

Last edited by b-man; 2010-03-14 at 19:25. Reason: typos
 

The Following 4 Users Say Thank You to b-man For This Useful Post:
b-man's Avatar
Posts: 549 | Thanked: 502 times | Joined on Feb 2008 @ Bowling Green Ohio (united states)
#2
update: fixed a bunch of spelling errors - sorry about that - i posted this from my N900
__________________
I'm an advanced user and a bit of a modder.
----------------------------------------------
I am involved with Mer, Deblet, and NITdroid.
My ports/creations/hacks: GNOME (for Deblet), Cdeb2», Ubuntu, playable flash games in the "Get Started" app, DBS, ect...


enhanced fedora port has been canceled in favor of NITDebian (TBA)
 
lcuk's Avatar
Posts: 1,635 | Thanked: 1,816 times | Joined on Apr 2008 @ Manchester, England
#3
sounds very useful in extreme situations.
not recommended for random stuff tho
__________________
liqbase sketching the future.
like what i say? hit the Thanks, thanks!
twitter.com/lcuk
 

The Following User Says Thank You to lcuk For This Useful Post:
b-man's Avatar
Posts: 549 | Thanked: 502 times | Joined on Feb 2008 @ Bowling Green Ohio (united states)
#4
Originally Posted by lcuk View Post
sounds very useful in extreme situations.
not recommended for random stuff tho
yeah - hence the big fat warning xD
__________________
I'm an advanced user and a bit of a modder.
----------------------------------------------
I am involved with Mer, Deblet, and NITdroid.
My ports/creations/hacks: GNOME (for Deblet), Cdeb2», Ubuntu, playable flash games in the "Get Started" app, DBS, ect...


enhanced fedora port has been canceled in favor of NITDebian (TBA)
 
lcuk's Avatar
Posts: 1,635 | Thanked: 1,816 times | Joined on Apr 2008 @ Manchester, England
#5
a version of an undelete tool for FAT would be useful
especially for memory cards and such using it
__________________
liqbase sketching the future.
like what i say? hit the Thanks, thanks!
twitter.com/lcuk
 

The Following User Says Thank You to lcuk For This Useful Post:
Posts: 2,802 | Thanked: 4,491 times | Joined on Nov 2007
#6
Originally Posted by lcuk View Post
a version of an undelete tool for FAT would be useful
especially for memory cards and such using it
Not-quite-an-undelete-tool, but Photorec is available.
 

The Following 3 Users Say Thank You to lma For This Useful Post:
Posts: 23 | Thanked: 3 times | Joined on Feb 2010 @ Houston
#7
Does this recover deleted notes ??
 
Reply

Tags
extundelete, filesystem, partition, recovery, undelete

Thread Tools

 
Forum Jump


All times are GMT. The time now is 14:11.