Created
December 31, 2016 03:07
-
-
Save alexyorke/e78bf6eb5412a3d2956a83db6f4768db to your computer and use it in GitHub Desktop.
Tracks how much data is written to your SSD everyday to prevent over-wearing and helps locate misbehaving apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# grep for your hd (e.g. sda1) assumes 512kb blocks | |
# based on http://serverfault.com/questions/238033/measuring-total-bytes-written-under-linux | |
stat=$( awk '/sd/ {print $3"\t"$10 / 2 / 1024}' /proc/diskstats | sed 's/\s\+/ /g' | grep sda1 ) | |
mbWritten=$(echo $stat | cut -d " " -f 2) | |
echo "Megabytes written (all time): $mbWritten" | |
# exercise for the reader: save value to file, and compare it to tomorrow to see how many mb's were written | |
# if there is more than, say, 1024 * 40 then you might want to track down the app that's writing too much |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment