smbios-lib
A Rust library for reading, parsing, and serializing SMBIOS data from the host system or from a file.
Table of contents
Overview
This crate reads raw SMBIOS data from the current platform and exposes it through a typed API. It also supports loading SMBIOS tables from a file and dumping raw data to disk.
The crate now targets the DMTF SMBIOS 3.9.0 specification and is designed to be usable both as a library and as a small CLI tool. For a higher-level example application built on top of this crate, see dmidecode-rs.
Installation
Add the crate to your project:
[]
= "0.9.3"
Or install it with Cargo:
Features
- Implements all 49 defined structure types from the DMTF SMBIOS 3.9.0 specification (types 0–46, 126, and 127), with extensibility for OEM types 128–255.
- Cross-platform support for Linux, Intel macOS , Windows, FreeBSD.
- On Linux, reads SMBIOS data from
/sys/firmware/dmi/tables(sysfs); on FreeBSD falls back to/dev/mem. - Exposes typed structure accessors for BIOS, system, baseboard, chassis, processor, memory, and all other standard records.
- Supports iteration, filtering, and handle-based lookups over SMBIOS entries.
- Provides JSON serialization via
serde/serde_json. - Includes a CLI binary named
smbiosdump.
SMBIOS 3.8 / 3.9 highlights
- Processor Information (Type 4): new
socket_typefield;voltagemarked deprecated from 3.8.0; additionalProcessorFamilyvariants (Intel Core 3/5/7/9, Intel Core Ultra 3/5/7/9, Intel Xeon D, and more). - System Chassis Information (Type 3): new
rack_typeandrack_heightfields; newSpecifiedInRackHeightvariant forChassisHeight. - Memory Device (Type 17): updated fields per 3.9.0.
- Management Controller Host Interface (Type 42): expanded protocol record data.
- System Slot (Type 9): additional slot type values.
CLI usage
The repository includes a binary that can be used directly from the workspace:
Useful examples:
# Print the full SMBIOS table
# Read from a file instead of the host platform
# Dump the raw SMBIOS bytes to a file
# Query a single SMBIOS string field
# Output the parsed table as JSON
Library usage
The primary entry points are table_load_from_device, load_smbios_data_from_file, and the SMBiosData iterator API.
use *;
Common patterns include:
find_mapto retrieve a single structure instance.collect::<T>()to gather all entries of a given structure type.find_by_handle(&handle)to resolve structures that reference one another.filter(...)andfind(...)for targeted searches.
Security
This library follows a strict security stance: never trust the input.
SMBIOS firmware can be inconsistent across vendors and across versions, so the API is designed to return Option-based results and let callers handle missing or malformed data explicitly.