libnvme(9)

πŸ“¦ version 3.2, in arch rolling

✨ libnvme(9) β€” API Manual ✨

okay bestie, buckle up πŸ’– this is libnvme(9), and it's the page about the big one β€” the SMART / Health Information Log. it's giving "your SSD's annual checkup but make it a data structure" 🩺✨

πŸ’… NAME πŸ’…

struct nvme_smart_log β€” the SMART / Health Information Log, a.k.a. Log Identifier 02h πŸŽ€

like, this is the struct where your drive spills all its health tea: how hot it's running, how much life it's got left, how many times you yanked the power like a menace 😭 literally everything the SMART log carries lives in here, fr fr.


🩺 SYNOPSIS 🩺

no cap, here's the whole struct, exactly as it is β€” don't touch a single byte bestie, this is a hardware layout ✨

struct nvme_smart_log {
    __u8 critical_warning;
    __u8 temperature[2];
    __u8 avail_spare;
    __u8 spare_thresh;
    __u8 percent_used;
    __u8 endu_grp_crit_warn_sumry;
    __u8 informative_warning;
    __u8 rsvd8[24];
    __u8 data_units_read[16];
    __u8 data_units_written[16];
    __u8 host_reads[16];
    __u8 host_writes[16];
    __u8 ctrl_busy_time[16];
    __u8 power_cycles[16];
    __u8 power_on_hours[16];
    __u8 unsafe_shutdowns[16];
    __u8 media_errors[16];
    __u8 num_err_log_entries[16];
    __le32 warning_temp_time;
    __le32 critical_comp_time;
    __le16 temp_sensor[8];
    __le32 thm_temp1_trans_count;
    __le32 thm_temp2_trans_count;
    __le32 thm_temp1_total_time;
    __le32 thm_temp2_total_time;
    __le64 op_lifetime_energy_consumed;
    __le32 interval_power_measurement;
    __u8 rsvd244[268];
};

🌸 MEMBERS 🌸

every field got its own little moment, so let's go down the list one by one, main-character energy only πŸ‘‘

πŸ’€ critical_warning

so this one is literally the drive yelling "hey bestie something's wrong" 🚨 it tells you about critical warnings for the state of the controller, and those warnings may result in an asynchronous event notification to the host (drama πŸ’…).

the bits in this field represent the current associated state and are not persistent β€” meaning they're a vibe check, not a permanent record. see enum nvme_smart_crit for what all the bits mean iykyk.

🌑️ temperature

Composite Temperature β€” this holds a value corresponding to a temperature in Kelvins that represents the current composite temperature of the controller and the namespace(s) associated with that controller ✨

and here's the tea: the manner in which this value is computed is implementation specific, and it may not represent the actual temperature of any physical point in the NVM subsystem πŸ™ˆ like, it's an average-ish vibe the firmware decided on, not a probe.

warning and critical overheating composite temperature threshold values are reported by the WCTEMP and CCTEMP fields in the Identify Controller data structure πŸŽ€

πŸ“ avail_spare

Available Spare β€” contains a normalized percentage (0% to 100%) of the remaining spare capacity available πŸ’– so basically how much backup real estate the drive still has in the tank.

πŸŽ€ spare_thresh

Available Spare Threshold β€” when the Available Spare falls below the threshold indicated in this field, an asynchronous event completion may occur ⚠️ the value is indicated as a normalized percentage (0% to 100%). the values 101 to 255 are reserved β€” don't go there, bestie, that's not your lane.

πŸ”₯ percent_used

Percentage Used β€” contains a vendor specific estimate of the percentage of NVM subsystem life used, based on the actual usage and the manufacturer's prediction of NVM life.

so the important bits, no skipping:

  • a value of 100 indicates that the estimated endurance of the NVM in the NVM subsystem has been consumed β€” but that may not indicate an NVM subsystem failure 🫢 so don't panic-spiral, it's a prediction not a death sentence
  • the value is allowed to exceed 100 😳
  • percentages greater than 254 shall be represented as 255
  • this value shall be updated once per power-on hour (when the controller is not in a sleep state)

πŸ‘‘ endu_grp_crit_warn_sumry

