#!/bin/bash DEV="/dev/sdc1" DIR="/mnt/test" CURRENT=$PWD run() { typeset LINEID="$1" typeset LOGFILE="$2" typeset CMD="$3" echo "$CMD" # fields of time output: # # LINEID: a tag to identify the line (make, rm, ...) # %e: Elapsed real time (in seconds) # %S: Total number of CPU-seconds that the process spent in kernel mode # %U: Total number of CPU-seconds that the process spent in user mode. # %F: Number of major page faults # %R: Number of minor, or recoverable, page faults # %W: Number of times the process was swapped out of main memory # %c: Number of times the process was context-switched involuntarily # %w: Number of waits # %I: Number of file system inputs by the process # %O: Number of file system outputs by the process # %k: Number of signals delivered to the process /usr/bin/time -o "$LOGFILE" -a -f "$LINEID %e %S %U %F %R %W %c %w %I %O %k" $CMD } # TEST umount $DEV if df | grep $DEV then echo "ERROR: $DEV in use" 1>&2 exit 1 fi #"ext2 nobhbar" \ for filesystem in \ "ext2 defaults" \ "ext3 data=ordered" \ "ext3 data=writeback" \ "ext3 data=ordered,extents" \ "ext3 data=ordered,mballoc,extents" \ "ext3 data=ordered,mballoc,delalloc,extents" \ "ext3 data=writeback,extents" \ "ext3 data=writeback,mballoc,extents" \ "ext3 data=writeback,mballoc,delalloc,extents" \ "xfs defaults" \ "jfs defaults" \ "reiserfs defaults" do FS=${filesystem%% *} OPT=${filesystem##* } LOGFILE="${CURRENT}/${FS}_${OPT}" rm -f "$LOGFILE" if [ "$FS" = "jfs" ] then CMD="mkfs -t $FS -q -L jfs_volume $DEV" elif [ "$FS" = "xfs" ] then CMD="mkfs -t $FS -f $DEV" elif [ "$FS" = "reiserfs" ] then CMD="mkfs -t $FS -f $DEV" else CMD="mkfs -t $FS $DEV" fi echo $CMD if ! $CMD > /dev/null then echo "Failed !" exit 1 fi echo mount -t $FS -o $OPT $DEV $DIR if ! mount -t $FS -o $OPT $DEV $DIR then echo "Failed !" exit 1 fi echo "Entering $DIR" cd $DIR # copy tarball sync run "tar_cp" "$LOGFILE" "cp /root/linux-2.6.10.tar.bz2 ." run "tar_cp_sync" "$LOGFILE" sync run "tar_x" "$LOGFILE" "tar jxf linux-2.6.10.tar.bz2" run "tar_x_sync" "$LOGFILE" sync echo "Entering linux-2.6.10" cd linux-2.6.10 run "make_defconfig" "$LOGFILE" "make defconfig" run "make" "$LOGFILE" "make" run "make_sync" "$LOGFILE" sync echo "Exiting $(basename $PWD)" cd .. run "rm" "$LOGFILE" "rm -fr linux-2.6.10" run "rm_sync" "$LOGFILE" sync echo "Exiting $PWD" cd echo umount $DEV while ! umount $DEV do echo "Retry..." sleep 5 echo umount $DEV done done