1 test_description="e2undo with debugfs -z" 2 if ! test -x $E2UNDO_EXE -o ! -x $DEBUGFS_EXE; then 3 echo "$test_name: $test_description: skipped (no debugfs/e2undo)" 4 return 0 5 fi 6 7 TDB_FILE=${TMPDIR:-/tmp}/tune2fs-$(basename $TMPFILE).e2undo 8 OUT=$test_name.log 9 rm -f $TDB_FILE >/dev/null 2>&1 10 11 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 12 13 echo mke2fs -q -F -o Linux -T ext4 -O ^metadata_csum,64bit -E lazy_itable_init=1 -b 1024 $TMPFILE > $OUT 14 $MKE2FS -q -F -o Linux -T ext4 -O ^metadata_csum,64bit -E lazy_itable_init=1 -b 1024 $TMPFILE >> $OUT 2>&1 15 crc0=`$CRCSUM $TMPFILE` 16 echo $CRCSUM before debugfs $crc0 >> $OUT 17 18 echo using debugfs to test e2undo >> $OUT 19 $DEBUGFS -w -z $TDB_FILE -R 'zap -p 0x55 0' $TMPFILE >> $OUT 2>&1 20 crc1=`$CRCSUM $TMPFILE` 21 echo $CRCSUM after debugfs $crc1 >> $OUT 22 23 $E2UNDO $TDB_FILE $TMPFILE >> $OUT 2>&1 24 crc2=`$CRCSUM $TMPFILE` 25 echo $CRCSUM after e2undo $crc2 >> $OUT 26 27 if [ $crc0 = $crc2 ] && [ $crc1 != $crc2 ]; then 28 echo "$test_name: $test_description: ok" 29 touch $test_name.ok 30 else 31 ln -f $test_name.log $test_name.failed 32 echo "$test_name: $test_description: failed" 33 fi 34 rm -f $TDB_FILE $TMPFILE 35