This is an old revision of the document!
Table of Contents
Files management
File Systems
ext3
Reserved blocks
By default ext3 reserved 5% of disk space to super-user. The intent is to let the ability to critical applications to write to the disk when it is full, but it has no use for a data partition, you just waste 5% of your partition.
You can remove these reserved blocks with the following command:
tune2fs -r 0 /dev/sda1
Duplicates
- geekie for images (fork of gqview)
- fdupes
- fslint
Secure delete
- secure-delete (srm, sfill, sswap, smem)
- -l option to be a lot faster: 2 passes instead of 38 (or -ll for only 1 pass), enough to prevent the use of consumer tools like photorec, but not for specialized companies and governments
- shred (less advanced but more common)
Data recovery
First unmount your partition and remount it read-only.
- testdisk (photorec)
- ext3grep
ext3grep <partition> --restore-file <filename> # filename => file ; works great, but only for one file at a time... ext3grep <partition> --restore-all --deleted --after=1270639550 # dates -> files ext3grep <partition> --histogram=dtime --deleted --after=1270639000 --before=1270640000 # => dates ext3grep <partition> --ls --inode 2 # filenames => inodes (navigating in directories with inodes) ext3grep <partition> --search Libs/jafar/modules/ # filename,dates -> blocks ext3grep <partition> --restore-inode <inode> # inodes => files
Notes: “restore-all” failed while building stage2 cache with error “ext3grep: init_directories.cc:535: void init_directories(): Assertion `lost_plus_found_directory_iter != all_directories.end()' failed.”. However doing a “ls inode” created this stage2 cache, and afterwards “restore-all” worked… but just restored everything on the disk even not deleted files/dirs, not taking into account the “after” option… But manually editing the stage2 cache to only keep files/dirs you want to restore then “restore-all” worked perfectly!
- others: debugfs, foremost, http://freshmeat.net/projects/unrm/, http://freshmeat.net/projects/ext3undel