F2FS

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page F2FS and the translation is 60% complete.
Outdated translations are marked like this.
Other languages:

F2FS (Flash-Friendly File System) 是一个为基于 NAND 闪存设备设计的文件系统。 它可在 Linux 内核 3.8.x 以及更高版本使用。当在 eMMC, SSD, NVMe, SDCard, 或者基于闪存的 USB 设备安装 Gentoo时,此文件系统是一个好的选择。

附注
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.

安装

内核

内核 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

使用

创建

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

警告
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

检查文件系统

root #fsck.f2fs /dev/sdd1

碎片整理

root #defrag.f2fs

参考

  • Ext4 — 一个开源的磁盘文件系统并且是扩展系列文件系统的最新版本。
  • Btrfs — 一个写入时复制(CoW) 的 Linux 文件系统 ,旨在实现高级功能的同时专注于容错、修复和易于管理等功能。
  • SquashFS — an open source, read only, extremely compressible filesystem.

外部资源