Note: There are probably better ways of doing this. I am currently coping a decent amount of data using rsync between a NAS drive and a locally mounted USB drive and wanted to monitor the process.
This works for the local drive:
owen@thelinuxblog:~$ df -h /dev/sdc1 | cut -d \ -f 11 | tail -n 1
I started figuring out the way to display the NAS total usage, which looks something like this:
df -h |grep NAS2 | cut -d % -f 1 | cut -d \ -f 35- | cut -d \ -f 1
Which is fine, but really is not needed and is bit overkill when I know the total amount that is going to get copied, so I simplified it down a bit to look like this:
owen@thelinuxblog:~$ echo `df -h /dev/sdc1 | cut -d \ -f 11 | tail -n 1` of 100G
41G of 100G
Then I wrote a loop to print out the usage every 5 minutes (300 seconds) and the date.
owen@gibson:~$ while [ $(echo `df -h /dev/sdf1 | cut -d \ -f 11 | tail -n 1` | sed 's/G//') -lt 100 ]; do echo `df -h /dev/sdf1 | cut -d \ -f 11 | tail -n 1` of 100G `date`; sleep 300; done;
This was a quick and dirty way of monitoring progress while passing time and now I’m able to keep an eye on things.