aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--unix/iotest.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/unix/iotest.sh b/unix/iotest.sh
new file mode 100644
index 0000000..fe81c97
--- /dev/null
+++ b/unix/iotest.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Simple test to the disk write speed using `dd`.
+#
+# Aaron LI
+# 2017-11-06
+#
+
+IN=/dev/zero
+OUT=/tmp/iotest.$$
+BS=16k
+COUNT=16000
+
+RESULT=${HOME}/iotest.txt
+
+CMD="dd if=${IN} of=${OUT} bs=${BS} count=${COUNT} conv=sync"
+SPEED=$(${CMD} 2>&1 | grep 'bytes/sec' | awk -F'[()]' '{ print $2 }')
+rm ${OUT}
+DATE=$(date +'%Y-%m-%d %H:%M')
+echo "${DATE} ${BS}*${COUNT} ${SPEED}" >> ${RESULT}