How To Log Flash Disk Write Stats
Some people worry that flash drives may have limited life due to the limited number of write/erase cycles supported by the flash chips. In order to guage how significant this is, if you use flash disks, please log the amount of data written using the scripts described below. Then, over time, please share the statistics on the FlashDriveLifespanSurvey page. We will then all get an idea of how significant this effect is.
The Logging Script
This has been developed on my Debian system. It will probably work on other system, though it may need some tweaking. Suggestions are welcome.
The logging script is called disklog and you can get it from http://svn.chezphil.org/utils/trunk/disklog. Please read the comments in the script and change the location of the log file(s) to suit your system.
You need to run it periodically from cron and also on shutdown. I'm running it hourly, but you could run it daily if your slug normally stays up for long periods. Just put a script like this:
somewhere in /etc/cron.*/ and also in /etc/init.d/, and make links so that the latter is run on shutdown:
$ update-rc.d disklog stop 0 6 .
To extract total disk activity numbers from the logs, get the report_disklog script from http://svn.chezphil.org/utils/trunk/report_disklog. Here's an example:
$ report_disklog /home/diskstats-chad.log "usb-JetFlash_TS1GJFV30_DZPCOJC7" 259144 171432 "usb-USB_2.0_Flash_Disk_a86144e24194b3" 136524 663960