Endurance Group Critical Warning Summary β€” this field indicates critical warnings for the state of Endurance Groups. the bits in this field represent the current associated state and are not persistent (see enum nvme_smart_egcw) πŸ’…

πŸ’œ informative_warning

Informative Warning β€” this field indicates warnings that the host may choose to act upon πŸ‘€ the bits in this field are not persistent, see enum nvme_smart_infw.

πŸ™ˆ rsvd8

Reserved β€” nothing to see here bestie, eyes off βœ‹

πŸ“– data_units_read

Data Units Read β€” contains the number of 512 byte data units the host has read from the controller; this value does not include metadata ✨

the fine print, because detail is the whole point:

  • the value is reported in thousands β€” i.e. a value of 1 corresponds to 1000 units of 512 bytes read
  • and it's rounded up β€” e.g. one indicates that the number of 512 byte data units read is from 1 to 1000, three indicates that the number of 512 byte data units read is from 2001 to 3000 πŸ”’
  • when the LBA size is a value other than 512 bytes, the controller shall convert the amount of data read to 512 byte units
  • for the NVM command set, logical blocks read as part of Compare, Read, and Verify operations shall be included in this value
  • a value of 0h in this field indicates that the number of Data Units Read is not reported β€” so 0h is "no data", not "zero reads", okay? πŸ’€

✍️ data_units_written

Data Units Written β€” contains the number of 512 byte data units the host has written to the controller; this value does not include metadata πŸ’–

same energy as above:

  • reported in thousands β€” i.e. a value of 1 corresponds to 1000 units of 512 bytes written
  • rounded up β€” e.g. one indicates that the number of 512 byte data units written is from 1 to 1,000, three indicates that the number of 512 byte data units written is from 2001 to 3000
  • when the LBA size is a value other than 512 bytes, the controller shall convert the amount of data written to 512 byte units
  • for the NVM command set, logical blocks written as part of Write operations shall be included in this value
  • Write Uncorrectable commands and Write Zeroes commands shall not impact this value πŸ™…
  • a value of 0h in this field indicates that the number of Data Units Written is not reported

πŸ“₯ host_reads

Host Read Commands β€” contains the number of read commands completed by the controller. for the NVM command set, this value is the sum of the number of Compare commands and the number of Read commands 🌈

πŸ“€ host_writes

Host Write Commands β€” contains the number of write commands completed by the controller. for the NVM command set, this is the number of Write commands ✨

⏳ ctrl_busy_time

Controller Busy Time β€” contains the amount of time the controller is busy with I/O commands 🫠 and "busy" has a very specific definition here, so listen up:

the controller is busy when there is a command outstanding to an I/O Queue β€” specifically, a command was issued via an I/O Submission Queue Tail doorbell write and the corresponding completion queue entry has not been posted yet to the associated I/O Completion Queue πŸ’…

this value is reported in minutes ⏱️

πŸ” power_cycles

Power Cycles β€” contains the number of power cycles. that's it, that's the field, iconic ✨

⏰ power_on_hours

Power On Hours β€” contains the number of power-on hours. this may not include time that the controller was powered and in a non-operational power state 😴 so sleepy-time might not count, ngl.

πŸ’€ unsafe_shutdowns

Unsafe Shutdowns β€” contains the number of unsafe shutdowns 😭 this count is incremented when a Shutdown Notification (CC.SHN) is not received prior to loss of power. basically: every time you held the power button instead of shutting down properly, this field remembers 🫣

🧨 media_errors

Media and Data Integrity Errors β€” contains the number of occurrences where the controller detected an unrecovered data integrity error 🚨 errors such as uncorrectable ECC, CRC checksum failure, or LBA tag mismatch are included in this field.

errors introduced as a result of a Write Uncorrectable command may or may not be included in this field β€” so it's a maybe, not a guarantee, iykyk πŸ™ˆ

πŸ“‹ num_err_log_entries

Number of Error Information Log Entries β€” contains the number of Error Information log entries over the life of the controller πŸ‘‘ a whole lifetime of receipts.

🌑️ warning_temp_time

Warning Composite Temperature Time β€” contains the amount of time in minutes that the controller is operational and the Composite Temperature is greater than or equal to the Warning Composite Temperature Threshold (WCTEMP) field and less than the Critical Composite Temperature Threshold (CCTEMP) field in the Identify Controller data structure πŸ”₯

and the caveat, which matters: if the value of the WCTEMP or CCTEMP field is 0h, then this field is always cleared to 0h regardless of the Composite Temperature value πŸ’…

🚨 critical_comp_time

Critical Composite Temperature Time β€” contains the amount of time in minutes that the controller is operational and the Composite Temperature is greater than or equal to the Critical Composite Temperature Threshold (CCTEMP) field in the Identify Controller data structure πŸ’€

same caveat bestie: if the value of the CCTEMP field is 0h, then this field is always cleared to 0h regardless of the Composite Temperature value ✨

🌑️ temp_sensor

Temperature Sensor 1-8 β€” contains the current temperature in degrees Kelvin reported by temperature sensors 1-8 🌈

the physical point in the NVM subsystem whose temperature is reported by the temperature sensor and the temperature accuracy is implementation specific πŸ™ˆ and an implementation that does not implement the temperature sensor reports a value of 0h.

πŸ”„ thm_temp1_trans_count

Thermal Management Temperature 1 Transition Count β€” contains the number of times the controller transitioned to lower power active power states or performed vendor specific thermal management actions while minimizing the impact on performance in order to attempt to reduce the Composite Temperature because of the host controlled thermal management feature (i.e., the Composite Temperature rose above the Thermal Management Temperature 1) πŸ₯΅

the deets:

  • this counter shall not wrap once the value FFFFFFFFh is reached πŸ›‘
  • a value of 0h indicates that this transition has never occurred or this field is not implemented

πŸ”„ thm_temp2_trans_count

Thermal Management Temperature 2 Transition Count


okay that's where part 1 wraps, bestie β€” the log keeps going and so do we πŸ’œ

  • thm_temp1_total_time β€” Total Time For Thermal Management Temperature 1, and bestie it is literally a stopwatch for the controller's chill era 😌 It holds the number of seconds the controller spent transitioning to lower power active power states, or doing vendor specific thermal management actions β€” all while minimizing the impact on performance β€” in order to attempt to reduce the Composite Temperature, because of the host controlled thermal management feature. So yeah, it's the "how long did we vibe in low-power mode to cool down" counter πŸ”₯➑️🧊
Heads up: this counter shall not wrap once the value FFFFFFFFh is reached. And a value of 0h, means either this transition has never occurred or this field is not implemented.
  • thm_temp2_total_time β€” Total Time For Thermal Management Temperature 2. Yeah that's it, that's the whole description 🫢 (the man page keeps it short and so do we, no invented lore, periodt).
  • op_lifetime_energy_consumed β€” Operational Lifetime Energy Consumed ⚑ this one's iconic: it contains the cumulative operational energy consumed by the NVM subsystem in watt-hours, calculated from all interval power measurements collected from the time of manufacture all the way up to the point that this log page is read. It's giving "full life story, but in joules-adjacent units" 😭

The value is rounded up β€” like, two means the number of watt-hours consumed is greater than 1 and less than or equal to 2. Sneaky but documented πŸ“

This field shall not wrap once the value FFFFFFFFFFFFFFFFh is reached. And a value of 0h indicates that the cumulative operational energy consumed is not reported. No cap.
  • interval_power_measurement β€” Interval Power Measurement 🌸 contains the average of power measurement samples over the most recent one second interval at the time of processing the Get Log Page command. The math is giving main character energy:
    • The power in Watts equals the Interval Power Measurement Value (bits 15:0) multiplied by the scale indicated in the Interval Power Measurement Scale field (bits 17:16) ✨

And a value of 0h indicates that the interval power measurement is not reported πŸ™ˆ

  • rsvd244 β€” Reserved. It's reserved, bestie, it's just sitting there being mysterious πŸŽ€ do not perceive it, do not write to it, iykyk.

okay that's the whole struct nvme_smart_log dump and honestly? ate πŸ’… This page came from the struct nvme_smart_log source in the libnvme manual, dated October 2026 β€” so go forth, read your SMART log, and slay responsibly πŸ‘‘πŸ’–

πŸ“¦ where this page comes from