Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

/sys/class/ubiX

FieldValue
SubsystemUBI subsystem - per-device view (ubi0, ubi1, …) inside the ubi class; implementation file not in cached tree
Config gatenot verifiable from the cached sources (cached tree has no Kconfig or driver files); class absent on the live host
ABI documentationDocumentation/ABI/stable/sysfs-class-ubi, entries /sys/class/ubiX/ and /sys/class/ubi/ubiX/*
Since2.6.22 (July 2006); mtd_num 2.6.25; ro_mode 4.7
Live (5.10.134 host)class absent: no /sys/class/ubi on the host, hence no ubiX entries
Ledger IDSYSC-ubiX

What it represents

The UBI device directories themselves: /sys/class/ubi0, /sys/class/ubi1, etc. describe UBI device 0, 1 and so on - one per attached MTD device. The ABI describes them both as /sys/class/ubiX/ and, in the full class layout, as /sys/class/ubi/ubiX/; they are the per-device member directories of the ubi class (class page: ubi), separated out here because the ledger tracks the device-dir layout as its own row. Geometry, media health and background-thread state are all exposed here, which makes a ubiX directory the one-stop troubleshooting view for an attached UBI device.

Relationship to the device model

Each ubiX directory is the class view of one UBI device: it names the underlying MTD device (mtd_num), exposes geometry and health counters, and contains the ubiX_Y volume subdirectories. The dev file gives the major:minor of /dev/ubiX, the character device that performs attach/detach and volume management via ioctls. Volume directories and their attributes are documented on the ubi class page.

Attributes

All paths below are read-only; source is Documentation/ABI/stable/sysfs-class-ubi throughout.

AttributeR/WUnit/formatConditional?Source
ubiX/avail_eraseblocksROlogical eraseblocks available for volume creationalwaysABI, 2.6.22
ubiX/bad_peb_countRObad physical eraseblocks on the MTD devicealwaysABI, 2.6.22
ubiX/bgt_enabledROASCII 0/1 background thread statealwaysABI, 2.6.22
ubiX/devROmajor:minor of /dev/ubiXalwaysABI, 2.6.22
ubiX/eraseblock_sizeROmax logical eraseblock size (bytes)alwaysABI, 2.6.22
ubiX/max_ecROmaximum erase counter valuealwaysABI, 2.6.22
ubiX/max_vol_countROmaximum number of volumesalwaysABI, 2.6.22
ubiX/min_io_sizeROminimum I/O unit size (bytes)alwaysABI, 2.6.22
ubiX/mtd_numROunderlying MTD device numberalwaysABI, 2.6.25
ubiX/reserved_for_badROPEBs reserved for bad-block handlingalwaysABI, 2.6.22
ubiX/ro_modeROASCII 1 when the device switched to read-only after media errorsalwaysABI, 4.7
ubiX/total_eraseblocksROcount of good physical eraseblocksalwaysABI, 2.6.22
ubiX/volumes_countROvolumes on this devicealwaysABI, 2.6.22
ubiX/ubiX_Y/–one subdirectory per volume (attributes on the ubi class page)volume existsABI, 2.6.22

Safety and writes

Nothing writable: the whole ubiX attribute set is a status and geometry snapshot. The dangerous operations on UBI devices (detach, volume removal, update) are ioctls on the character device named by dev. For troubleshooting, ro_mode, bad_peb_count and max_ec are the media-health indicators the ABI itself describes.

References

  • Documentation/ABI/stable/sysfs-class-ubi (cached copy; ubiX entries)
  • Class page: ubi; MTD layer: mtd; coverage: ledger
  • Implementation: not in cached tree
  • Live check: /sys/class/ubi absent (kernel 5.10.134, read-only enumeration)