Fact-checked by Grok 2 weeks ago

F2FS

F2FS (Flash-Friendly File System) is a developed by for the , specifically optimized for flash memory-based storage devices such as SSDs, eMMC, and SD cards. Introduced in Linux kernel version 3.8 on December 20, 2012, it addresses the unique characteristics of flash storage, including erase-before-write operations and limited write endurance, by using an append-only logging scheme to convert random writes into sequential ones. The design of F2FS draws from traditional log-structured file systems like LFS while mitigating their drawbacks, such as the "wandering tree" problem and high garbage collection overhead, through innovative features like a for efficient index updates and multi-head to separate hot and cold data. Its on-disk layout divides the volume into fixed-size segments of 2 MB each, organized into sections and zones that align with the operational units of underlying layers (FTLs), enabling better and reduced . F2FS supports adaptive modes—switching between normal and threaded based on utilization—to maintain high even as the file system fills up, and it incorporates background cleaning algorithms with greedy or cost-benefit victim selection for efficient garbage collection. In terms of performance, F2FS has demonstrated significant advantages over file systems like on flash : on mobile devices, it achieves up to 3.1× faster throughput in benchmarks like IOzone and 2× in workloads, while on server-grade SSDs, it delivers up to 2.5× improvement in random write scenarios. Additional optimizations include fsync acceleration via roll-forward and support for zoned , making it suitable for a range of applications from systems to centers. Developed by a team at Samsung's Memory Business unit, including lead author Jaegeuk Kim, F2FS was first presented at the 13th on File and Technologies (FAST '15) in 2015, where its architecture and empirical results were detailed. Tools for creating, checking, and debugging F2FS volumes are maintained in the official repository, ensuring ongoing integration and evolution within the ecosystem.

History

Development and Initial Release

F2FS, or Flash-Friendly File System, was initiated by in 2012 to overcome the inefficiencies of traditional block-based s when used on NAND flash storage devices. Traditional systems like , designed for rotating magnetic media, struggle with flash memory's erase-before-write mechanism and the need for , leading to increased and reduced lifespan. Samsung's development effort focused on creating a that aligns with flash characteristics, such as sequential writes and out-of-place updates, to minimize garbage collection overhead and enhance performance on devices like SSDs, eMMC, and SD cards. The primary development was led by Jaegeuk Kim, a engineer, who submitted the initial patch series to the on October 5, 2012. Kim's team at addressed known limitations in earlier log-structured file systems, including the snowball effect of the wandering tree problem and excessive cleaning costs, by introducing configurable on-disk layouts and adaptive allocation strategies. Early prototypes were tested internally on 's NAND flash-based devices to validate optimizations for real-world and scenarios. F2FS was merged into the mainline on December 20, 2012, via commit a13eea6bd9ee62ceacfc5243d54c84396bc86cb4, marking its official integration as part of the 3.8 release cycle. The full version 3.8, including F2FS support, was released on February 18, 2013. This initial release introduced core features like checkpointing for crash recovery and support for extended attributes, establishing F2FS as an open-source alternative tailored for flash-centric workloads.

Subsequent Enhancements

Following its initial integration into the Linux kernel in version 3.8, F2FS received inline data support in Linux 3.14, allowing small files to be stored directly within inode blocks to reduce metadata overhead and improve access times for tiny files. This enhancement was part of broader refactoring efforts to optimize bio operations and inline features. In Linux 4.2, F2FS added native file-based encryption support via the fscrypt framework, enabling per-directory encryption keys for secure storage on flash devices while maintaining compatibility with Android's requirements. This feature addressed growing needs for data protection in mobile environments without significant performance penalties. Transparent compression capabilities were introduced in Linux 5.6 with support for LZO and LZ4 algorithms, allowing optional on-the-fly compression to enhance storage efficiency on NAND flash. Zstd compression was added shortly after in Linux 5.7, providing higher compression ratios for better space savings in resource-constrained systems. Linux 6.7 brought support for 16K block sizes, aligning F2FS with larger page sizes common in modern ARM-based mobile SoCs and enabling improved I/O throughput. Concurrently, the maximum for 16K-block configurations was adjusted to 16 TB to accommodate data unit compatibility and prevent overflows in addressing schemes. The 6.18 kernel series also includes performance refinements, such as optimizations for journaling through tunable checkpoint modes and controls to reduce latency during metadata updates. These updates also improve fragmentation handling via node block prefetching, efficient FUA write merging, and prioritized block allocation for hot data, yielding measurable gains in write-heavy workloads. Throughout its evolution, F2FS has benefited from contributions by companies like , , and , focusing on mobile-specific tweaks such as quota support and block size adaptations for devices.

Design Principles

Log-Structured Approach

F2FS adopts a (LFS) paradigm, designed specifically for flash , where new data versions are appended sequentially to logs rather than performing in-place updates. This approach minimizes the number of erase operations on flash blocks, which are constrained by flash's requirement to erase entire blocks before rewriting. By treating the as an append-only log, F2FS avoids the inefficiencies of random writes that would otherwise lead to fragmented updates and increased wear on the medium. To enhance efficiency, F2FS separates , referred to as , and user into distinct log streams. updates are written to node logs, while is directed to separate data logs, allowing for independent management and reducing contention during writes. This separation enables optimized handling of different access patterns, with operations converting potential random I/O into sequential writes, which align well with the strengths of NAND flash for high-throughput . F2FS employs adaptive logging modes, switching dynamically between normal logging (copy-and-compaction scheme) when the filesystem is and threaded logging (writing to dirty segments without foreground ) as utilization increases, to maintain and minimize garbage collection overhead. File system updates in F2FS are managed through a versioning mechanism, where modifications create new entries, and previous versions are marked as invalid without immediate erasure. Invalidated blocks accumulate until collection reclaims space, ensuring that the system maintains a structure over time. This contrasts with traditional LFS implementations, which often suffer from due to excessive copying during . F2FS mitigates this issue through multi-head , which divides logs into , warm, and categories based on access frequency, thereby isolating frequently updated data to reduce unnecessary overwrites and collection overhead.

