Linux – Measuring ‘Total Bytes Written’ Under Linux

iolinuxmeasurementssd

We're quite interested in exploring the possibility of using SSD drives in a server environment. However, one thing that we need to establish is expected drive longevity. According to this article manufacturer's are reporting drive endurance in terms of 'total bytes written' (TBW). E.g. from that article a Crucial C400 SSD is rated at 72TB TBW. Do any scripts/tools exist under the Linux ecosystem to help us measure TBW? (and then make a more educated decision on the feasibility of using SSD drives)

Best Answer

Another possibility is to look at /proc/diskstats. It's not persistent across reboots, but it has data for every block device. Probably most interesting to you is field 10, which contains the total number of sectors written. On a system with scsi disks with a sector size of 512 bytes, you could run

awk '/sd/ {print $3"\t"$10 / 2 / 1024}' /proc/diskstats

to see how many megabytes were written to each device. The output will look like

sda 728.759
sda1 79.0908
sda2 649.668

Related Topic