|
| 1 | +# cvt2f2fs |
| 2 | + |
| 3 | +I copied this from https://www.raspberrypi.org/forums/viewtopic.php?p=1285848#p1285848 as have been trying to to a initramfs script |
| 4 | +where I do the same but in a pivot mount live without need of USB. |
| 5 | +Then noticed this script and thought well actually its just as valid. |
| 6 | + |
| 7 | +It occured to me that with block wear you and that mostly we are running with SD cards with much spare space that 10-20% overprovision is |
| 8 | +actually no big loss for many running specific applications. |
| 9 | +So hey why not use this script and f2fs the flash friendly file system. |
| 10 | + |
| 11 | +Script you have to hack slightly as it runs rpi-update and pulls in the kernel update for 4.19 which buster will reside on. |
| 12 | +Buster is only a couple of month away but the biggest problem is that if the kernel version and f2fs version beome out of sync you will get errors. |
| 13 | +You can log in via a normal sudo just do things in order and run |
| 14 | +sudo cvt2f2fs |
| 15 | +after reboot |
| 16 | +sudo cvt2f2fs --phase2 |
| 17 | +after reboot |
| 18 | +sudo cvt2f2fs --phase3 |
| 19 | +after reboot |
| 20 | +sudo cvt2f2fs --phase4 |
| 21 | + |
| 22 | +So then you need to get f2fs-tools for buster as the script will run rpi-update. |
| 23 | +sudo vi /etc/apt/sources.list.d/10-buster.list |
| 24 | + |
| 25 | +deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi |
| 26 | + |
| 27 | +sudo vi /etc/apt/preferences.d/10-buster |
| 28 | + |
| 29 | +Package: * |
| 30 | +Pin: release n=stretch |
| 31 | +Pin-Priority: 900 |
| 32 | + |
| 33 | +Package: * |
| 34 | +Pin: release n=buster |
| 35 | +Pin-Priority: 750 |
| 36 | + |
| 37 | +sudo apt-get update |
| 38 | + |
| 39 | +Now we can grab things from buster when we want |
| 40 | +sudo apt-get install -t buster f2fs-tools |
| 41 | + |
| 42 | +You need to do the above as you will notice in syslog `fsck.f2fs: invalid option -- 'y'` |
| 43 | +Systemd seems to be trying to run with an invalid option |
| 44 | +The above fixes that and fsck.f2fs will run and report everything is fine. |
| 45 | +Thing is it will do that on every boot as the system thinks there is something wrong with the superblock. |
| 46 | + |
| 47 | +I thought OK dunno why this script is doing an rpi-update anyway and I know there where a lot of f2fs commits in 4.18 but lets hack the |
| 48 | +not to do the rpi-update bit. |
| 49 | +Strangely you get the same syslog messages invalid option -- 'y'` as the initramfs fsck.f2fs fails as it would seem the tools & kernel |
| 50 | +in stretch are not in version sync. |
| 51 | +I presume that we have had kernel updates but not f2fs-tools updates. |
| 52 | + |
| 53 | +Haven't done much more as f2fs was like I say an after thought that what is a huge over-provision of 10-20% is only approx 1-2gb |
| 54 | +of a 8/16gb sd card that most of us use. |
| 55 | +``` |
| 56 | +-o overprovision-ratio-percentage |
| 57 | + Specify the percentage over the volume size for overprovision area. This area is |
| 58 | + hidden to users, and utilized by F2FS cleaner. The default percentage is 5%. |
| 59 | + ``` |
| 60 | + simple as mkfs.f2fs -o 20 /dev/mmcblk0p2 |
| 61 | + |
| 62 | + So included this here just for info as if you are using zram-conf other than just pure swaps then block and sd flash file systems might be of interest |
| 63 | + I will get round to solving the above probs but just thought I would shout out and ask. |
| 64 | + |
| 65 | +Also there is one more thing that is confusing me |
| 66 | +``` |
| 67 | +-t nodiscard/discard |
| 68 | + Specify 1 or 0 to enable/disable discard policy. If the value is equal to 1, |
| 69 | + discard policy is enabled, otherwise is disable. The default value is 1. |
| 70 | +``` |
| 71 | + |
| 72 | +f2fs has a optimised discard policy built in by default, but every example i see has an fstab or mount option with the discard directive set. |
| 73 | +I keep thinking is it fundemental to the file system surely we don't use the discard method that say ext4 would use. |
| 74 | +But it is confusing why with f2fs its specified at mkfs.f2fs -t 1 /dev/mmcblk0p2 and is the default. |
| 75 | +Dunno it doesn't make sense to need mount or fstab discard entries when its already set on creation? |
| 76 | + |
| 77 | +Anyone who uses f2fs please maybe explain as I will be adopting prob will wait for buster this summer but thought I would post and ask. |
| 78 | + |
0 commit comments