STRUCT UBI_MKVOL_REQ(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct ubi_mkvol_req(9) ✨

okay so bestie, welcome to the kernel API manual πŸ’… this one's from the struct ubi_mkvol_req(9) page and it's literally all about the lil data structure that carries your volume-creation request. UBI hive, rise 🐝


πŸŽ€ NAME πŸŽ€

struct ubi_mkvol_req β€” the volume description data structure used in volume creation requests. yes that's her. that's the whole job. 🫢


🌸 SYNOPSIS 🌸

struct ubi_mkvol_req {
    __s32 vol_id;
    __s32 alignment;
    __s64 bytes;
    __s8 vol_type;
    __u8 flags;
    __s16 name_len;
    __s8 padding2[4];
    char name[UBI_MAX_VOLUME_NAME + 1];
 };

look at her. iconic layout. no notes. πŸ’–


πŸ¦‹ Members πŸ¦‹

  • vol_id β€” the volume number πŸ‘‘
  • alignment β€” the volume alignment, we'll get into why this is lowkey the main character in a sec
  • bytes β€” how big the volume is, in bytes
  • vol_type β€” the volume type, which is either UBI_DYNAMIC_VOLUME or UBI_STATIC_VOLUME
  • flags β€” volume flags, aka UBI_VOL_SKIP_CRC_CHECK_FLG
  • name_len β€” how long the volume name is
  • padding2 β€” reserved for future, not used, and has to be zeroed. not optional bestie, zero it out πŸ™ˆ
  • name β€” the volume name itself

⭐ Description ⭐

so this struct is what user-space programs pass in when they're creating new volumes. that's the vibe check it's here for ✨

the used_bytes field is only necessary when creating static volumes β€” like, only then, no cap.

now the alignment field, buckle up 🎒 it specifies the required alignment of the volume's logical eraseblock. which means the size of the logical eraseblocks gets aligned to this number, i.e.:

(UBI device logical eraseblock size) mod (alignment) = 0

to put it differently (and honestly this is the clearest way to think about it): the logical eraseblock of this volume may be slightly shortened so it comes out properly aligned. the alignment has to be a multiple of the flash minimal input/output unit, or 1 if you wanna utilize the entire available space of logical eraseblocks. one or the other, periodt 🌈

and why would you even care? okay so the alignment field may be useful when, for example, someone wants to maintain a block device on top of an UBI volume. in that case it's desirable to fit an integer number of blocks into the logical eraseblocks of this UBI volume. with alignment you can update this volume using plane UBI volume image BLOBs without caring about how to properly align them. the way that just works 😭πŸ”₯


πŸ’œ SEE ALSO πŸ’œ

kernel file ./include/uapi/mtd/ubi-user.h and her little friends:

  • struct ubi_attach_req(9)
  • struct ubi_rsvol_req(9)
  • struct ubi_rnvol_req(9)
  • struct ubi_ecinfo_req(9)
  • struct ubi_leb_change_req(9)
  • struct ubi_map_req(9)
  • struct ubi_set_vol_prop_req(9)
  • struct ubi_blkcreate_req(9)

read them all, iykyk 🧚


heads up bestie: padding2 is reserved for future use, isn't used, and has to be zeroed β€” that's a hard requirement, not a suggestion πŸ™…β€β™€οΈ

and that's the page! πŸ’– this gem lives in ./include/uapi/mtd and the page is dated October 2026, so, from the future, slay ⭐ bye bestie, go create some volumes responsibly πŸŽ€

πŸ“¦ where this page comes from