Skip to content

Instantly share code, notes, and snippets.

@hapylestat
Created July 29, 2021 12:36
Show Gist options
  • Save hapylestat/5ccf5d5f0d9707a7887b3268dd5936a4 to your computer and use it in GitHub Desktop.
Save hapylestat/5ccf5d5f0d9707a7887b3268dd5936a4 to your computer and use it in GitHub Desktop.
drivespeed
#!/bin/bash
_sync(){
sync
echo 3 > /proc/sys/vm/drop_caches
}
DRIVE_MNT=/mnt/storages/$1
echo -n "Syncing..."
_sync
echo "=========WRITE TEST==========="
rm -f DRIVE_MNT/temp.tmp 1>/dev/null 2>&1
dd if=/dev/zero of=${DRIVE_MNT}/temp.tmp oflag=direct bs=128k count=32k
echo -n "Syncing..."
_sync
echo "=========READ TEST==========="
dd if=${DRIVE_MNT}/temp.tmp of=/dev/null iflag=direct bs=128k count=32k
rm -f DRIVE_MNT/temp.tmp 1>/dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment