Skip to contentSkip to conversation

Questions about using f2fs to format the root partition during Slint installation.

f2fs-dev Didier Spaier 2 participants 5 messages Jun 24, 2020 – Sep 1, 2020

lore
Share & tools
lore
#0 lore raw

Hello list,

this email is a follow-up of:
https://www.mail-archive.com/[email protected]/msg14390.html

I will number the questions Q1, Q2 etc.

To summarize the context and goal: I want that the Slint installer format the root partition with f2fs when appropriate, if possible without asking questions to the user about the device.

I target usage of f2fs for the root file system in cases of USB flash drives aka USB sticks, SD cards, eMMC, as if I understand correctly these kinds of devices benefit the most of wear minimization and increase of performance when using f2fs. I plan to use ext4 for SSD (including NVMe) and hard disks.

This leads to several questions:

Q1: Comments about this choice of target devices for f2fs, knowing that I favor security over performances and that the "auto" option of the installer is intended for your grand-mother? I am a grand father myself <smile>.

Q2. How-to determine if the drive fall in one of the types listed above without asking the user if possible?

I have considered using the output of lsblk and/or "udevadm info" but that doesn't seem to provide enough information on the device.

As an aside, I have seen rota=1 for an USB boot stick. ???

Q3. What would be the safest options to include in the relevant line of /etc/fstab forthe root partition using f2fs?

Q4. do you confirm the statement below? it is a quote of web page:
https://wiki.gentoo.org/wiki/F2FS

Quoted 4 lines

When using f2fs > When using f2fs as rootfs fsck fails on boot. Solutions are either disabling fsck in /etc/fstab (setting the last number to 0) or enabling the force-flag for fsck in /etc/conf.d/fsck. See bug #671786

Q5. I am correct f2fs can be expanded but not shrinked. Is it still true? Will it planned to bring this feature?

Q6. Currently we ship a 4.19 kernel. Would it be preferable to ship a 5.4 one instead shipped in Slackware-current at time of writing, knowing that we ship an no patched (aka vanilla) kernel and what would be the benefit of doing so wrt f2fs?

Have a good day,

Didier

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#1 lore raw

Hi,

Quoted 17 lines · Didier Spaier

Hello list,

this email is a follow-up of:
https://www.mail-archive.com/[email protected]/msg14390.html

I will number the questions Q1, Q2 etc.

To summarize the context and goal: I want that the Slint installer format the root partition with f2fs when appropriate, if possible without asking questions to the user about the device.

I target usage of f2fs for the root file system in cases of USB flash drives aka USB sticks, SD cards, eMMC, as if I understand correctly these kinds of devices benefit the most of wear minimization and increase of performance when using f2fs. I plan to use ext4 for SSD (including NVMe) and hard disks.

Quoted 6 lines

This leads to several questions:

Q1: Comments about this choice of target devices for f2fs, knowing that I favor security over performances and that the "auto" option of the installer is intended for your grand-mother? I am a grand father myself <smile>.

Which security and performance feature do you want to use in the system? For example, mkfs.f2fs requires some options like:
- fscrypt : -O encrypt
- quota : -O quota
- fsverity : -O verity
- compression : -O compression -O extra_attr
- casefolding : -O casefold -C utf8

Quoted 8 lines

Q2. How-to determine if the drive fall in one of the types listed above without asking the user if possible?

I have considered using the output of lsblk and/or "udevadm info" but that doesn't seem to provide enough information on the device.

As an aside, I have seen rota=1 for an USB boot stick. ???

I don't have a good idea to detect this. Maybe by measuring write bandwidth and checking IO interface?

Quoted 3 lines

Q3. What would be the safest options to include in the relevant line of /etc/fstab forthe root partition using f2fs?

default + any features that you're interested in? We've been using the below option for several years in Android.
https://android.googlesource.com/device/google/coral/+/refs/heads/master/fstab.hardware#11

Quoted 7 lines

Q4. do you confirm the statement below? it is a quote of web page:
https://wiki.gentoo.org/wiki/F2FS

Quoted 4 lines

When using f2fs > When using f2fs as rootfs fsck fails on boot. Solutions are either disabling fsck in /etc/fstab (setting the last number to 0) or enabling the force-flag for fsck in /etc/conf.d/fsck. See bug #671786

Yes, likewise e2fsprogs, fsck.f2fs doesn't allow to open ro-mounted disk with "-a". But we added a patch to allow it with "-f".

Quoted 3 lines

Q5. I am correct f2fs can be expanded but not shrinked. Is it still true? Will it planned to bring this feature?

That can be done by ioctl() in runtime since v5.3.
https://lore.kernel.org/linux-f2fs-devel/[email protected]/#r

Quoted 5 lines

Q6. Currently we ship a 4.19 kernel. Would it be preferable to ship a 5.4 one instead shipped in Slackware-current at time of writing, knowing that we ship an no patched (aka vanilla) kernel and what would be the benefit of doing so wrt f2fs?

v5.4 would be better, and if you have some time, it'd be great to sync my backporting patches from the below branches. These are all mirrored to Android common kernels as well.

https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-stable.git/log/?h=linux-5.4.y
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-stable.git/log/?h=linux-4.19.y
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-stable.git/log/?h=linux-4.14.y

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#2 lore raw

Hi,

thanks for your answer, which leads to more questions and a request.

I will quote only the relevant parts of this answer below.

Quoted 4 lines · Jaegeuk Kim
Quoted 2 lines · Didier Spaier

this email is a follow-up of:
https://www.mail-archive.com/[email protected]/msg14390.html

...

Quoted 5 lines
Quoted 4 lines

Q1: Comments about this choice of target devices for f2fs, knowing that I favor security over performances and that the "auto" option of the installer is intended for your grand-mother? I am a grand father myself <smile>.

Quoted 7 lines

Which security and performance feature do you want to use in the system? For example, mkfs.f2fs requires some options like:
- fscrypt : -O encrypt
- quota : -O quota
- fsverity : -O verity
- compression : -O compression -O extra_attr
- casefolding : -O casefold -C utf8

Do I understand well that these features are defined in f2fs.h? In Linux 5.4.60:
#define F2FS_FEATURE_ENCRYPT 0x0001
#define F2FS_FEATURE_BLKZONED 0x0002
#define F2FS_FEATURE_ATOMIC_WRITE 0x0004
#define F2FS_FEATURE_EXTRA_ATTR 0x0008
#define F2FS_FEATURE_PRJQUOTA 0x0010
#define F2FS_FEATURE_INODE_CHKSUM 0x0020
#define F2FS_FEATURE_FLEXIBLE_INLINE_XATTR 0x0040
#define F2FS_FEATURE_QUOTA_INO 0x0080
#define F2FS_FEATURE_INODE_CRTIME 0x0100
#define F2FS_FEATURE_LOST_FOUND 0x0200
#define F2FS_FEATURE_VERITY 0x0400
#define F2FS_FEATURE_SB_CHKSUM 0x0800
#define F2FS_FEATURE_CASEFOLD 0x1000

I ask because I don't see them listed in a man page where I would have expected to find them, like mkfs.f2fs (8) or mount (8)

I don't see them listed in:
https://github.com/torvalds/linux/blob/master/Documentation/filesystems/f2fs.rst

...

Quoted 6 lines
Quoted 2 lines

Q3. What would be the safest options to include in the relevant line of /etc/fstab forthe root partition using f2fs?

default + any features that you're interested in? We've been using the below option for several years in Android.
https://android.googlesource.com/device/google/coral/+/refs/heads/master/fstab.hardware#11

The mount flags and options are described in f2fs.rst but I don't expect a casual user to read that.

So I suggest that all the mount options specific to f2fs be listed in an document intended for end users (man f2fs?) as that could help favor its adoption by Linux distributions as an alternative to ext4 when relevant.

Maybe you could consult with util-linux devs, as man mount is part of the util-linux package; to just add a line to the text quoted below?

FILESYSTEM-SPECIFIC MOUNT OPTIONS
This section lists options that are specific to particular filesystems. Where possible, you should first consult filesystem-specific manual pages for details. Some of those pages are listed in the following table.

Filesystem(s) Manual page
btrfs btrfs(5)
cifs mount.cifs(8)
ext2, ext3, ext4 ext4(5)
fuse fuse(8)
nfs nfs(5)
tmpfs tmpfs(5)
xfs xfs(5)

the added line would just be for instance:

f2fs f2fs(8)

Indeed

I know I should propose to contribute writing man f2fs, unfortunately my knowledge of f2fs is very close to non existent.

Incidentally, the options listed in
https://android.googlesource.com/device/google/coral/+/refs/heads/master/fstab.hardware#11
indicate that f2fs is only used for the partition mounted as /data.

I don't know Android at all but thought that /system is more or less the equivalent of root (/) in other Linux distributions. If that's the case, why not us also f2fs for it? Maybe I am fully wrong, please correct me. I would be grateful for any pointer to a document explaining the purposes of the various mount points in Android as they differ from the FHS:
https://refspecs.linuxfoundation.org/fhs.shtml

Best regards,

Didier

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#3 lore raw

Hi,

Quoted 42 lines · Didier Spaier

Hi,

thanks for your answer, which leads to more questions and a request.

I will quote only the relevant parts of this answer below.

Quoted 4 lines · Jaegeuk Kim
Quoted 2 lines · Didier Spaier

this email is a follow-up of:
https://www.mail-archive.com/[email protected]/msg14390.html

...

Quoted 5 lines
Quoted 4 lines

Q1: Comments about this choice of target devices for f2fs, knowing that I favor security over performances and that the "auto" option of the installer is intended for your grand-mother? I am a grand father myself <smile>.

Quoted 7 lines

Which security and performance feature do you want to use in the system? For example, mkfs.f2fs requires some options like:
- fscrypt : -O encrypt
- quota : -O quota
- fsverity : -O verity
- compression : -O compression -O extra_attr
- casefolding : -O casefold -C utf8

Do I understand well that these features are defined in f2fs.h? In Linux 5.4.60:
#define F2FS_FEATURE_ENCRYPT 0x0001
#define F2FS_FEATURE_BLKZONED 0x0002
#define F2FS_FEATURE_ATOMIC_WRITE 0x0004
#define F2FS_FEATURE_EXTRA_ATTR 0x0008
#define F2FS_FEATURE_PRJQUOTA 0x0010
#define F2FS_FEATURE_INODE_CHKSUM 0x0020
#define F2FS_FEATURE_FLEXIBLE_INLINE_XATTR 0x0040
#define F2FS_FEATURE_QUOTA_INO 0x0080
#define F2FS_FEATURE_INODE_CRTIME 0x0100
#define F2FS_FEATURE_LOST_FOUND 0x0200
#define F2FS_FEATURE_VERITY 0x0400
#define F2FS_FEATURE_SB_CHKSUM 0x0800
#define F2FS_FEATURE_CASEFOLD 0x1000

Quoted 7 lines

I ask because I don't see them listed in a man page where I would have expected to find them, like mkfs.f2fs (8) or mount (8)

I don't see them listed in:
https://github.com/torvalds/linux/blob/master/Documentation/filesystems/f2fs.rst

...

Sorry for inconvenience. Let me enhance documentation a bit.

Quoted 33 lines
Quoted 7 lines
Quoted 3 lines

Q3. What would be the safest options to include in the relevant line of /etc/fstab forthe root partition using f2fs?

default + any features that you're interested in? We've been using the below option for several years in Android.
https://android.googlesource.com/device/google/coral/+/refs/heads/master/fstab.hardware#11

The mount flags and options are described in f2fs.rst but I don't expect a casual user to read that.

So I suggest that all the mount options specific to f2fs be listed in an document intended for end users (man f2fs?) as that could help favor its adoption by Linux distributions as an alternative to ext4 when relevant.

Maybe you could consult with util-linux devs, as man mount is part of the util-linux package; to just add a line to the text quoted below?

FILESYSTEM-SPECIFIC MOUNT OPTIONS
This section lists options that are specific to particular filesystems. Where possible, you should first consult filesystem-specific manual pages for details. Some of those pages are listed in the following table.

Filesystem(s) Manual page
btrfs btrfs(5)
cifs mount.cifs(8)
ext2, ext3, ext4 ext4(5)
fuse fuse(8)
nfs nfs(5)
tmpfs tmpfs(5)
xfs xfs(5)

Quoted 3 lines

the added line would just be for instance:

f2fs f2fs(8)

It seems recent "man mount(8)" moves to guide Documentation/filesystems as well. But, I think I need to prepare a sort of "man f2fs(5)" in f2fs-tools.

FILESYSTEM-SPECIFIC MOUNT OPTIONS
You should consult the respective man page for the filesystem first. If you want to know what options the ext4 filesystem supports, then check the ext4(5) man page. If that doesn't exist, you can also check the correspond‐ ing mount page like mount.cifs(8). Note that you might have to install the respective userland tools.

The following options apply only to certain filesystems. We sort them by filesystem. They all follow the -o flag.

What options are supported depends a bit on the running kernel. More info may be found in the kernel source sub‐ directory Documentation/filesystems.

Quoted 10 lines

Indeed

I know I should propose to contribute writing man f2fs, unfortunately my knowledge of f2fs is very close to non existent.

Incidentally, the options listed in
https://android.googlesource.com/device/google/coral/+/refs/heads/master/fstab.hardware#11
indicate that f2fs is only used for the partition mounted as /data.

Quoted 6 lines

I don't know Android at all but thought that /system is more or less the equivalent of root (/) in other Linux distributions. If that's the case, why not us also f2fs for it? Maybe I am fully wrong, please correct me. I would be grateful for any pointer to a document explaining the purposes of the various mount points in Android as they differ from the FHS:
https://refspecs.linuxfoundation.org/fhs.shtml

Android /system is a read-only partition which provides a device boot-up, while all the data for applications and users are stored in /data as read-write. For now, there's no strong motivation to replace the filesystem for /system. :)

Quoted 7 lines

Best regards,

Didier

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#4 lore raw

Hi,

Le 31/08/2020 à 19:42, Jaegeuk Kim a écrit :

Quoted 48 lines

Hi,

Quoted 45 lines · Didier Spaier

Hi,

thanks for your answer, which leads to more questions and a request.

I will quote only the relevant parts of this answer below.

Quoted 4 lines · Jaegeuk Kim
Quoted 2 lines · Didier Spaier

this email is a follow-up of:
https://www.mail-archive.com/[email protected]/msg14390.html

...

Quoted 5 lines
Quoted 4 lines

Q1: Comments about this choice of target devices for f2fs, knowing that I favor security over performances and that the "auto" option of the installer is intended for your grand-mother? I am a grand father myself <smile>.

Quoted 7 lines

Which security and performance feature do you want to use in the system? For example, mkfs.f2fs requires some options like:
- fscrypt : -O encrypt
- quota : -O quota
- fsverity : -O verity
- compression : -O compression -O extra_attr
- casefolding : -O casefold -C utf8

Do I understand well that these features are defined in f2fs.h? In Linux 5.4.60:
#define F2FS_FEATURE_ENCRYPT 0x0001
#define F2FS_FEATURE_BLKZONED 0x0002
#define F2FS_FEATURE_ATOMIC_WRITE 0x0004
#define F2FS_FEATURE_EXTRA_ATTR 0x0008
#define F2FS_FEATURE_PRJQUOTA 0x0010
#define F2FS_FEATURE_INODE_CHKSUM 0x0020
#define F2FS_FEATURE_FLEXIBLE_INLINE_XATTR 0x0040
#define F2FS_FEATURE_QUOTA_INO 0x0080
#define F2FS_FEATURE_INODE_CRTIME 0x0100
#define F2FS_FEATURE_LOST_FOUND 0x0200
#define F2FS_FEATURE_VERITY 0x0400
#define F2FS_FEATURE_SB_CHKSUM 0x0800
#define F2FS_FEATURE_CASEFOLD 0x1000

I ask because I don't see them listed in a man page where I would have expected to find them, like mkfs.f2fs (8) or mount (8)

Quoted 6 lines
Quoted 4 lines

I don't see them listed in:
https://github.com/torvalds/linux/blob/master/Documentation/filesystems/f2fs.rst

...

Sorry for inconvenience. Let me enhance documentation a bit.

Thanks in advance. I know that it takes time to update documentation and that you are busy enough already.

Quoted 32 lines
Quoted 32 lines
Quoted 6 lines
Quoted 2 lines

Q3. What would be the safest options to include in the relevant line of /etc/fstab forthe root partition using f2fs?

default + any features that you're interested in? We've been using the below option for several years in Android.
https://android.googlesource.com/device/google/coral/+/refs/heads/master/fstab.hardware#11

The mount flags and options are described in f2fs.rst but I don't expect a casual user to read that.

So I suggest that all the mount options specific to f2fs be listed in an document intended for end users (man f2fs?) as that could help favor its adoption by Linux distributions as an alternative to ext4 when relevant.

Maybe you could consult with util-linux devs, as man mount is part of the util-linux package; to just add a line to the text quoted below?

FILESYSTEM-SPECIFIC MOUNT OPTIONS
This section lists options that are specific to particular filesystems. Where possible, you should first consult filesystem-specific manual pages for details. Some of those pages are listed in the following table.

Filesystem(s) Manual page
btrfs btrfs(5)
cifs mount.cifs(8)
ext2, ext3, ext4 ext4(5)
fuse fuse(8)
nfs nfs(5)
tmpfs tmpfs(5)
xfs xfs(5)

Quoted 6 lines
Quoted 3 lines

the added line would just be for instance:

f2fs f2fs(8)

It seems recent "man mount(8)" moves to guide Documentation/filesystems as well. But, I think I need to prepare a sort of "man f2fs(5)" in f2fs-tools.

I'd be glad for that, should be very useful.

Quoted 28 lines

FILESYSTEM-SPECIFIC MOUNT OPTIONS
You should consult the respective man page for the filesystem first. If you want to know what options the ext4 filesystem supports, then check the ext4(5) man page. If that doesn't exist, you can also check the correspond‐ ing mount page like mount.cifs(8). Note that you might have to install the respective userland tools.

The following options apply only to certain filesystems. We sort them by filesystem. They all follow the -o flag.

What options are supported depends a bit on the running kernel. More info may be found in the kernel source sub‐ directory Documentation/filesystems.

Quoted 10 lines

Indeed

I know I should propose to contribute writing man f2fs, unfortunately my knowledge of f2fs is very close to non existent.

Incidentally, the options listed in
https://android.googlesource.com/device/google/coral/+/refs/heads/master/fstab.hardware#11
indicate that f2fs is only used for the partition mounted as /data.

Quoted 6 lines

I don't know Android at all but thought that /system is more or less the equivalent of root (/) in other Linux distributions. If that's the case, why not us also f2fs for it? Maybe I am fully wrong, please correct me. I would be grateful for any pointer to a document explaining the purposes of the various mount points in Android as they differ from the FHS:
https://refspecs.linuxfoundation.org/fhs.shtml

Quoted 8 lines

Android /system is a read-only partition which provides a device boot-up, while all the data for applications and users are stored in /data as read-write. For now, there's no strong motivation to replace the filesystem for /system. :)

Quoted 4 lines

Best regards,

Didier

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel