ESXI 6.0 monitoring SSD drive TBW

“Terabytes Written” is the total amount of data that can be written into an SSD before it is likely to fail.

There is a nicely written article on this blog explaining how to get the TBW for a SSD drive in ESXI host – open here.

However since I am a lazy kind of person I like to get stuff scripted and emailed to me.

In essence here is what I have done:

Install smartctl

  1. Download smartctl-6.6-4321.x86_64.vib
  2. Copy the VIB to the /tmp/ directory of an ESXi host
  3. SSH to the ESXi host
  4. Set the VIB acceptance level to CommunitySupported
    # esxcli software acceptance set --level=CommunitySupported
  5. Install the package (Maintenance Mode or Reboot is not required)
    #esxcli software vib install -v /tmp/smartctl-6.6-4321.x86_64.vib

The tool is located at /opt/smartmontools/smartctl and works just like the Linux version.
Locate physical disks with ls -l /dev/disks/

Create the script and automate
Save the below lines in a script somwehere:

#!/bin/sh
 var=`/opt/smartmontools/smartctl -d sat --all /dev/disks/t10.ATA_____Samsung_SSD_850_EVO_M.2_250GB___________S24BNXAH119741P_____ | grep Total_LBAs | cut -d"-" -f2`
 TBW=`awk "BEGIN {print $var*512/1099511627776}"`
 echo "Total TB Writen so far: " $TBW

var2=`/opt/smartmontools/smartctl -d sat --all /dev/disks/t10.ATA_____Samsung_SSD_850_EVO_M.2_250GB___________S24BNXAH119741P_____ | grep Power_On | cut -d"-" -f2`
 POWERON=`awk "BEGIN {print $var2/24}"`
 echo "Device in use since [days]: " $POWERON

echo "Device has 5 Years Limited Warranty or 75TBW Limited "
 REMAIN=`awk "BEGIN {print (75*$POWERON)/$TBW}"`
 echo "Device has approximately: " $REMAIN "days left"
 REMAINY=`awk "BEGIN {print $REMAIN/360}"`
 echo "that is approx. $REMAINY years left"

 

To see how much life my SSD drive has got left I added that script to /etc/profile.local file so whenever I login I get something like that:

Samsung SSD 850 Evo m.2 250GB Remaining Disk LifeTime
Tue May 24 16:30:12 UTC 2016

Total TB Written so far: 1.26013
Device in use since [days]: 97.9167
Device has 5 Years Limited Warranty or 75TBW Limited
Device has approximately: 5827.77 days left
that is approx. 16.1883 years left

As I don’t often login to my esxi host via ssh I created a cron job – /var/spool/cron/crontabs/root :

0    0   1,15 *  *    source /opt/smartmontools/report.sh > /opt/smartmontools/disklifetime.txt

and specified it to run every two weeks and save the results to a file. That file is then picked up (via scp) by my linux server and emailed to me.

Job done.