#!/usr/bin/ksh # # (c)2009 lists@nerdbynature.de # Benchmark (hah!) several ext* mount options # OPTIONS="orlov oldalloc atime noatime data=journal data=ordered data=writeback acl noacl user_xattr nouser_xattr" MP=/mnt/d1 TAR=/mnt/d2/linux.tar # unset me! # DEBUG=echo if [ ! -b "$1" -o ! -d "$MP" -o ! -f "$TAR" ]; then echo "Usage: $0 [dev]" echo "Also, please check my config!" exit 1 else DEV="$1" fi for fs in ext2 ext3 ext4; do for o in $OPTIONS; do printf "$fs option: $o " j=0 R=0 while [ $j -lt 3 ]; do $DEBUG mkfs."$fs" -q "$DEV" $DEBUG mount -t $fs -o $o "$DEV" "$MP" 2>/dev/null if [ ! $? = 0 ]; then printf "not supported for $fs!" j=3 continue fi TB=`date +%s` $DEBUG tar -C "$MP" -xf "$TAR" $DEBUG sync $DEBUG rm -rf "$MP"/* $DEBUG sync TE=`date +%s` R=`echo $TE - $TB + $R | bc` $DEBUG umount "$MP" ((j++)) done AVG=`echo "scale=2; $R / 3" | bc -l` printf -- " - $AVG sec" echo done echo done