Ext4magic: Inode - Directory - Journal - Install - Time_Options - Histogram - Scenarios - Tips&Tricks - Manpage - Expert-Mode |
Expert-mode is a set of options of ext4magic which
enable special functions and usually will be used in special
situations. In particular it will be possible to restore data from
a corrupted file system.
The options of the expert mode are not enabled by default. The availability of these features are enabled at compile. The following commands enable the Expert-mode of ext4magic.
make clean
./configure --enable-expert-mode
make
sudo make install
Following options are available if expert mode is enable during compile time:
Both options have to be specified together in the order "-s
blocksize -n blocknumber"
to use a backup of the file
system super block with ext4magic. These options will be needed if
the file system superblock is corrupted.
ext4magic will not automatically search for the journal in the inode number 8. This is requiered, if the first inode blocks are broken and also inode number 8. (The journal with the inode number 8 and the root directory with the inode number 2 are in the first inode block of the file system.)
Files of still existing inode blocks are recovered. As long the journal is consistent, any existing copies of lost or broken inodes will be used instead of the broken inodes of the file system. When using also the option "-c" a damaged journal is recognized, and tried to restore if possible, all undamaged files without the journal. This option is particularly suited, if the file system is partial overwritten at the beginning or the end. Repair with e2fsck is often possible, but risky for large damage, ext4magic here often has better chances of success.
In sum, these 4 options are needed, to open file systems with a defective super block and restore the files from such a defective file system. The requirement, the orginal file system size is still present. Was accidentally created a new file system on the old, and thus the file system meta data are completely overwritten, this option can not help because, then only a empty file system will be found. Damaged partition tables or similar, then ext4magic can not help. Also this will not work after fsck has tries to repair the file system. In this case use file craving tools, such as photorec to try restore some files.
In the comparison the full command line for a
repair with fsck and the recover with extmagic
repair an ext3 file systems with broken superblock
fsck.ext3 -B 4096 -b 32768 -y -f /dev/sda1
ext4magic file system restore, write to /tmp/recover
ext4magic /dev/sda1 -s 4096 -n 32768 -c -D -d /tmp/recover
There is a script which can help you find out the exact command line for ext4magic for such a defective file system. Run the script with the file system as a parameter. The script will print some possible command lines. Use one of these to try a recover.
#!/bin/bash
# ext4magic Help Script (dump2fs >= 1.41.9)
#
# to determine the correct command line for ext4magic
# for try to restore of a partially damaged filesystem
# if the beginning of the file system is corrupt.
#
# Autor robi6@users.sf.net (Version 1.1 vom 03.06.2011)
if [ -b "$1" -o -f "$1" ]
then
typeset -i BLK BLK_SZ GROUP
for BLK_SZ in 1024 2048 4096
do
for GROUP in 1 3 5 7 9 25 27 49 81 125 243 343 729 2187 2401 3125
do
BLK="$BLK_SZ"*8*"$GROUP"
if [ $BLK_SZ -eq 1024 ]
then BLK="$BLK"+1
fi
dumpe2fs -h -o blocksize="$BLK_SZ" -o superblock="$BLK" "$1" 2>/dev/null|grep UUID &>/dev/null && echo "ext4magic \"$1\" -s $BLK_SZ -n $BLK -c -D"
done
done
else
echo "usage: $0 <device>"
fi
#--------------- END ----------------
Ext4magic: Inode - Directory - Journal - Install - Time_Options - Histogram - Scenarios - Tips&Tricks - Manpage - Expert-Mode |