F2FS

From Gentoo Wiki
Jump to:navigation Jump to:search
This page contains changes which are not marked for translation.

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. This filesystem is a good choice when installing Gentoo on an eMMC, SSD, SDCard, or a flash-based USB device.

Note
F2FS is very useful for "dumb" flash storage (like a usb thumbdrive). Modern SSDs might be better off with ext4 or xfs. See the debate here.

Installation

Kernel

KERNEL Enabling basic F2FS filesystem options
File systems  --->
   <*> F2FS filesystem support
   [ ]   F2FS Status Information
   [*]   F2FS extended attributes
   [*]     F2FS Access Control Lists
   [*]     F2FS Security Labels
   [ ]   F2FS consistency checking feature
   [ ]   F2FS fault injection facility
   [*]   F2FS compression feature
   [*]     LZO compression support
   [*]       LZO-RLE compression support
   [*]     LZ4 compression support
   [*]       LZ4HC compression support
   [*]     ZSTD compression support
   [*]   F2FS IO statistics information
   [ ]   F2FS unfair rw_semaphore

When enabling support to the filesystem in the Linux kernel, it is wise to enable at least "F2FS extended attributes" (F2FS_FS_XATTR) with "F2FS Access Control Lists" (CONFIG_F2FS_FS_POSIX_ACL) and "F2FS Security Labels" (CONFIG_F2FS_FS_SECURITY) suboptions.

"F2FS consistency checking feature" (CONFIG_F2FS_CHECK_FS) option in the list will enable F2FS's filesystem consistency checking. The checking will occur during run time and will decrease the filesystem's performance. This option provides an advantage when consistency is more important than speed.

Emerge

Install the userspace tools for the F2FS filesystem:

root #emerge --ask sys-fs/f2fs-tools

Usage

Creation

After emerging the userspace tools, create a filesystem by running the mkfs.f2fs command followed by the appropriate device and partition number:

Warning
In this example, the device /dev/sdd is used, and it's final target (the partition to format with F2FS) is 1 (so, /dev/sdd1). This is unlikely to be the same device once it's connected on the computer (/dev/sdd1), being aware that formatting the wrong device will destroy all the data within is very important ! Users has to be sure to target the proper partition on the proper device.
root #mkfs.f2fs /dev/sdd1

Filesystem check

root #fsck.f2fs /dev/sdd1

Defragmentation

root #defrag.f2fs

See also

  • Ext4 — an open source disk filesystem and most recent version of the extended series of filesystems.
  • Btrfs — a copy-on-write (CoW) filesystem for Linux aimed at implementing advanced features while focusing on fault tolerance, self-healing properties, and easy administration.
  • SquashFS — an open source, read only, extremely compressible filesystem.

External resources