Difference between revisions of "F2FS"

From ArchWiki
Jump to: navigation, search
(flagged broken section links (interactive))
(Tag: wiki-scripts)
(Fixed link to install guide section)
Line 46: Line 46:
 
# Create the root partition as F2FS as described in section [[#Creating a F2FS partition]].
 
# Create the root partition as F2FS as described in section [[#Creating a F2FS partition]].
 
# If your [[bootloader]] does not support F2FS, create a separate {{ic|/boot}} partition using a filesystem that it does.
 
# If your [[bootloader]] does not support F2FS, create a separate {{ic|/boot}} partition using a filesystem that it does.
# Continue with the installation procedure as per [[Installation guide#Mount the partitions]]{{Broken section link}} until [[Change root|chrooted]].
+
# Continue with the installation procedure in the Installation Guide as per [[Installation guide#Mount the file systems|#Mount the file systems]] until [[Change root|chrooted]].
 
# Install {{Pkg|f2fs-tools}} on the newly installed system as well.
 
# Install {{Pkg|f2fs-tools}} on the newly installed system as well.
 
# Regenerate the [[initramfs]] while chrooted.
 
# Regenerate the [[initramfs]] while chrooted.

Revision as of 21:27, 25 September 2017

F2FS (Flash-Friendly File System) is a file system intended for NAND-based flash memory equipped with Flash Transition Layer. Unlike JFFS or UBIFS it relies on FTL to handle write distribution. It is supported from kernel 3.8 onwards.

Creating a F2FS partition

In order to create a F2FS partition, install f2fs-tools from the official repositories.

Create the partition:

# mkfs.f2fs -l mylabel /dev/sdxY

where /dev/sdxY is the target volume to format in F2FS.

Mounting a F2FS partition

The partition can then be mounted manually or via other mechanisms:

# mount /dev/sdxY /mnt/foo

Grow an F2FS partition

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. This can be done, for example, by deleting the old partition and creating a new one with with the same type, the same start sector, and a new end position.

Then expand the filesystem to fill the new partition using:

# resize.f2fs /dev/sdxY

where /dev/sdxY is the target F2FS volume to grow.

Note: If you're using GPT, the partition's GUID (seen in /dev/disk/by-partuuid/*) might change, but the filesystem UUID (seen in /dev/disk/by-uuid) should stay the same.

Install Arch Linux on F2FS partition

Warning: If using GRUB your freshly installed system might not boot after reboot. As GRUB doesn't support F2FS it isn't able to extract the UUID (which is persistent across reboots) of your drive so it uses classic /dev/sdXx names instead (which are not guaranteed to be persistent across reboots). In this case you might have to manually edit /boot/grub/grub.cfg and replace root=/dev/sdXx with root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx; you can use the blkid command to get the UUID of your device.

With the latest installation media it is possible to install Arch linux with root located on a F2FS filesystem:

  1. Create the root partition as F2FS as described in section #Creating a F2FS partition.
  2. If your bootloader does not support F2FS, create a separate /boot partition using a filesystem that it does.
  3. Continue with the installation procedure in the Installation Guide as per #Mount the file systems until chrooted.
  4. Install f2fs-tools on the newly installed system as well.
  5. Regenerate the initramfs while chrooted.

Be sure to also check out the Installing Arch Linux on a USB key page if you're installing Arch on a USB flash drive. (In particular the part about editing /etc/mkinitcpio.conf is important, otherwise your system won't boot.)

Checking and repair

Checking and repairs to f2fs partitions are accomplished with fsck.f2fs provided by f2fs-tools. See the manpage for available switches.