YAFFS (Yet Another Flash File System) is a file system designed for flash media. There are two versions of YAFFS - YAFFS1 and YAFFS2.
Flash media has the benefit that seek time is virtually non-existent - so data can be as fragmented and scattered as much as it likes without affecting performance. This makes it unsuited for non-flash media that requires seeking. It is purposely designed to not try to reclaim space until the disk is near full - as flash memory has a limited number of re-writes so it becomes advantageous to stretch data out across the disk as much as possible.
YAFFS has the benefit of requiring no formatting. A device simply erased to 0 can be mounted and used as a valid YAFFS file system.
YAFFS writes whole pages (also called chunks) to flash media at a time.
YAAFS implementations are recommended to maintain a tree structure in memory of the physical locations of each chunks for fast look up.
Mounting requires scanning every page in the entire media to construct the internal tree structure. As flash memory has no seek time, this is fast.
YAFFS2 is an extension of YAFFS1. It features the following differences:
- Support for media with large pages. Internal structures in YAFFS2 are not fixed to assume 512 byte sizing.
- Support for write once media. A block sequence number is added to each written page. Older pages can be logically overwritten without physically overwriting them.