Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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

This comment has been minimized.

Copy link

jhmartin commented Oct 20, 2014

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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.