Flash-Specific Optimizations

F2FS incorporates optimizations specifically tailored to flash memory's inherent constraints, including limited program/erase (P/E) cycles, the requirement for erase-before-write operations, and the inefficiency of in-place updates. These adaptations prioritize by minimizing and leveraging hardware-level features like the Flash Translation Layer (FTL), while enhancing performance for flash-based workloads such as those in and devices. A core optimization is the hot/cold data classification, which separates frequently accessed "hot" data from archival "cold" data to distribute wear more evenly and reduce erase cycles on high-activity areas. F2FS achieves this through multi-head logging with up to six distinct logs (configurable to 2, 4, or 6), categorizing node and blocks as , warm, or based on access patterns and file types—for instance, directory entries and small inline as , regular file as warm, and or migrated blocks as . This proactive separation aligns writes with flash's sequential preferences, mitigating the "wandering tree" problem in log-structured systems and improving overall lifespan without relying on FTL alone. To integrate effectively with the device's FTL, F2FS avoids implementing its own wear-leveling algorithms, instead mapping active logs across different zones that match the FTL's set-associative or fully-associative granularity. This design reduces filesystem-induced garbage collection overhead by distributing updates and allowing the hardware FTL to handle block remapping and leveling transparently, which is particularly beneficial for consumer-grade flash like eMMC and UFS. Out-of-place updates form another fundamental adaptation, where all modifications are appended sequentially to new log segments rather than overwriting existing blocks, thereby preventing and aligning with flash's out-of-place write semantics. Old data versions are invalidated via structures like the Node Address Table (), enabling efficient later reclamation during without immediate erases. Building on its log-structured appending, this approach converts random writes into sequential ones, further optimizing flash . F2FS supports multi-device configurations for arrays, enabling a single filesystem to span multiple block devices through linear of address spaces without striping or built-in . This feature, introduced in 4.10, facilitates larger storage pools on multi- setups like SSD arrays, with segment allocation adjusted per device to maintain alignment. For small-block writes prevalent in mobile workloads, F2FS optimizes via inline and dentry storage within inode blocks for files smaller than 3,692 bytes (approximately 3.6 KB), eliminating separate block allocations and reducing overhead. Additionally, roll-forward during fsync operations writes only affected and direct node blocks, minimizing and amplification for frequent small synchronous updates common in journaling scenarios. These mechanisms ensure efficient handling of flash's page-level programming while preserving atomicity.

On-Disk Format

Volume Segmentation

F2FS organizes the storage volume into fixed-size segments to facilitate efficient management tailored to characteristics. Each segment is 2 MB in size, comprising 512 of the default 4 KB size, serving as the fundamental unit for allocation, collection, and . These segments are grouped into sections (typically one segment per section by default) and zones (groups of sections), enabling structured handling of and across the volume. This segmentation supports the log-structured design by allowing sequential writes within segments, minimizing random access patterns that could degrade flash performance. The volume is partitioned into distinct areas starting from the beginning of the device. The area, located at the partition's start with two redundant copies for , stores essential filesystem parameters such as version information, size, segment count, and configuration options like zone sizes. Following the superblock is the checkpoint area, which contains checkpoint blocks (CP blocks) that record the filesystem's state for crash recovery, including references to valid bitmaps and summaries. The summary areas encompass the Segment Information (SIT), which tracks the valid count and dirty status bitmap for each segment; the Node Address (NAT), which maps node IDs to physical addresses for all node blocks in the main area; and the Segment Summary Area (SSA), which provides ownership information for data and node blocks within segments to aid in recovery and allocation. The bulk of the volume constitutes the main area, dedicated to storing actual file data and , and is subdivided into hot, warm, and cold zones to optimize and load distribution. Data segments in the main area hold file contents, while node segments store such as inodes and directory entries; these are allocated preferentially in specific zones based on access patterns to balance wear across blocks. The hot zone prioritizes frequently accessed items like directory entries and direct node blocks, the warm zone handles moderately accessed data and indirect nodes, and the cold zone manages infrequently updated or archived data such as files, ensuring that hot data remains isolated from colder segments to reduce collection overhead. This zoning aligns allocations with the translation layer's , promoting even utilization of underlying . F2FS supports maximum volume sizes of 16 TB when using the default 4 KB block size, limited by 32-bit block addressing (2^32 blocks × 4 KB). Following enhancements in Linux kernel 6.7 for larger page sizes, F2FS accommodates 16 KB block sizes, extending the maximum volume capacity to 64 TB (2^32 blocks × 16 KB).

Checkpoint and Metadata Areas

