Results 1 to 2 of 2

Thread: RFC: f2fs root procedure

  1. #1
    Join Date
    Aug 2021
    Beans
    7

    Post RFC: f2fs root procedure

    I finally got around to trying this on impish after setting up a number of other distributions with f2fs root filesystems.

    The goal is to come up with something that would be appropriate to run in the datacenter for modern deployment types (i.e., high density VMs with shared backing storage) and maybe also on a PineBook Pro in case they ever get stock back in.

    Here is the procedure I used to convert an impish system today. If anyone has feedback on how to improve it or questions on the rationale for any of the steps, I am interested!



    Operating Environment: 20GB VirtualBox VM with 4GB RAM

    Since this is just for a bootstrap root filesystem, the idea is to minimize the storage utilization (and wear on the Samsung FIT USB flash I was using for testing) That is the reason for ext2 instead of ext4 for the /boot and / filesystems on the bootstrap system - ext2 doesn't have a journal to constantly write to. Unfortunately, I didn't notice a way to disable the creation of a swap file in the installer.

    Once getting into the installer -

    Minimal install (don't download updates or install third party software)

    Installation type:
    Something else

    New Partition Table > Continue
    + 1 MB Primary, beginning of this space, Reserved as BIOS boot area
    + 512 MB Primary, beginning of this space, ext2 Mount Point: /boot
    + 250 MB Primary, beginning of this space, EFI System Partition
    + 8000 MB Logical, end of this space, ext2 Mount Point: /

    Install Now, Continue

    Follow the usual steps to pick a timezone and create a user

    Once the installation finished, reboot and log into the new system

    Next, install the tools to set up the f2fs filesystem/partition and run gparted -

    Code:
    $ sudo apt install f2fs-tools gparted
    $ sudo gparted /dev/sdX
    In the gparted GUI -

    Click on the free space, create as primary partition,
    Partition name /, format as f2fs, label root, Add

    To write it to disk, click the green check to apply pending operations

    make a note of the partition device /dev/sdX5 and exit gparted

    Next, deal with the default swapfile to avoid syncing it (also because swap on disk doesn't fit my use cases) -

    Code:
    $ sudo swapoff /swapfile
    $ sudoedit /etc/fstab (delete the swapfile line and save)
    $ sudo rm /swapfile
    Arrange for the modules to be loaded into initramfs before copying to the target f2fs filesystem so both sides will have it -

    Code:
    $ sudoedit /etc/initramfs-tools/modules
    add the following -

    Code:
    f2fs
    fscrypto
    crc32-pclmul
    crc32c_generic
    crc32c-intel
    crc32_generic
    libcrc32c
    Mount it up and start the sync -

    Code:
    $ sudo mkdir /f2fsroot
    $ sudo mount /dev/sdX5 /f2fsroot
    $ sudo rsync -HPXax / /f2fsroot/
    Once the sync has completed, prepare for chroot -

    Code:
    $ sudo mount --bind /dev /f2fsroot/dev
    $ sudo mount --bind /sys /f2fsroot/sys
    $ sudo mount --bind /proc /f2fsroot/proc
    $ sudo mount --bind /run /f2fsroot/proc
    $ sudo mount --bind /boot /f2fsroot/boot
    $ sudo mount --bind /boot/efi /f2fsroot/boot/efi
    $ sudo blkid | grep f2fs
    copy the UUID value into the terminal buffer

    Set up fstab on the target partition -

    Code:
    $ sudoedit /f2fsroot/etc/fstab
    ^ change ext2 to f2fs and 'errors=remount-ro' to 'noatime' and UUID= to the UUID for the f2fs filesystem from blkid. (noatime stops an additional category of constant writes which are unneeded for my use cases)

    Access the chroot environment to update its initramfs and get it set up in grub -

    Code:
    $ sudo chroot /f2fsroot
    $ update-initramfs -u
    $ update-grub2
    $ exit (from chroot)
    Cleanly unmount the target system's mounts -

    Code:
    $ sudo umount /f2fsroot/boot/efi
    $ sudo umount /f2fsroot/boot
    $ sudo umount /f2fsroot/*
    $ sudo umount /f2fsroot
    reboot the system

    In the grub menu, the new f2fs root system is listed as Ubuntu

    The bootstrap ext2 root system is listed as Ubuntu Impish Indiri (development branch) (21.10) (on /dev/sdX4)

    Once system startup has finished, log in and check the filesystems to verify that / is on f2fs:

    Code:
    $ df -Th
    Filesystem     Type   Size  Used Avail Use% Mounted on
    tmpfs          tmpfs  393M  1.4M  391M   1% /run
     /dev/sda5      f2fs    12G  6.0G  6.0G  51% /
    tmpfs          tmpfs  2.0G     0  2.0G   0% /dev/shm
    tmpfs          tmpfs  5.0M  4.0K  5.0M   1% /run/lock
    tmpfs          tmpfs  4.0M     0  4.0M   0% /sys/fs/cgroup
    /dev/sda2      ext2   462M   69M  370M  16% /boot
    /dev/sda3      vfat   235M  5.2M  230M   3% /boot/efi
    tmpfs          tmpfs  393M   72K  393M   1% /run/user/126
    tmpfs          tmpfs  393M   64K  393M   1% /run/user/1000
    Last edited by onflash; August 26th, 2021 at 11:01 PM. Reason: fix path: /etc/initramfs-tools/modules, sudo vi -> sudoedit

  2. #2
    Join Date
    Jun 2006
    Location
    UK
    Beans
    Hidden!
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: RFC: f2fs root procedure

    20.10/Impish. Thread moved to Ubuntu Development Version.
    Ubuntu 18.04 Desktop Guide - Ubuntu 20.04 Desktop Guide - Forum Guide to BBCode - Using BBCode code tags - IRC #ubuntuforums

    Member: Not Canonical Team

    If you need help with your forum account, such as SSO login issues, username changes, etc, the correct place to contact an admin is here. Please do not PM me about these matters unless you have been asked to - unsolicited PMs concerning forum accounts will be ignored.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •