This is an old revision of the document!
Install Raspbian on f2fs root
this may be combined with solve raspbian SD card corruption issues with read-only mounted root partition in order to minimize SD card corruption on a raspberry pi or if your raspberry is usually shut down regularily, you might still want to consider this because f2fs was specifically optimized for flash memory storage and supposedly should help to extend the life of such storage devices significantly.
here is a quick step by step howto how i installed raspbian from the minimal image onto an f2fs sd card
- download image and dd it onto the sd card
- boot raspberry pi from sd card and expand partition by using
raspi-config
- now shut down using the
shutdown
- insert sd card again into your pc. from here on, we suppose the sd card is /dev/sdf. in order to find its name on your system, you can use
lsblk
- format 2nd partition with f2fs:
mkfs.f2fs /dev/sdf2
- mount it
mkdir /tmp/sd mount -t f2fs /dev/sdf2 /tmp/sd/
- mount second partition from image (see also mount_a_single_partition_from_a_dd_disk_image):
mkdir /tmp/image kpartx -av raspbianimage.img mount /dev/mapper/loop0p2 /tmp/image
- now copy the os to the sd card
rsync -aHvx /tmp/image/ /tmp/sd/
- find the partition uuid by using
blkid
and copy the “PARTUUID” number - edit fstab:
nano /tmp/sd/etc/fstab
and replace
ext4
in the root mount line withf2fs
, also update thePARTUUID
with the one you found in the previous step. - unmount it all again
umount /tmp/sd /tmp/image
- mount boot partition and edit boot options:
mount /dev/sdf1 /tmp/sd nano /tmp/sd/cmdline.txt
and now replace ext4 with f2fs in here and paste the correct
PARTUUID
as well. - cleanup:
umount /tmp/sd rmdir /tmp/sd /tmp/image
- insert the sd card into your raspberry pi and finally start configuring it :)