F2FS employs a checkpointing mechanism to ensure filesystem consistency, particularly in the face of sudden power losses common in mobile devices. This involves creating periodic snapshots of the filesystem state, which serve as recovery points without requiring full filesystem synchronization operations. The checkpoints utilize shadow paging, where updates are written to new locations while preserving the previous checkpoint as a fallback, enabling quick recovery by simply rolling back to the last valid checkpoint during mount. For , F2FS maintains dual checkpoint packs, labeled CP #0 and CP #1, stored in the checkpoint area. Each pack contains critical information including references to the inode, valid /SIT bitmaps, segment summaries that outline block usage per segment, and logs recording recent modifications such as inode changes and entries. At time, the filesystem scans the checkpoint area to identify and load the most recent valid pack, ensuring updates and minimizing recovery overhead. Supporting the checkpoint process are dedicated metadata structures that track filesystem state efficiently. The Segment Information Table (SIT) resides in the SIT area and uses bitmaps to record the number of valid and invalid blocks within each 2 MB segment, facilitating informed decisions during garbage collection by identifying segments for cleaning. The Node Address Table (), located in the NAT area, maps logical inode numbers to their physical node block addresses in the main area, enabling rapid location of file metadata. Complementing these, the Summary Structure Area () provides per-block summary entries detailing ownership information for data and node blocks within segments, such as the parent inode number and offset.

Core Data Structures

Node and Index Structures

F2FS utilizes a pointer-based hierarchical system to index blocks and , mitigating issues common in traditional file systems by isolating updates. This structure draws from log-structured principles but incorporates multi-level optimized for flash storage, where are stored in dedicated segments of the main area. The core of this system is the inode, a fixed-size 4 KB block that stores such as permissions, timestamps, , and size, alongside indexing pointers. Each inode includes up to 923 direct pointers to blocks, two pointers to direct blocks, two pointers to indirect blocks, and one pointer to a double indirect block, enabling efficient access to contents without excessive for small to medium files. For small files under approximately 3.5 KB, F2FS supports inline storage directly within the inode block via the inline_data mount option, which embeds the file contents to minimize block allocations and I/O operations. Node blocks fall into three primary types: inodes, direct nodes, and indirect nodes, each designed to chain hierarchically for . A direct node block points to up to 1018 data blocks, providing immediate access for files that fit within this limit. Indirect nodes extend this by pointing to up to 1018 additional node blocks (direct or further indirect), while a double indirect node points to 1018 indirect nodes, allowing the system to address vast file sizes—up to 3.94 TB for 4 block sizes or 16 TB for 16 block sizes—through this multi-level indirection scheme, akin to traditional Unix file systems but with log-optimized updates to reduce on . Node addressing relies on the , a bitmap-based structure in the area that maps logical identifiers to physical block addresses in the main area, ensuring quick lookups without traversing the entire hierarchy. To maintain consistency during log-structured writes, NAT entries include version numbers that are updated only at checkpoints, preventing stale references and enabling atomic operations. entries reference these inodes by ID to link filenames to file and .

Directory Organization

F2FS organizes directories through hash-based entries stored in specialized dentry blocks, which are pointed to by the directory's inode. These blocks contain filename hashes, corresponding inode numbers, and the full names, enabling quick mapping from names to file . Each 4 dentry block includes a 27-byte to track valid entries, followed by an of up to 214 dentry slots (each 11 bytes, holding a 32-bit , inode number, name length, and type) and space for filename entries (1712 bytes total, with individual filenames limited to 255 bytes). This structure supports efficient storage and retrieval in flash-optimized environments. To handle large directories, F2FS implements multi-level hash tables divided into . A filename's value identifies the starting , after which the system incrementally scans a fixed number of dentry blocks per level—typically 2 blocks at level 0 and 4 blocks at higher levels—until the target entry is located or the maximum level (configurable up to 6) is exhausted. This hashing mechanism delivers an average lookup performance of O(1), as most operations resolve within the initial scan, with a fallback to linear scanning of the block if collisions occur. In the worst case, especially for directories containing millions of entries, the multi-level traversal results in O(\log N) complexity, where N is the total number of entries, ensuring without excessive overhead. The lookup behavior can be tuned via the lookup_mode mount option (e.g., perf for performance-optimized hashing or compat for compatibility with linear scans). Since 5.3, F2FS has supported case-insensitive name handling through the casefold feature, which normalizes filenames using casefolding for lookups while preserving the original case on disk; this is enabled during filesystem creation with the -O casefold option in mkfs.f2fs and controlled at mount time. Hard links and deletions in directories are managed via reference counts stored in the target inodes. Creating a increments the inode's reference count and adds a new dentry entry, while deletion invalidates the entry by clearing the bitmap bit in the dentry block and decrementing the count; the inode and its data are reclaimed only when the count reaches zero during garbage collection. This approach maintains consistency without immediate space reclamation, aligning with F2FS's log-structured design.

Allocation and Maintenance

Block Allocation Strategies

F2FS implements block allocation through a multi-log that separates into hot, warm, and cold categories to optimize performance by minimizing and fragmentation. This separation is managed via six active log areas in the main region: hot, warm, and cold logs for both node blocks () and blocks. Hot typically includes directory entries and small or frequently accessed , warm covers general content, and cold encompasses less frequently modified blocks such as or those migrated during . By , new or small files are allocated to the data log to prioritize quick access and reduce initial fragmentation. As files age or their access frequency decreases—determined by last modification time and usage patterns—subsequent writes shift to warm or logs, ensuring hotter data remains in faster-accessible areas while colder data is isolated to reduce unnecessary overwrites. Allocation occurs through dedicated cursors for each log type, such as CURSEG_HOT_DATA, CURSEG_WARM_DATA, CURSEG_COLD_DATA, CURSEG_HOT_NODE, CURSEG_WARM_NODE, and CURSEG_COLD_NODE, which track the current segment for writes and advance sequentially within section-aligned boundaries ( 2 segments). To select victim segments for new writes, F2FS uses a cost-based that evaluates segment utilization and , favoring underutilized areas to provide efficiently without excessive cleaning overhead. This approach integrates with the file system's segment zoning layout, where logs are confined to specific zones for parallelism. For compressed or encrypted files, F2FS prefers inline allocation when data fits within the inode (up to approximately 3.4 ), storing compressed clusters directly to avoid extra overhead. Larger or extent-based files leverage an extent —a red-black —to map contiguous logical blocks to physical ones, enabling efficient allocation of sequential clusters (default minimum 16 ) and reducing fragmentation in workloads involving algorithms like LZ4 or . The extent can be enhanced with the age_extent_cache mount option, which tracks the update frequency of extents to provide better allocation hints based on access patterns. Adaptive strategies further enhance allocation for sequential workloads: the default "adaptive" mode switches between normal (for random writes) and LFS-style threaded (for sequential patterns) at high filesystem utilization levels, such as when overprovisioned space becomes limited, promoting contiguous assignment to minimize fragmentation. Experimental modes like "fragment:" or "fragment:" allow controlled scattering of allocations for testing, but use relies on the extent cache and log separation for robustness.

Garbage Collection Process

F2FS employs to reclaim invalid blocks in its log-structured layout, ensuring sufficient free space for ongoing writes while minimizing on flash storage. The process identifies segments with invalid data, migrates any valid blocks to new locations, and erases the victim segments to make them available again. This is crucial for maintaining performance, as flash devices cannot overwrite blocks in place and require erasure at the segment level before reuse. Background GC operates periodically through a thread when the system is idle, proactively cleaning segments to prevent space exhaustion. It selects victim segments using a cost-benefit that evaluates both the number of valid (utilization) and the segment's , derived from the last modification time in the Segment Information Table (SIT), to balance efficiency and avoid excessive thrashing. An alternative age-threshold GC (ATGC) , available via option, uses age thresholds for victim selection in background operations, particularly beneficial for workloads with aged data patterns. This approach prioritizes reclaiming segments with high invalid ratios while considering the cost of , such as the effort to relocate older, potentially colder data. In contrast, foreground (on-demand) GC triggers synchronously when free segments fall below a —typically when insufficient space is available for a VFS operation—potentially blocking I/O until completion. It employs a simpler , selecting the segment with the fewest valid to minimize during urgent reclamation. Victim selection emphasizes cold segments to preserve hot data integrity and reduce unnecessary migrations. The SIT maintains per-segment validity bitmaps and counts, enabling quick identification of invalid blocks without scanning the entire filesystem. During GC, the Segment Summary Area (SSA) provides block ownership details, facilitating the retrieval of parent node structures for valid data migration. Valid blocks are lazily moved to the page cache and then written to free logs, after which the victim segment is invalidated and queued for erasure post-checkpoint. This process integrates hot/cold data classification by directing colder data toward segments easier to reclaim. Multi-head logging supports even distribution of writes across hot, warm, and cold zones, reducing localized wear and aiding by isolating data lifetimes. F2FS maintains up to six active logs (separate for nodes and data, categorized by temperature), which helps in selecting victims from colder logs during background operations. When free space drops critically low (e.g., below 5% of total segments), the system switches to threaded to trigger more aggressive cleaning. Tuning parameters like the overprovisioning ratio—defaulting to 5% of device capacity—reserve hidden space to buffer against fragmentation and delay invocations, enhancing overall efficiency. This ratio can be adjusted during formatting (e.g., via mkfs.f2fs), with values around 4-7% commonly used to optimize for different workloads, allowing more headroom for invalidation before reclamation is needed. Mount options such as background_gc=on (default) enable periodic cleaning, while gc_merge integrates foreground requests into background processes for better throughput.

Key Features

Compression and Encryption

F2FS supports transparent to reduce storage usage on flash devices, allowing files to be compressed on write and decompressed on read without intervention. Compression can be enabled on a per-inode or per-directory basis using the chattr +c command, with support for algorithms including LZO for fast , LZ4 for a balance of speed and ratio, and for higher ratios. In the default "fs" mode, F2FS automatically compresses eligible data during writeback, while "user" mode permits manual control via ioctls such as F2FS_IOC_COMPRESS_FILE and F2FS_IOC_DECOMPRESS_FILE. Compression is limited to write-once files to avoid , with data compressed only if the ratio meets a configurable threshold. The compression implementation organizes data into clusters, typically starting at 16 KB (configurable via compress_log_size), where each cluster maps to one or more physical blocks depending on the compression efficiency. Compressed clusters are stored as extents in metadata, including details like the compression flag, data length, checksum for verification (if enabled via compress_chksum), and the compressed payload itself; small extents may be stored inline to minimize overhead. This approach reduces the physical footprint on NAND flash, extending device lifespan by lowering write volumes, though it introduces CPU overhead during compression and decompression operations. Mount options like compress_algorithm=lz4 or compress_extension=ext allow fine-tuning, and unused compressed space can be released explicitly with F2FS_IOC_RELEASE_COMPRESS_BLOCKS to reclaim storage. F2FS integrates with the kernel's fscrypt framework for , providing transparent protection for file contents and filenames using per-file keys derived from a master key via a . The primary is AES-256-XTS for file data encryption, with AES-256-CBC-CTS or AES-256-HCTR2 for filenames to handle variable lengths up to the NAME_MAX of 255 bytes; is also supported as a lightweight alternative for hardware without AES acceleration. Encryption support was added in 4.2, enabling per-directory policies that apply to all descendants while maintaining compliance through full filename length preservation and no stacking layers. Inline is available via the blk-crypto when mounted with the inlinecrypt option, offloading operations to compatible for reduced CPU load, though this remains optional and depends on capabilities. Encrypted files in F2FS store keys in inode extended attributes, ensuring secure, efficient without penalties from user-space tools, while supporting features like case-insensitive lookups when combined with other policies. This integration prioritizes for and environments where F2FS is common, without compromising the filesystem's log-structured design.

Additional Capabilities

F2FS includes support for project quotas, introduced in Linux kernel version 4.14, which enable disk usage limits for specific s or user groups to manage efficiently. The prjquota mount option activates plain project disk quota accounting, allowing administrators to enforce limits without affecting standard user or group quotas. Since version 5.4, F2FS has integrated FS-verity, a for transparent and authenticity of read-only files, enabling of file contents against tampering through Merkle tree-based signatures. This feature requires the filesystem to be formatted with the verity option using f2fs-tools version 1.11.0 or later, and it performs on-demand cryptographic checks during reads to ensure . F2FS provides casefold support starting from Linux kernel version 5.2, facilitating case-insensitive filename handling on otherwise case-sensitive filesystems, particularly useful for with applications expecting such behavior. The feature is enabled via the casefold option during mkfs.f2fs formatting and relies on normalization for consistent lookups, with mount options like lookup_mode controlling performance modes such as perf or compat. Nanosecond timestamps have been available in F2FS since its introduction in version 3.8, providing high-precision recording of file access, modification, and change times in inode to support applications requiring fine-grained . For crash-safe operations, F2FS implements atomic writes, allowing applications to perform failure-atomic updates to files via ioctls, ensuring that either all changes commit or none do in the event of a power loss. Complementing this, ORPHAN inode handling maintains lists of inodes with open but unlinked files in the checkpoint area, enabling recovery and cleanup during mount to prevent data leaks from incomplete operations. Multi-device support was added in version 4.10, permitting a single F2FS instance to span multiple block devices for enhanced scalability and capacity without relying on external volume managers. Additionally, online resize functionality, available since version 4.14, allows dynamic expansion or shrinking of the filesystem while mounted, using the resize.f2fs tool to adjust segment allocations and metadata structures seamlessly. F2FS also supports standard ACLs and extended attributes (xattrs) by default when the relevant kernel configurations are enabled, providing fine-grained and custom metadata storage.

Adoption

Mobile and Embedded Devices

F2FS gained initial traction in mobile and embedded devices through early adoption by key manufacturers optimizing for flash storage. implemented F2FS in its smartphones starting with the second-generation Moto G in 2015 for the userdata partition, leveraging the file system's log-structured design to enhance performance on NAND flash. , as the original developer of F2FS, integrated it into select devices starting in the mid-2010s, with explicit use confirmed in flagships such as the Galaxy Note 10 in 2019 and subsequent models, where it paired with UFS storage to reduce and improve I/O efficiency. Google adopted F2FS for its tablet in 2014, marking an early endorsement for /data partitions in stock hardware. This was followed by the in 2018, where F2FS replaced to capitalize on flash-optimized features like inline data and reduced fragmentation, contributing to faster app loading and system responsiveness. By , F2FS became a recommended option in for the /data partition, supporting file-based and aligning with the shift toward UFS and eMMC in mid-range and flagship devices. Other vendors followed suit, including with the 3T in 2016 for improved sequential read/write speeds, and in the 10 Pro in 2019 as the first device to pair F2FS with SanDisk's iNAND flash for anti-fragmentation benefits. Integration into the Project has driven widespread use of F2FS for user data partitions in many and mid-range Android devices with eMMC or UFS storage by 2025, particularly where its log-structured approach minimizes wear and boosts endurance. As of 2025, F2FS is used in a significant portion of Android devices, estimated to cover hundreds of millions of units annually, according to vendor reports. incorporated F2FS starting with the P9 in 2016 to optimize flash I/O patterns. This preference stems from F2FS's ability to handle out-of-place updates efficiently, reducing latency in scenarios common in mobile workloads. F2FS continues to be used in recent and s, enabling superior performance on high-speed UFS storage.

Linux Kernel and Distributions

F2FS was merged into the mainline with version 3.8, released in December 2012, enabling native support for the on compatible hardware. The accompanying user-space tools, including mkfs.f2fs for formatting and .f2fs for consistency checks, are provided by the f2fs-tools package, with initial releases dating back to around 2013. Major distributions offer varying levels of F2FS integration. provides full support through its kernel and f2fs-tools packages, allowing straightforward installation and use for root or data partitions. has included F2FS kernel support since version 8.0 (Jessie) in 2014, with f2fs-tools available in its repositories, though the installer lacks native F2FS partitioning options. Gentoo supports F2FS via kernel configuration and the sys-fs/f2fs-tools ebuild, enabling custom builds for flash-optimized setups. includes F2FS in its kernel and offers f2fs-tools via DNF, though the graphical installer requires terminal commands for creating F2FS partitions. In , F2FS is supported experimentally through manual configuration, as the installer does not natively handle it, requiring post-installation adjustments for root filesystems. On and systems, F2FS adoption has grown steadily for SSD and NVMe drives due to its optimizations for flash and performance, though and remain dominant for general-purpose use. It is particularly recommended for environments with heavy flash workloads, such as high-write databases or machines on NVMe arrays, where its log-structured reduces . Recent kernel updates have further enhanced F2FS suitability for modern . Linux 6.18, released in late 2025, introduced improvements including optimized lookup modes, node block readahead, and better inline data handling, benefiting NVMe deployments by reducing overhead in flash-intensive operations. Adoption has extended to embedded variants, such as user-modified images converted via scripts to leverage F2FS for extended SD card lifespan. F2FS configuration in environments relies on options to tailor behavior to hardware. The "discard" option enables commands for efficient garbage collection on SSDs and NVMe drives, issuing discards asynchronously during segment cleaning to maintain without manual intervention. For , the "compress_algorithm=" option activates transparent zstd-based file , configurable with levels for balancing speed and ratio in space-constrained setups.

Performance

Benchmarks and Comparisons

F2FS demonstrates superior random write performance on flash storage compared to , particularly in synthetic workloads. In IOzone tests on a system, F2FS achieved up to 3.1 times higher bandwidth for 4KB random writes by converting them into sequential writes through its log-structured design. On server systems with SSDs, F2FS outperformed by 2.5 times in the varmail benchmark, which involves small file operations with frequent fsync calls. Recent benchmarks on NVMe drives highlight F2FS's strengths in mobile and database workloads. Phoronix tests using 6.11 showed F2FS delivering the fastest results in database operations, making it suitable for small-file database tasks. In environments, F2FS reduced application launch times by 20% for the app and 40% for the app compared to , attributed to efficient handling of flash I/O patterns. Post-2023 enhancements, including 16K block size support in 6.7, further improved performance on modern devices with larger page sizes, enabling better alignment with hardware capabilities. Comparisons with other file systems underscore F2FS's optimizations for NAND flash. F2FS exhibits better than on NAND storage due to its low factor (around 1.02 at high utilization), reducing unnecessary erases and extending device lifespan. F2FS's simpler log-structured approach avoids the heavier metadata management of Btrfs's mechanism. In 2024 NVMe benchmarks on 6.10 and later, F2FS achieved performance parity with for sequential reads on PCIe SSDs, though edged ahead by about 20% in some high-throughput scenarios. F2FS excels in workloads involving small-file writes, such as database operations, where its adaptive combines small updates efficiently. However, foreground collection can introduce higher in write-intensive scenarios, as the prioritizes minimizing visible delays but may still impact latencies by up to several milliseconds under heavy load. In September 2025 benchmarks on 6.17, F2FS was among the fastest file systems for 4K random reads alongside and on NVMe SSDs.
BenchmarkWorkloadF2FS vs. EXT4Source
IOzone4KB Random Writes (Mobile)3.1× fasterFAST'15 Paper
VarmailSmall Files with fsync (SATA SSD)2.5× fasterFAST'15 Paper
Concurrent Database Writes (NVMe, Linux 6.11)Fastest among tested file systemsPhoronix
App LaunchFacebook/ (Android)20-40% fasterFAST'15 Paper

Limitations and Improvements

Despite its optimizations for flash storage, F2FS exhibits fragmentation issues in long-running mobile devices, primarily due to out-of-place updates that scatter file extents over time, leading to increased read amplification and performance degradation. This critical fragmentation is particularly pronounced in consumer scenarios with frequent small writes, such as app updates and media caching. Research in 2024 proposed a controller co-design approach to mitigate this by coordinating host and storage-level operations for proactive extent coalescing, reducing fragmentation by up to 70% in emulated mobile workloads. F2FS sees limited adoption on desktops compared to , owing to perceptions of lower maturity in handling diverse workloads and potential data integrity risks under heavy use. Unlike filesystems such as , F2FS lacks native support for 5 or 6 configurations, relying instead on underlying software like , which complicates setup for parity-based arrays. In scenarios involving sudden power failures, F2FS's checkpointing mechanism can result in slower recovery times than traditional journaling filesystems like , as it may require replaying extensive log segments to achieve consistency, potentially leading to partial data loss if operations fail. Known bugs in earlier versions include occasional garbage collection () stalls during high-load scenarios, where background cleaning operations block foreground I/O, causing spikes; these were addressed through performance optimizations in 6.18 and later. Recent improvements include the introduction of decentralized, epoch-based journaling in F2FS, presented at OSDI 2025, which enables finer-grained consistency guarantees by distributing journal entries across segments, reducing recovery overhead by 40-60% compared to prior checkpointing. Additionally, deduplication extensions via F2DFS, detailed in a 2024 ACM Transactions on Storage paper, integrate hybrid inline and offline deduplication, achieving up to 53% higher space savings on flash workloads without significant performance penalties. Future directions for F2FS emphasize enhanced support for , with ongoing updates improving zone-aware allocation to better handle ZNS SSDs and reduce . Inline deduplication is also a priority, building on recent hybrid schemes to enable duplicate detection during writes for consumer devices. Efforts continue to address critical fragmentation through advanced host- co-design, aiming for sustained performance in aging mobile environments.

