Install Debian 12 on an F2FS Partition — The "Copy Method"

This guide shows the steps to install Debian onto an F2FS root file system by installing Debian onto an ext4 root partition first and then re-formatting the partition from ext4 to F2FS. The guide was updated for Debian 12 (Bookworm).

F2FS stands for Flash-Friendly File System. As the name suggests, F2FS is designed for flash-based storage, such as SD cards, eMMC modules, and flash drives. F2FS will achieve better performance and extend the lifetime of flash-based storage in many cases compared to other traditional file systems, such as ext4 or XFS. The F2FS format is especially useful on single-board devices (like Raspberry Pi, RockPro64, etc.) that boot from an SD card or an eMMC module. Many Android devices use F2FS too.

This is an updated version of my old guide that I created many years ago when Debian installation media didn't include any F2FS tools. This guide first installs Debian onto an ext4 partition, and then it backs up all system files, erases and formats the partition to F2FS, and then restores the system files. Hence I call this method the "Copy Method". This method can also be used to convert a prebuilt Debian operating system image (e.g., an image provided for an ARM board) to use F2FS.

Recent Debian releases (Debian 11 and newer) can create the F2FS file system directly from the installer with only a few extra manual commands that I described in my new guide linked below.

A simpler guide that installs Debian on F2FS directly from the installer: Debian F2FS — Installer Method

May 7, 2023
Previous versions
Install Debian 10 (Buster) on an F2FS Partition
Install Debian 8 (Jessie) on an F2FS Partition

The Idea

The Debian installer still doesn't offer an option to format disk partitions with F2FS during installation. This guide attempts to overcome the installer's limitation by installing Debian using the following steps:

  1. Install Debian on a supported file system, such as ext4.
  2. Prepare the installed Debian system so that it can boot from F2FS.
  3. Back up all files from the root partition.
  4. Erase and format the root partition with F2FS.
  5. Restore the files to the root partition.


Following the steps described in this guide leads to a bootable Debian 12 (Bookworm) system on my x86_64 and AArch64 UEFI-based systems. Many of the commands mentioned in this document are specific to a particular system configuration and cannot be simply copy-pasted (e.g., your disk drive letters will be different). Incorrect usage of the commands can lead to data loss. I am not responsible for any data loss that occurs as a consequence of incorrect usage of any information provided in this guide.

Unless you have a good reason to use F2FS, I recommend using file systems offered by the Debian installer. The method used in this guide is not official.


I suppose that you are already familiar with the process of creating a Debian installation media, hard drive partitioning, and installing Debian. To install Debian on F2FS-formatted storage, prepare the following:

This is a computer on which we want to install Debian. I tested this guide on x86_64 (AMD64) and AArch64 (ARM64) UEFI-based machines.
System storage device
This is a drive that PC1 uses as its system drive. In my case, it is a USB flash drive. We want to format this drive with F2FS and install Debian on it.
Debian installation medium
I used a Debian 12 (Bookworm) netinst ISO written to a USB stick.
This is another up-to-date Linux PC, preferably using the same version of Debian as the Debian installation medium. Alternatively, instead of using a dedicated computer, one may boot PC1 from a live Linux medium.
Backup storage device
A backup drive with at least the same capacity as the installed size of Debian. I recommend using a drive that has at least 10 GB of free space and is formatted with ext4. PC2's storage can be used for this purpose as well.

The aforementioned terminology will be used throughout this document.

Step 1: Install Debian

This step boots PC1 from the Debian installation medium.

A screenshot of the boot screen of the Debian installer.

Boot the computer PC1 from the Debian installation medium and install Debian onto the system storage device.


I followed the "Guided partitioning", "Guided - use entire disk", "All files in one partition" options. The following partition layout was proposed by the installer:

  1. ESP (EFI system partition)
  2. / (ext4)
  3. swap

I recommend having /boot on a separate partition because F2FS may not be fully supported by the GRUB bootloader. The GRUB version in Debian 12 should have support for F2FS, but according to ArchWiki, GRUB doesn't support F2FS that uses extra attributes. I allocated 512 MB for the /boot partition. The installer creates a separate 512MB ext2 /boot partition automatically if the LVM automatic partitioning option is selected. I don't use LVM, but I create a similar boot partition manually.

Note that the ESP partition may be missing on systems that don't use UEFI. I modified the partition proposal by replacing the root (/) partition with two partitions, /boot and /. The partition layout then looked like this:

  1. ESP (EFI system partition)
  2. /boot (ext4) 512MB
  3. / (ext4) the remaining capacity — This is where I would select F2FS if the installer allowed me to.
  4. swap

Here is a screenshot of the partition table that I used:

A screenshot of the Debian installer showing the configured storage partitions.

The installer doesn't support F2FS, unfortunately.

A screenshot of the Debian installer showing the available file system formats.

Select a Network Mirror

When using a DVD version of the Debian installer, if the installer asks me whether I want to "Use a network mirror", I select Yes. The installer then sets up access to remote package repositories and installs packages from there. Otherwise, APT sources are configured to use the DVD as the only package repository.

Minimal Package Selection

When prompted which collections of software to install, select only the "standard system utilities" and leave other package groups unchecked. This is to keep the size of the installed system to a minimum for now. We can install those additional package collections later by running the tasksel command on the installed system. The "standard system utilities" option is shown only during installation, so we select it now.

A screenshot of the package selction (tasksel) during the installation.

Step 2: Enable F2FS Support

This step boots PC1 from its system storage device that now contains the installed minimal Debian system.

Once the installation is finished, reboot PC1 into the newly-installed Debian system. Next, we want to prepare the installed Debian system so that it can boot from F2FS.

Install Additional Packages

I recommend installing the latest updates, if available. I made sure that the cdrom line in /etc/apt/sources.list was commented-out before running these commands.

[PC1]$ sudo apt update
[PC1]$ sudo apt full-upgrade

Next, install the f2fs-tools package which provides tools for manipulating the F2FS file system format.

[PC1]$ sudo apt update
[PC1]$ sudo apt install f2fs-tools

Add Modules to initramfs

Great news! It is no longer necessary to manually add the f2fs and crc32 kernel modules to initramfs. In Debian 12 (Bookworm), the default initramfs already contains these modules. For older Debian releases, see the links to the older versions of this guide at the top of this document to get a list of the needed kernel modules and instructions on how to install them into the initramfs image.

You can verify that the initramfs image (your version number may differ) contains the f2fs module:

[PC1]$ lsinitramfs /boot/initrd.img-6.1.0-7-amd64 | fgrep f2fs

The output will look like this if the f2fs module is present:


Identify Partitions

The lsblk command lists partitions and their mount points. This information will be useful when mounting the partitions on PC2 later. The drive name may change, but the partition order should remain the same. In the case of my USB system storage drive, the partitions are:

Write down the findings. I see that my root partition is located after the swap partition in the partition table, even though it is physically before it. This is probably because it was created later.

Shut Down PC1

The system is configured, and we collected all the information that we needed. Shut down PC1:

[PC1]$ sudo systemctl poweroff

Step 3: Format with F2FS

This step uses the computer PC2 to back up files from the system storage device and create the F2FS file system.

Now we have a Debian system installed on an ext4-formatted root partition and prepared to mount F2FS partitions on boot. The next step is to back up all files from the root partition of the system storage device (while preserving all permissions and file attributes), format the partition to F2FS, and then restore the files. Some information can also be found in my old Raspbian installation guide, where I used the F2FS file system too.

In this step, use another computer, PC2. Alternatively, it is possible to boot from a live Linux medium on PC1 and perform the operations from the live environment. Because Debian doesn't provide live media for architectures other than x86_64, I decided to use a separate computer instead.

F2FS had some issues with compatibility between different Linux kernel versions in the past. I suggest using the same version of Debian on PC2 as the one we are installing on PC1 to avoid any potential compatibility issues. But using a different Linux distribution on PC2 should probably be fine.

Do not copy-paste the provided commands! Your device names and partition numbers will differ!

Connect PC1's System Drive to PC2

Remove the system storage device from the computer PC1 and connect it to the computer PC2. The drive will show up as a new device. I use a /dev/aaa device name in this section to avoid accidental copy-paste mistakes.

Install F2FS Utilities

To be able to format a partition with F2FS, the F2FS tools need to be installed on the second computer (PC2).

[PC2]$ sudo apt update
[PC2]$ sudo apt install f2fs-tools

Prepare and Mount a Backup Drive

Prepare your backup storage device with sufficient capacity to hold data from the partition that we are going to format with F2FS. I recommend using the ext4 file system on the backup drive so that all file attributes are properly copied over.

Connect the backup storage device to the computer PC2 and mount it, for example, into a /mnt/backup directory. You can also use the internal storage of PC2 instead of a separate device.

Create a new directory on the mounted backup storage device. I named the folder root. The contents of the whole root partition of the system storage device will later be copied into this folder.

[PC2]$ sudo mkdir /mnt/backup/root

Locate the Partition That Will Be Converted to F2FS

Using lsblk, fdisk, or other tools, locate the partition on the system storage device that you want to convert to F2FS. We are looking for the root partition of the system storage device where we installed the minimal Debian system. I use the /dev/aaa name for the device in this section. Make sure that the partition information matches your previous findings. The partition information can be found with the following commands:

[PC2]$ lsblk --fs
[PC2]$ sudo fdisk -l /dev/aaa

My system storage device contains these partitions:

Backup the Partition Content

Now, we can finally begin converting the partition from ext4 to F2FS. Mount the partition that you want to format with F2FS (it currently contains an ext4 file system) to a newly created /mnt/root directory.

[PC2]$ sudo mkdir /mnt/root
[PC2]$ sudo mount /dev/aaa4 /mnt/root/

Copy all files from the partition to our prepared directory on the backup storage device. Make sure to copy all files and preserve all file attributes. Notice that there is a dot at the end of /mnt/root/., as it will help include any hidden files in the source directory and the permissions of the directory itself:

[PC2]$ sudo cp -a /mnt/root/. /mnt/backup/root/

Format the Partition with F2FS

This step will erase the content of the partition. First, unmount the partition.

[PC2]$ sudo umount /mnt/root

Optionally, invalidate the previous file system by choosing one of the commands below.

[PC2]$ sudo dd if=/dev/zero of=/dev/aaa4 bs=1M count=100
[PC2]$ sudo wipefs -a /dev/aaa4
[PC2]$ sudo blkdiscard -v /dev/aaa4

Finally, format the partition with an F2FS file system. If a previous file system is detected, a -f parameter needs to be passed to the command. I also noticed that the mkfs.f2fs program automatically issues a discard (TRIM) operation on the partition.

[PC2]$ sudo mkfs.f2fs /dev/aaa4

Restore the Partition Content

Now mount the partition again and copy all previously backed-up files back on it.

[PC2]$ sudo mount /dev/aaa4 /mnt/root/
[PC2]$ sudo cp -a /mnt/backup/root/. /mnt/root/

Update fstab

The installed system will need to know that the partition file system changed from ext4 to F2FS. As a reminder, my device and partition numbers, as well as UUIDs, will differ from yours.

By default, partitions are identified by their UUIDs in the fstab file. Formatting the root partition to F2FS changed the UUID of the partition. The blkid command can identify the UUID of the partition:

[PC2]$ sudo blkid /dev/aaa4

In my case, the new UUID of the F2FS partition is d8e59df1-b8c4-4862-9017-1f66e6e6a7dc. Yours will be different.

Modify the fstab file:

[PC2]$ sudo nano /mnt/root/etc/fstab

Perform the following changes to the entry that corresponds to the root (/) partition that we formatted to F2FS:

This is the original line for the / mount point in my fstab file:

UUID=de5ef06e-afc7-425c-849d-4fbb272d7d4b /               ext4    errors=remount-ro 0       1

In my case, I changed the line to look like this:

UUID=d8e59df1-b8c4-4862-9017-1f66e6e6a7dc /               f2fs    defaults 0       1

Update GRUB Configuration

If you followed my earlier advice and created a separate partition for /boot during the Debian installation, the GRUB bootloader configuration is located on the boot partition instead of the root partition. In my case, the boot partition is the second partition on the /dev/aaa drive. Mount the boot partition.

[PC2]$ sudo mkdir /mnt/boot
[PC2]$ sudo mount /dev/aaa2 /mnt/boot

Next, update the GRUB configuration. Replace the old UUID with the new UUID in the /mnt/boot/grub/grub.cfg file. Don't forget to use the correct UUIDs in the command below.

[PC2]$ sudo sed -i 's/de5ef06e-afc7-425c-849d-4fbb272d7d4b/d8e59df1-b8c4-4862-9017-1f66e6e6a7dc/g' /mnt/boot/grub/grub.cfg

Unmount the Partitions

Unmount the system storage device from PC2 so that we can connect it back to PC1.

[PC2]$ sudo umount /mnt/boot
[PC2]$ sudo umount /mnt/root

Step 4: Finalize the Installation

This step boots PC1 from the system storage device.

Connect the system storage device back to the computer PC1. Boot PC1 from the device. Verify that the root partition shows as having an F2FS file system:

[PC1]$ lsblk --fs

It may be a good idea to ensure that the GRUB configuration is consistent by refreshing the GRUB configuration and rebooting:

[PC1]$ sudo update-grub2
[PC1]$ sudo reboot

When the installed system successfully boots on PC1, you can celebrate by installing the remaining package groups that we left unselected during installation:

[PC1]$ sudo tasksel
A screenshot of the package selction (tasksel) after the installation.

We are done. It is time for a final reboot into the fully installed Debian system.

[PC1]$ sudo reboot

The Result

You can now show your friends that your Debian runs from F2FS!

A screenshot of the System Monitor app window showing that the file system type is F2FS.