Presentation is loading. Please wait.

Presentation is loading. Please wait.

UBI – Unsorted Block Images Artem Bityutskiy. Introduction A new technology for flash devices Designed by IBM Publicly accessible Git tree GPL license.

Similar presentations


Presentation on theme: "UBI – Unsorted Block Images Artem Bityutskiy. Introduction A new technology for flash devices Designed by IBM Publicly accessible Git tree GPL license."— Presentation transcript:

1 UBI – Unsorted Block Images Artem Bityutskiy

2 Introduction A new technology for flash devices Designed by IBM Publicly accessible Git tree GPL license information at

3 Plan 1.Linux MTD overview 2.UBI overview

4 Linux MTD overview

5 MTD overview MTD stands for Memory Technology Devices MTD is a Linux subsystem ( drivers/mtd/ ) MTD provides uniform access to various flash devices MTD provides a generic API for that MTD provides an MTD device abstraction NANDNORDataFlashAG-ANDOneNANDECCd NOR MTD device, MTD API JFFS2character device (/dev/mtd0)

6 MTD device consists of eraseblocks Eraseblock size varies, typically Kilobytes Eraseblocks may be written to MTD device … Eraseblock, 128K MTD device write, but not re-written re-write X Whole eraseblock has to be erased first write Then it is possible to write there

7 MDT device vs Block device Block device Consists of sectors Sectors are small (512, 1024 bytes) readwrite2 operations: read and write Bad sectors are hidden by hardware Sectors do not get worn out MTD device Consists of eraseblocks Eraseblocks are larger ( Kilobytes) readwriteerase3 operations: read, write and erase Bad eraseblocks are not hidden Eraseblocks get worn-out after erasures. MTD device is more difficult to handle

8 MTD partitions Flash chip may be split on several MTD partitions MTD partition is a set of consecutive eraseblocks MTD partitions is a physical flash area … Partition 1 (e.g., initfs) Partition 2 (e.g., rootfs) … so on

9 Bad blocks Drawbacks of MTD partitions MTD partitions are static – now way to change them on-flight Do not provide wear-leveling for the whole chip … Partition 1Partition 2 JFFS2

10 UBI overview

11 UBI layer … Physical flash MTD layer UBI layer Flash File System (e.g., UBIFS)

12 Create UBI volume C - size 20 logical eraseblocks Re-size volume B to 10 logical eraseblocks Create UBI volume A – size 10 logical eraseblocksCreate UBI volume B - size 15 logical eraseblocks Delete UBI volume ARe-size volume C to 40 logical eraseblock Logical Volumes MTD device (physical flash) Volume A UBI provides logical volumes instead of MTD partitions UBI volumes are in a way similar to LVM volumes UBI volumes may be dynamically created, deleted and re-sized Volume BVolume CVolume BVolume C … and so on

13 Wear-leveling wholeUBI does wear-leveling across whole MTD device! Wear-leveling is done by UBI, not by the UBI user! Boot volumeRootFS volume DataStorage volume MTD device (physical flash) JFFS2

14 UBI volume vs. MTD partition MTD partition PEBConsists of physical eraseblocks (PEB) Does not implement wear-leveling Admits of bad PEBs UBI volume LEBConsists of logical eraseblocks (LEB) Implements wear-leveling Devoid of bad LEBs Advantages of UBI Allows dynamic volume creation, deletion and re-sizing more flexibility Eliminates the wear problem simpler software Eliminates bad eraseblocks problem simpler software

15 Static read-only data PEB 0PEB 6 PEB 7 How it works LEBs are mapped to PEBs PEB 1PEB 2PEB 3PEB 4PEB 5PEB 8PEB 9PEB 10 MTD device LEB 0LEB 1LEB 2LEB 3LEB 4LEB 0LEB 1LEB 2 Volume AVolume B UBI layer erase read Return 0xFFs write read Low erase counterHigh erase counter Move data Re-map LEB Any LEB may be mapped to any PEB

16 Bad eraseblocks handling UBI volumes are devoid of bad eraseblocks UBI does proper error recovery transparently Bad physical eraseblock Empty physical Eraseblock Partially filled physical eraseblock Write more data Write error! The eraseblocks become bad! No panic! Recover the data to a good PEB Write newcoming data to this PEB Re-map the LEB to this PEB Mark this PEB s bad The data have been successfully written! An UBI volume

17 UBI interfaces UBI character devices: deletere-sizeget device description 1./dev/ubi0, /dev/ubi1, … – UBI devices: volume create, delete, re-size, and get device description operations readwriteupdateget volume description 2./dev/ubi0_0, /dev/ubi0_1, … - UBI volumes: read, write, update, and get volume description operations UBI sysfs interface: /sys/class/ubi UBI in-kernel interface: include/linux/mtd/ubi.h

18 Volume update operation Useful for software updates corruptedVolume is in corrupted state if update is interrupted Corrupted volumes are not usable and must be updated

19 Static and dynamic UBI volumes Dynamic volumes are read-write Static volumes are read-only Static volumes are protected by CRC-32 checksum


Download ppt "UBI – Unsorted Block Images Artem Bityutskiy. Introduction A new technology for flash devices Designed by IBM Publicly accessible Git tree GPL license."

Similar presentations


Ads by Google