BASH script: Save unsynced data to disk

Displays amount of data waiting to be written to disk(s) and invokes sync(1) to force changed blocks to disk and update the super block.
saved=`grep ^Dirty /proc/meminfo | sed 's/Dirty\:[[:space:]]*//g`
echo "Syncing $size of unsaved data to disk(s)."

Example output:
sairon@arch-sd:~$ dirty
Syncing 84 kB of unsaved data to disk(s). 

Thanks to:

No comments:

Post a Comment