View previous topic :: View next topic |
Author |
Message |
ross_cc n00b


Joined: 29 Jul 2020 Posts: 17 Location: Manila
|
Posted: Wed Jul 29, 2020 5:01 am Post subject: Tip: enable F2FS compression on Raspberry Pi |
|
|
Starting from linux 5.6, F2FS has added file-system compression support. This is a succinct intro to use this newest feature on your Pi:
1. Build the kernel for version 5.6+ (5.7+ for zstd compression support) for both your host machine and Pi, and make sure to enable the options for F2FS compression support.
2. Build f2fs-tools. Since the version on gentoo tree (sys-fs/f2fs-tools-1.13.0) is outdated and does not support making compression-enabled filesystems, you have to build directly from the upstream source: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git.
3. Format the designed partition with compression attribute enabled: Code: | mkfs.f2fs -O extra_attr,compression /dev/<partition> -f | . (this will erase everything on this partition, so make sure you have needed files backed up beforehand)
4. Now you can mount the partition with compression enabled: Code: | mount -o compress_algorithm=lz4/lzo/zstd /dev/<partition> /mnt/<mountpoint> | . (now it's the time you can restore the backed up files)
5. Modify /etc/fstab and append Code: | ,compress_algorithm=lz4/lzo/zstd | to the 4th column on the corresponding partition.
6. (If the partition happens to serve as rootfs) Append Code: | rootfstype=f2fs rootflags=compress_algorithm=lz4/lzo/zstd | on cmdline.txt.
Feel free to ask me to elaborate if you have any apprehensions:-) |
|
Back to top |
|
 |
Antikapitalista n00b

Joined: 18 Apr 2011 Posts: 16
|
Posted: Tue Sep 08, 2020 9:30 am Post subject: |
|
|
And does it actually make any difference?
The code is architecture-agnostic, I have not tried this on anything ARM-related, only on AMD64 so far, the partition can be formatted and mounted properly, using zstd compression, enabled in the kernel; everything seemingly works, the compression attribute can be set and is inherited,etc., but there are no noticeable space savings; tested with plain text files as well as object code files.
So far, f2fs compression seems like snake oil to me. _________________ On a warpath against the North Atlantic Terrorist Organization. |
|
Back to top |
|
 |
Ant P. Watchman

Joined: 18 Apr 2009 Posts: 6868
|
Posted: Tue Sep 08, 2020 9:59 am Post subject: |
|
|
zstd makes a very significant difference on btrfs, it should be the same for f2fs:
Code: | /usr/share # compsize .
Processed 87689 files, 39573 regular extents (40152 refs), 60656 inline.
Type Perc Disk Usage Uncompressed Referenced
TOTAL 62% 1.8G 3.0G 3.0G
none 100% 1.1G 1.1G 1.1G
zstd 39% 760M 1.8G 1.9G
|
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|