UBI has a pool of reserved physical eraseblocks, and when a physical eraseblock becomes bad, it transparently substitutes it with a good physical eraseblock.UBI moves good data from the newly appeared bad physical eraseblocks to good ones.
It is a volume management system for raw flash devices which manages multiple logical volumes on a single physical flash device and spreads the I/O load (i.e, wear-leveling) across whole flash chip.
Whereas LVM maps logical sectors to physical sectors, UBI maps logical eraseblocks to physical eraseblocks.
But besides the mapping, UBI implements global wear-leveling and transparent I/O errors handling.
An UBI volume is a set of consecutive logical eraseblocks (LEBs).
Each logical eraseblock may be mapped to any physical eraseblock (PEB).
This mapping is managed by UBI, it is hidden from users and it is the base mechanism to provide global wear-leveling (along with per-physical eraseblock erase counters and the ability to transparently move data from more worn-out physical eraseblocks to less worn-out ones).
UBI volume size is specified when the volume is created and may later be changed (volumes are dynamically re-sizable).
There are user-space tools which may be used to manipulate UBI volumes.
There are 2 types of UBI volumes - dynamic volumes and static volumes.