Skip to content

Instantly share code, notes, and snippets.

@muhqu
Created August 8, 2012 10:12
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save muhqu/3293988 to your computer and use it in GitHub Desktop.
Save muhqu/3293988 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: sudo $0 /dev/sdh1"
exit 1;
fi
dd if=$1 of=/dev/null & pid=$!
while true; do
ps -p$pid --no-heading || break;
echo "-- $(date) ------------------";
kill -USR1 $pid;
sleep 60s;
done
echo "-- $(date) ------------------";
echo "DONE \o/"
$ sudo ./ebs-warmer.sh /dev/md1
5667 pts/2 00:00:00 dd
-- Wed Aug 8 10:04:34 UTC 2012 ------------------
4350+0 records in
4350+0 records out
2227200 bytes (2.2 MB) copied, 0.0102517 s, 217 MB/s
5667 pts/2 00:00:03 dd
-- Wed Aug 8 10:05:34 UTC 2012 ------------------
1174177+0 records in
1174176+0 records out
601178112 bytes (601 MB) copied, 67.3422 s, 8.9 MB/s
5667 pts/2 00:00:05 dd
-- Wed Aug 8 10:06:34 UTC 2012 ------------------
1895073+0 records in
1895072+0 records out
970276864 bytes (970 MB) copied, 127.779 s, 7.6 MB/s
5667 pts/2 00:00:07 dd
@jhmartin
Copy link

If you are willing to add a dependency, you could run the dd through 'pipeviewer' http://www.ivarch.com/programs/pv.shtml which can show you the progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment