Created
October 1, 2018 18:16
-
-
Save gxfxyz/0d81429fc48a82ef6c2402b178a82566 to your computer and use it in GitHub Desktop.
A simple script to test Synology NAS disk speed with hdparm, dd and fio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ======================================================================================= | |
# | |
# A simple script to test Synology NAS disk speed with hdparm, dd and fio. | |
# | |
# How to use: | |
# | |
# 1. Save synology_disk_benchmark.sh and xfio.conf to your Synology NAS | |
# 2. Make it executable: chmod +x synology_disk_benchmark.sh | |
# 3. Run: sudo ./synology_disk_benchmark.sh <test_name> | |
# 4. A report file <test_name>.md will be created | |
# | |
# ======================================================================================= | |
filename=`echo "$@" | tr " " _` | |
filename="${filename,,}".md | |
volume=`dirname "$PWD"` | |
device=`df $volume | tail -1 | awk '{ print $1 }'` | |
echo $@ | |
echo $@ > $filename | |
######################################################################################### | |
exec () { | |
echo; echo ---; echo | |
echo "$1" | |
echo | |
echo --- >> $filename | |
echo '```bash' >> $filename | |
echo "$1" >> $filename | |
echo '```' >> $filename | |
echo '```' >> $filename | |
eval "$1" 2>&1 | tee -a $filename | |
echo '```' >> $filename | |
} | |
######################################################################################### | |
######################################################################################### | |
read -r -d '' cmd << EOM | |
sudo hdparm -Tt $device | |
EOM | |
exec "$cmd" | |
######################################################################################### | |
read -r -d '' cmd << EOM | |
# create a 1 GiB test file with random data (it can take minutes) | |
head -c 1G </dev/urandom >test | |
# clear cache | |
sync; echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null | |
# read from test file, read 1 MiB each time, read 1024 times, total read 1 GiB | |
dd if=test of=/dev/null bs=1M count=1024 | |
EOM | |
exec "$cmd" | |
######################################################################################### | |
read -r -d '' cmd << EOM | |
# write 0 to test file, write 1 GiB each time, write 2 times, total write 2 GiB | |
dd if=/dev/zero of=test bs=1G count=2 oflag=dsync | |
EOM | |
exec "$cmd" | |
######################################################################################### | |
read -r -d '' cmd << EOM | |
# write 0 to test file, write 128 MiB each time, write 8 times, total write 1 GiB | |
dd if=/dev/zero of=test bs=128M count=8 oflag=dsync | |
EOM | |
exec "$cmd" | |
######################################################################################### | |
read -r -d '' cmd << EOM | |
# write 0 to test file, write 1 MiB each time, write 1024 times, total write 1 GiB | |
dd if=/dev/zero of=test bs=1M count=1024 oflag=dsync | |
EOM | |
exec "$cmd" | |
######################################################################################### | |
read -r -d '' cmd << EOM | |
# write 0 to test file, write 128 KiB each time, write 1024 times, total write 128 MiB | |
dd if=/dev/zero of=test bs=128k count=1024 oflag=dsync | |
EOM | |
exec "$cmd" | |
######################################################################################### | |
read -r -d '' cmd << EOM | |
# write 0 to test file, write 4 KiB each time, write 1024 times, total write 4 MiB | |
dd if=/dev/zero of=test bs=4k count=1024 oflag=dsync | |
EOM | |
exec "$cmd" | |
######################################################################################### | |
read -r -d '' cmd << EOM | |
# write 0 to test file, write 512 bytes each time, write 1024 times, total write 512 KiB | |
dd if=/dev/zero of=test bs=512 count=1024 oflag=dsync | |
EOM | |
exec "$cmd" | |
######################################################################################### | |
read -r -d '' cmd << EOM | |
fio xfio.conf | |
EOM | |
exec "$cmd" | |
######################################################################################### | |
rm test | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[global] | |
filename=test | |
ioengine=psync | |
direct=1 | |
numjobs=1 | |
iodepth=1 | |
group_reporting | |
stonewall | |
[seq-read-1m] | |
name=seq-read-1m | |
size=5G | |
bs=1m | |
rw=read | |
stonewall | |
[seq-write-1m] | |
name=seq-write-1m | |
size=5G | |
bs=1m | |
rw=write | |
stonewall | |
[seq-read-4k] | |
name=seq-read-4k | |
size=1G | |
bs=4k | |
rw=read | |
stonewall | |
[seq-write-4k] | |
name=seq-write-4k | |
size=1G | |
bs=4k | |
rw=write | |
stonewall | |
[rand-read-1m] | |
name=rand-read-1m | |
size=1G | |
bs=1M | |
rw=randread | |
stonewall | |
[rand-write-1m] | |
name=rand-write-1m | |
size=1G | |
bs=1M | |
rw=randwrite | |
stonewall | |
[rand-read-4k] | |
name=rand-read-4k | |
size=100M | |
bs=4k | |
rw=randread | |
stonewall | |
[rand-write-4k] | |
name=rand-write-4k | |
size=100M | |
bs=4k | |
rw=randwrite | |
stonewall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My issue was with line
it does not take minutes to create, more like an hour on my Synology, guess the random generator is not using the proper method
instead I used this: