F2FS
F2FS (Flash-Friendly File System) is a file system intended for NAND-based flash memory equipped with Flash Translation Layer. Unlike JFFS or UBIFS it relies on FTL to handle write distribution. It is supported from kernel 3.8 onwards.
An FTL is found in all flash memory with a SCSI/SATA/PCIe/NVMe interface [1], opposed to bare NAND Flash and SmartMediaCards [2].
Contents
Creating a F2FS file system
In order to create a F2FS file system, install f2fs-tools.
Create the file system:
# mkfs.f2fs -l mylabel /dev/sdxY
where /dev/sdxY
is the target volume to format in F2FS. See mkfs.f2fs(8) for all available options.
Mounting a F2FS file system
The file system can then be mounted manually or via other mechanisms:
# mount /dev/sdxY /mnt/foo
Grow an F2FS file system
When the filesystem is unmounted, it can be grown if the partition is expanded. Shrinking is not currently supported.
First use a partition tool to resize the partition: for example, suppose the output of the print
command in the parted
console for your disk is the following:
Number Start End Size File system Name Flag 1 1049kB 106MB 105MB fat32 EFI system partition boot, esp 2 106MB 11,0GB 10,9GB ext4 3 11,0GB 12,3GB 1322MB f2fs 4 31,0GB 31,3GB 261MB ext4
To resize the f2fs
partition to occupy all the space up to the fourth one, just give resizepart 3 31GB
and exit
. You can now expand the filesystem to fill the new partition using:
# resize.f2fs /dev/sdxY
where /dev/sdxY
is the target F2FS volume to grow. See resize.f2fs(8) for supported options.
/dev/disk/by-partuuid/
) might change, but the filesystem UUID (seen in /dev/disk/by-uuid/
) should stay the same.Checking and repair
Checking and repairs to f2fs file systems are accomplished with fsck.f2fs
provided by f2fs-tools. See fsck.f2fs(8) for available switches.
Known issues
Long running fsck delays boot
If the kernel version has changed between boots, the fsck.f2fs utility will perform a full file system check which will take longer to finish.[3]
Troubleshooting
GRUB with root on F2FS
Support for the F2FS filesystem has been added in the not yet released GRUB version 2.03. For now you need to install the boot loader to a separate /boot
partition, formatted with a compatible file system. See GRUB#F2FS and other unsupported file systems.