STRUCT UBI_VOLUME_INFO(9)
πΈ NAME πΈ
okay so this page is struct ubi_volume_info(9) from the Kernel API Manual π and it's literally the UBI volume description data structure. That's the name, that's the vibe.
β¨ SYNOPSIS β¨
here's the struct in all its glory, bestie β copied exactly:
struct ubi_volume_info {
int ubi_num;
int vol_id;
int size;
long long used_bytes;
int used_ebs;
int vol_type;
int corrupted;
int upd_marker;
int alignment;
int usable_leb_size;
int name_len;
const char *name;
dev_t cdev;
struct device *dev;
};
π Members π
ubi_numβ the UBI device number this volume belongs to.vol_idβ the volume ID.sizeβ how many physical eraseblocks are reserved for this volume.used_bytesβ how many bytes of data this volume contains.used_ebsβ how many physical eraseblocks of this volume actually contain any data.vol_typeβ the volume type, akaUBI_DYNAMIC_VOLUMEorUBI_STATIC_VOLUME.corruptedβ non-zero if the volume is corrupted (static volumes only).upd_markerβ non-zero if the volume has the update marker set.alignmentβ volume alignment.usable_leb_sizeβ how many bytes are available in logical eraseblocks of this volume.name_lenβ volume name length.nameβ volume name.cdevβ UBI volume character device major and minor numbers.devβ yep, it's in the struct asstruct device *dev;; the OG member rundown doesn't give it a separate blurb, so no invented facts here π.
π Description π
the corrupted flag is only relevant to static volumes and is always zero for dynamic ones. this is because UBI does not care about dynamic volume data protection and only cares about protecting static volume data. periodt.
the upd_marker flag is set if the volume update operation was interrupted. before touching the volume data during the update operation, UBI first sets the update marker flag for this volume. if the volume update operation was further interrupted, the update marker indicates this. if the update marker is set, the contents of the volume is certainly damaged and a new volume update operation has to be started. no cap, that's serious.
to put it differently, corrupted and upd_marker fields have different semantics:
- the
corruptedflag means that this static volume is corrupted for some reasons, but not because of an interrupted volume update. - the
upd_markerfield means that the volume is damaged because of an interrupted update operation.
i.e., the corrupted flag is never set if the upd_marker flag is set. the way that's a whole distinction π
the used_bytes and used_ebs fields are only really needed for static volumes and contain the number of bytes stored in this static volume and how many eraseblocks this data occupies. in case of dynamic volumes, the used_bytes field is equivalent to size*usable_leb_size, and the used_ebs field is equivalent to size.
in general, logical eraseblock size is a property of the UBI device, not of the UBI volume. indeed, the logical eraseblock size depends on the physical eraseblock size and on how much bytes UBI headers consume. but because of the volume alignment (alignment), the usable size of logical eraseblocks of a volume may be less. the following equation is true:
usable_leb_size = LEB size - (LEB size mod alignment)
where LEB size is the logical eraseblock size defined by the UBI device.
the alignment is a multiple of the minimal flash input/output unit size, or 1 if all the available space is used.
to put this differently, alignment may be considered a way to change volume logical eraseblock sizes. slay π
π¦ SEE ALSO π¦
- Kernel file
./include/linux/mtd/ubi.h struct ubi_sgl(9)ubi_sgl_init(9)struct ubi_device_info(9)
xoxo, bestie π this one comes from ./include/linux/mtd and is dated October 2026 β mwah!
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms