Unable to mount f2fs partition yet I have the kernel module as a builtin

I can't mount a f2fs partition I created. The module is a built-in. What am I missing?

# grep f2fs /lib/modules/$(uname -r)/modules.builtin
f2fs.ko
# mount UUID=e92249be-7749-45cf-a0e1-80b2d213e8e4 /mnt/data
mount: /mnt/data: unknown filesystem type 'f2fs'.
       dmesg(1) may have more information after failed mount system call.
# cat /proc/filesystems 
nodev	sysfs
nodev	tmpfs
nodev	bdev
nodev	proc
nodev	cgroup
nodev	cgroup2
nodev	cpuset
nodev	configfs
nodev	debugfs
nodev	sockfs
nodev	bpf
nodev	pipefs
nodev	ramfs
nodev	devpts
	ext3
	ext2
	ext4
	squashfs
nodev	jffs2
nodev	overlay
nodev	mqueue
	vfat

check
lsmod | grep f2fs

try to load
modprobe f2fs

read dmesg

It’s a builtin not a module so no output

oh ,sorry.

It’s a builtin

Are you sure? Check kernel config in the kernel build dir.

For me

root@RouteRich:~# cat /proc/filesystems | grep f2fs
	f2fs
grep F2FS build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_filogic/linux-5.15.167/.config
CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
# CONFIG_F2FS_FS_POSIX_ACL is not set
# CONFIG_F2FS_FS_SECURITY is not set
# CONFIG_F2FS_CHECK_FS is not set
# CONFIG_F2FS_FAULT_INJECTION is not set
# CONFIG_F2FS_FS_COMPRESSION is not set
# CONFIG_F2FS_IOSTAT is not set

You are missing mount.f2fs , no output from kernel == no mount attempt made.

Binaries shouldn't affect /proc/filesystems

So the odd thing is:

# grep f2fs /proc/filesystems
(returns nothing)

Yet

# zgrep -i f2fs /proc/config.gz
CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y
# CONFIG_F2FS_CHECK_FS is not set
# CONFIG_F2FS_FAULT_INJECTION is not set
# CONFIG_F2FS_FS_COMPRESSION is not set
# CONFIG_F2FS_IOSTAT is not set
# CONFIG_F2FS_UNFAIR_RWSEM is not set

And the .config I used to compile this image:

% grep -i f2fs .config
CONFIG_DEFAULT_mkf2fs=y
CONFIG_KERNEL_F2FS_FS_POSIX_ACL=y
CONFIG_KERNEL_F2FS_FS_SECURITY=y
# CONFIG_BUSYBOX_DEFAULT_FEATURE_VOLUMEID_F2FS is not set
CONFIG_PACKAGE_kmod-fs-f2fs=y
CONFIG_PACKAGE_libf2fs=y
# CONFIG_PACKAGE_libf2fs-selinux is not set
CONFIG_PACKAGE_f2fs-tools=y
# CONFIG_PACKAGE_f2fs-tools-selinux is not set
CONFIG_PACKAGE_f2fsck=y
# CONFIG_PACKAGE_f2fsck-selinux is not set
CONFIG_PACKAGE_mkf2fs=y
# CONFIG_PACKAGE_mkf2fs-selinux is not set

Which target? Can you post kernel config config.gz?

Why dont you check on device itself

mkdir /mnt/sda
mount.f2fs /dev/sda /mnt/sda

?

Well this indicates you do not have it as a "built in".
And it does not appear in your cat /proc/filesystems

Here is what I get on current snapshot downloaded image:

cat /proc/filesystems
nodev	sysfs
nodev	tmpfs
nodev	bdev
nodev	proc
nodev	cgroup
nodev	cgroup2
nodev	cpuset
nodev	configfs
nodev	debugfs
nodev	sockfs
nodev	bpf
nodev	pipefs
nodev	ramfs
nodev	devpts
	ext3
	ext2
	ext4
	squashfs
nodev	jffs2
nodev	overlay
	f2fs
nodev	mqueue
nodev	ubifs
nodev	pstore

There must be something missing in your build config.

Try installing kmod-fs-f2fs?....

Are you building kernel with 16K memory pages for RPi5B?
F2FS is not compatible with a 16K page size.

Thanks to all for the replies. The target is bcm2712 (RPi5B) and the root cause is 16KB pages which I compiled in on this image as I was testing my PR to build larger memory pages. It seems that f2fs support for 16KB pages was introduced with linux 6.7 but not backported to 6.6.

16K PAGE_SIZE only with 16K block sizes

1 Like

Do you have any idea how to use a 16KB block size? I can find nothing in the man pages. Testing on Arch ARM with the 16k page kernel (v6.12.6):

This does not work:

# mkfs.f2fs -O extra_attr,inode_checksum,sb_checksum,compression -w 16384 /dev/mmcblk0p3
    F2FS-tools: mkfs.f2fs Ver: 1.16.0 (2023-04-11)

Info: Disable heap-based policy
Info: Debug level = 0
Info: Trim is enabled
Info: Enable Compression
	/dev/mmcblk0p3 appears to contain an existing filesystem (f2fs).
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 5105664 (2493 MB)
Info: zone aligned segment0 blkaddr: 512
Info: format version with
  "Linux version 6.12.6-1-rpi-16k (builduser@leming) (aarch64-unknown-linux-gnu-gcc (GCC) 14.1.1 20240507, GNU ld (GNU Binutils) 2.42.0) #1 SMP PREEMPT Fri Dec 20 07:29:33 MST 2024"
Info: [/dev/mmcblk0p3] Discarding device
Info: This device doesn't support BLKSECDISCARD
Info: Discarded 2493 MB
Info: Overprovision ratio = 3.200%
Info: Overprovision segments = 40 (GC reserved = 38)
Info: format successful

Still cannot mount

# mount -o compress_algorithm=zstd:6,compress_chksum,atgc,gc_merge,lazytime /dev/mmcblk0p3 /mnt/media
mount: /mnt/media: wrong fs type, bad option, bad superblock on /dev/mmcblk0p3, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.

And

# dmesg
...
[Jan18 08:48] F2FS-fs (mmcblk0p3): Invalid log_blocksize (12), supports only 14
[  +0.007723] F2FS-fs (mmcblk0p3): Can't find valid F2FS filesystem in 1th superblock
[  +0.008494] F2FS-fs (mmcblk0p3): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[  +0.007840] F2FS-fs (mmcblk0p3): Can't find valid F2FS filesystem in 2th superblock

-w is for wanted sector size
-b is for block size

you should compile f2fs-tools-dev branch, 1.16 is too old
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?h=dev&id=50fd00b168d76eb26933faa427f167103c35aded

Nice, that did the trick, thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.