UBI provides an idealized, reliable view of a flash chip by mapping physical erase blocks (PEB) to logical erase blocks (LEB). Bad blocks are not mapped to LEBs and so are never used. If a block cannot be erased, it is marked as bad and dropped from the mapping. UBI keeps a count of the number of times each PEB has been erased in the header of the LEB and changes the mapping to ensure that each PEB is erased the same number of times.
UBI accesses the flash memory through the MTD layer. As an extra feature, it can divide an MTD partition into a number of UBI volumes, which improves wear leveling in the following way: Imagine that you have two filesystems, one containing fairly static data, for example a root filesystem, and the other containing ...