References

  1. [1]
    Flash-Friendly File System (F2FS) - The Linux Kernel documentation
    F2FS is a file system exploiting NAND flash memory-based storage devices, which is based on Log-structured File System (LFS).
  2. [2]
    [PDF] F2FS: A New File System for Flash Storage - USENIX
    Feb 19, 2015 · F2FS is a Linux file system designed to perform well on modern flash storage devices. The file system builds on append-only logging and its key ...Missing: documentation | Show results with:documentation
  3. [3]
  4. [4]
    Samsung Introduces New Linux File-System: F2FS - Phoronix
    Oct 5, 2012 · F2FS in its current form weighs in at 16 patches from Samsung's Jaegeuk Kim that add around thirteen thousand lines of new code to the Linux ...Missing: initial | Show results with:initial
  5. [5]
  6. [6]
    Linux 3.8 Kernel Officially Released - Phoronix
    Feb 18, 2013 · The Linux 3.8 kernel was released on Monday afternoon by Linus Torvalds. This is a very exciting kernel update. Since the release of Linux 3.7 ...
  7. [7]
    [GIT PULL] f2fs updates for v3.14 - The Linux-Kernel Archive
    Jan 22, 2014 · This patch-set includes the following major enhancement patches. o support inline_data o refactor bio operations such as merge operations and rw ...[RFC 0/5] Enable f2fs support inline data - The Linux-Kernel ArchiveRe: [PATCH v3] f2fs: fix to reserve space for IO align featureMore results from lkml.indiana.edu
  8. [8]
    F2FS Brings Per-File Encryption With Linux 4.2 - Phoronix
    Jun 24, 2015 · F2FS has been working on native encryption support in tandem with the EXT4 work and now it's been called for merging today into Linux 4.2.Missing: fscrypt | Show results with:fscrypt
  9. [9]
    F2FS Data Compression Using LZO/LZ4 + Selective File Extension ...
    Dec 23, 2019 · Linux 5.6 is set to bring F2FS data compression! The implementation is similar to Btrfs' transparent/native file compression plus having some extra features.
  10. [10]
    F2FS File-System Adding Zstd Compression Support In Linux 5.7
    Mar 23, 2020 · Being introduced by Linux 5.6 is optional F2FS transparent data compression support that was implemented with LZO and LZ4.
  11. [11]
    F2FS In Linux 6.7 Supports Larger Page Size, Continued ... - Phoronix
    Nov 5, 2023 · F2FS can now support cases where the block size is the page size for both 4K and 16K block sizes. Other sizes should work as well according to ...
  12. [12]
  13. [13]
    F2FS Lands Performance Improvements In Linux 6.18 - Phoronix
    Oct 4, 2025 · F2FS in Linux 6.18 also boosts performance via pre-fetching node blocks, more efficient merging of FUA writes, and optimizing block allocation ...
  14. [14]
    [PATCH v2 3/3] f2fs-tools: support project quota - Google Groups
    From: Chao Yu <yuc...@huawei.com> This patch introduce a new option 'project_quota' for enabling project quota functionality during mkfs.
  15. [15]
    Add 16K Support for f2fs - LWN.net
    Aug 15, 2023 · Add 16K Support for f2fs ; To: linux-f2fs-devel-AT-lists.sourceforge.net ; Subject: [PATCH 0/1] Add 16K Support for f2fs ; Date: Tue, 15 Aug 2023 ...
  16. [16]
    F2FS File System - Zoned Storage
    f2fs supports various parameters not only for configuring on-disk layout but also for selecting allocation and cleaning algorithms.
  17. [17]
  18. [18]
    f2fs: support data compression - LWN.net
    Dec 16, 2019 · This patch tries to support compression in f2fs. - New term named cluster is defined as basic unit of compression, file can be divided into ...
  19. [19]
  20. [20]
    config_f2fs_fs_encryption - kernelconfig.io
    In linux kernel since version 4.1 (release Date: 2015-06-21). Enable encryption of f2fs files and directories. This feature is similar to ecryptfs, but it is ...
  21. [21]
  22. [22]
    fs-verity: read-only file-based authenticity protection
    fs-verity ( fs/verity/ ) is a support layer that filesystems can hook into to support transparent integrity and authenticity protection of read-only files.User Api · Fs_ioc_enable_verity · Filesystem Support
  23. [23]
    linux-kernel - [PATCH v2 1/2] f2fs: include charset encoding ...
    Jul 17, 2019 · ... f2fs: include charset encoding information in the superblock Add charset encoding to f2fs to support casefolding. It is modeled after the ...<|separator|>
  24. [24]
    f2fs: support revoking atomic written pages - linux-rng
    Feb 6, 2016 · f2fs support atomic write with following semantics: 1. open db file 2. ioctl start atomic write 3. (write db file) * n 4. ioctl commit ...
  25. [25]
    F2FS File-System Gaining Multiple Device Support - Phoronix
    Nov 9, 2016 · The F2FS support allows for a single file-system to span multiple storage devices natively without using LVM or the like. Jaegeuk Kim explained, ...
  26. [26]
    [PDF] Remote Wiping in Android - ResearchGate
    Jun 1, 2015 · Moto G uses F2FS file system for userdata partition. F2FS was released back in February 2013. (Larabel 2013; Kim 2012; Lee et al. 2015). F2FS ...
  27. [27]
    Galaxy Note 10 uses F2FS, not EXT4 file system - SamMobile
    Aug 12, 2019 · The Galaxy Note 10 uses F2FS fyle system instead of EXT4. It can contribute to better performance but can we expect this from other models?Missing: prototypes testing
  28. [28]
    Nexus 9 Notes - Android Internals
    Dec 5, 2014 · Mounted File Systems. The /data/ filesystem is mounted with F2FS, which is all the rage in the world of Android nowadays. The mounting is over ...
  29. [29]
    [Update: Code commit] The Pixel 3 uses Samsung's super-fast F2FS ...
    Oct 10, 2018 · All the way back in 2012, Samsung created a new file system purpose-built for flash-based storage, called 'F2FS'. It's typically faster on ...
  30. [30]
    File-based encryption - Android Open Source Project
    Oct 9, 2025 · This article describes how to enable file-based encryption on new devices and how system apps can use the Direct Boot APIs to offer users the ...
  31. [31]
    More about OnePlus 3T's "Improved File System" and how to get it ...
    With OP3T launch, OnePlus did minor improvements to the already rock solid OP3. One of them is the introduction of F2FS file system.
  32. [32]
    ZTE to Launch the World's First Qualcomm® Snapdragon™ 855 ...
    Apr 23, 2019 · Backed up with F2FS file system, ZTE Axon 10 Pro adopts the intelligent anti-fragmentation mechanism to effectively solve the freezing ...
  33. [33]
    Yu (Lenny) Liang
    Today, F2FS is the de facto standard file system for mobile devices, powering billions of devices worldwide. A F2FS TRIM optimization patch, 'f2fs: relax ...
  34. [34]
    [PDF] Samsung Electronics Co., Ltd. Samsung Galaxy Devices on Android ...
    Jul 1, 2025 · This is implemented as part of the ext4 or f2fs file system (using fscrypt). Firmware Over-the-air. (FOTA). Firmware Over-the-air is a term ...
  35. [35]
    Samsung is now a contributor to Google's Fuchsia OS - 9to5Google
    May 12, 2021 · ... devices. You can find F2FS being used in Samsung's phones since the Galaxy Note 10, Google phones since the Pixel 3, and many more Android ...
  36. [36]
    F2FS File-System Merged Into Linux 3.8 Kernel - Phoronix
    Dec 22, 2012 · One of the merges not yet talked about for the Linux 3.8 kernel was the mainlining of the F2FS file-system for flash devices.Missing: history Jaegeuk Kim
  37. [37]
    f2fs tools download | SourceForge.net
    Rating 5.0 (2) · FreeMay 29, 2013 · Download f2fs tools for free. Tools for Flash-Friendly File System (F2FS) ** Important Notice ** The f2fs-tools is no longer maintained ...
  38. [38]
    F2FS - ArchWiki
    May 13, 2025 · Support inline data in regular/symlink inode via inline_data mount option. 3.14, 1.3.0, 1001b3479ce9 ("f2fs: add flags and helpers to support ...Known issues · Long running fsck delays boot
  39. [39]
    F2FS - Debian Wiki
    Apr 9, 2024 · F2FS is a file system for GNU Linux optimized for Flash storage. It was originally introduced in kernel v3.8, on 2012-12-20.
  40. [40]
    F2FS - Gentoo Wiki
    Mar 11, 2025 · F2FS (Flash-Friendly File System) is a filesystem designed for NAND flash-based devices. It is available in Linux kernels 3.8.x and higher.
  41. [41]
    Why fedora workstation and silverblue does not have f2fs installed ...
    Dec 15, 2022 · F2FS is not installed by default because it's not very popular and not needed by most users, but it is easily installed via DNF.
  42. [42]
    Can (and how do) you install Ubuntu in F2FS filesystem?
    Feb 19, 2013 · So far you can create an F2FS partition with the above-mentioned tools. On a single partition 32GB or more SSD located at /dev/sda: mkfs.f2fs -l ...How to install F2FS mounting capability on Ubuntu 22.04?How To Make Use Of F2FS? - Ask UbuntuMore results from askubuntu.comMissing: experimental | Show results with:experimental
  43. [43]
  44. [44]
    [PDF] Understanding and Profiling NVMe-over-TCP Using ntprof - USENIX
    Apr 30, 2025 · F2FS performs exceptionally well with NVMe SSDs, as it efficiently handles the inherent characteristics of flash memory, such as wear ...
  45. [45]
    raspios-f2fs - Flash Friendly Filesystem(f2fs) for the Raspberry Pi OS
    This script converts the partition of Raspbian OS to F2FS and then can be flashed it to an TF card or USB flash drive.Missing: adoption | Show results with:adoption
  46. [46]
    F2FS With Linux 5.12 Lets You Configure The Zstd/LZ4 ... - Phoronix
    Feb 18, 2021 · When mounting a F2FS file-system with the "compress_algorithm" mount option, ":level" can be appended to the option where "level" is the ...
  47. [47]
    An Initial Benchmark Of Bcachefs vs. Btrfs vs. EXT4 vs. F2FS vs. XFS ...
    Aug 9, 2024 · A fresh round of benchmarking across Bcachefs, Btrfs, EXT4, F2FS, and XFS using the Linux 6.11-rc2 kernel.
  48. [48]
    An f2fs teardown - LWN.net
    Oct 12, 2012 · I believe btrfs has improved significantly in this area, but its design means that it won't be as good as f2fs on the media that f2fs optimizes ...
  49. [49]
    Eliminate Critical Fragmentation of F2FS in Mobile Devices with ...
    This paper presents a controller-coordinated approach aimed at mitigating the problem of critical file fragmentation within the F2FS file system on mobile ...Missing: limitations | Show results with:limitations
  50. [50]
    The Journey of F2FS and why File Systems Matter - XDA Developers
    Apr 6, 2018 · A: F2FS is an open source file system, with the main pitch that it is designed for flash storage architecture. NAND storage (flash) is used in ...
  51. [51]
    Linux RAID Performance On NVMe M.2 SSDs With EXT4, Btrfs, F2FS
    Sep 16, 2017 · This is our first time running some Linux RAID benchmarks of NVMe M.2 SSDs and for this comparison were tests of EXT4 and F2FS with MDADM soft RAID as well as ...
  52. [52]
    [PDF] Decentralized, Epoch-based F2FS Journaling with Fine-grained ...
    Jul 7, 2025 · We have implemented a fully functional prototype of F2FSJ and conducted extensive experiments. Our experimental re- sults demonstrate that F2FSJ ...
  53. [53]
    Design and Implementation of Deduplication on F2FS
    In this article, we propose F2DFS (deduplication-based F2FS), which introduces three main design contributions. First, F2DFS integrates inline and offline ...
  54. [54]
    F2FS Improves Zoned Block Device Support & Per-File ... - Phoronix
    Mar 18, 2024 · In this round, there are a number of updates on mainly two areas: Zoned block device support and Per-file compression. For example, we've found ...