Skip to content

Instantly share code, notes, and snippets.

@rianhunter
Created January 18, 2016 18:16
Show Gist options
  • Save rianhunter/5952355a98064a02bafe to your computer and use it in GitHub Desktop.
Save rianhunter/5952355a98064a02bafe to your computer and use it in GitHub Desktop.
Cron job to read randomly from disk
#!/bin/sh
for a in /dev/sd*1
do
SECTORS=$(/sbin/blockdev --getsize $a)
SECTOR=$(python -c "import random; print random.randint(0, $SECTORS - 1);")
dd if=$a of=/dev/null iflag=direct skip=${SECTOR} bs=512 count=1 2>/dev/null &
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment