#!/bin/sh # # diskbenchmark 2009-01-13 # Public Domain # Configuration section # # RAM in MB ram=4096 # Partition to use, must be bigger than 2 * RAM size part=/dev/mapper/vg0-test # Mount point mnt="/mnt/test" # Number of runs nruns=5 # Which filesystems to test usefs="ext2 ext3 ext4 xfs jfs reiserfs" #usefs="ext2 ext3 ext4 xfs jfs reiserfs btrfs" # End configuration section # count=$((2 * $ram)) sudo umount "$mnt" fun() { echo "$*" $* } rootfun() { echo "$*" sudo $* } block() { echo echo "$*" } block "Raw speed of partition" for i in $(seq 1 $nruns); do rootfun dd if=/dev/zero of="$part" bs=1024k count=$count rootfun dd of=/dev/null if="$part" bs=1024k count=$count done for fs in $usefs; do block "Test filesystem $fs" opt= case $fs in xfs) opt="-f -q" ;; btrfs) opt="" ;; *) opt="-q" ;; esac echo "mkfs.$fs $opt $part" time sudo mkfs.$fs $opt "$part" echo "mount $part $mnt" time sudo mount "$part" "$mnt" sudo chown $USER "$mnt" sudo chmod u+w "$mnt" block "Test block write and read" for i in $(seq 1 $nruns); do fun dd if=/dev/zero of="$mnt/file" bs=1024k count=$count fun dd of=/dev/null if="$mnt/file" bs=1024k count=$count echo "rm -f $mnt/file" time rm -f "$mnt/file" done block "Test with bonnie++" fun /usr/sbin/bonnie++ -s ${count}m:256k -n 128k:0:1999:1 -x $nruns -d "$mnt" -f -q sudo umount "$mnt" done