Skip to content

Instantly share code, notes, and snippets.

@pmalek
Created January 24, 2014 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmalek/8597009 to your computer and use it in GitHub Desktop.
Save pmalek/8597009 to your computer and use it in GitHub Desktop.
Show LBAs, MBs and GBs written to disk
#!/bin/bash
scale=3
lbas=$(sudo smartctl --all /dev/sda | grep Total_LBAs_Written | awk '{print $(NF)}')
mbs=$(( $lbas / 2048 ))
# gbs=$(( $mbs / 1024.0 ))
gbs=$(bc -l <<< "scale=3 ; $mbs / 1024.0")
echo "LBAs written: $lbas"
echo "MBs written: $mbs"
echo "GBs written: $gbs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment