brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: nvme smart-log shows how worn out your NVMe drive is

Smart
~/tips/tip-nvme-smart-log

sudo nvme smart-log /dev/nvme0

Reads wear, temperature and error counters straight from an NVMe drive.

NVMe drives don’t make noise when they start to fail, so I like having a quick way to look at their wear. The nvme-cli package has one command for it.

Install nvme-cli from your distribution, then run:

sudo nvme smart-log /dev/nvme0

The output is a short list of counters read from the drive itself. The ones I’d look at first are critical_warning (should be 0), temperature, available_spare, percentage_used and media_errors. percentage_used is the drive’s own estimate of how much of its rated endurance is gone, and data_units_written tells you how much has been written over its life.

Use the controller device (/dev/nvme0), not a namespace like /dev/nvme0n1, if your version complains. nvme list shows what is installed.

A caveat: the percentage is an estimate by the manufacturer’s firmware and it can go past 100 on a drive that keeps working. Treat it as a trend to watch, not a deadline. The unit of data_units_written is also odd: one unit is 1000 blocks of 512 bytes, so multiply before comparing it with the TBW rating in the datasheet.

If you already use smartmontools, smartctl -a /dev/nvme0 shows much the same data in a different layout.

Further reading: nvme-cli on GitHub, nvme-smart-log man page

More Smart tips sudo smartctl -q silent -a /dev/sda sudo smartctl -l devstat /dev/sda sudo smartctl -l scttemphist /dev/sda sudo smartctl -t select,1000000-2000000 /dev/sda sudo smartctl -l sataphy /dev/sda All Smart tips (19) All topics

Link