f2fs tuning

Moderators: mdrjr, odroid

f2fs tuning

Unread postby midtskogen » Tue Aug 07, 2018 7:22 pm

Has anyone experience with the f2fs filesystem?

I use several XU4's for storing video from IP cameras. They have 256GB microSD cards. Video files are continuously written to the card, and also read for analysis. When the filesystem gets full, the oldest files will be deleted. I found that writing became too slow when using ext4, so I tried f2fs and got a huge performance gain. But that was only when the filesystem was relatively empty. When the filesystem is nearly full, f2fs seems to have serious performance issues. Sometimes simple operations (like 'ls' or 'df') may freeze for seconds to minutes. f2fs has a lot of knobs, both mkfs options and mount options, but I don't know f2fs well enough to guess what will work better for me. Does anyone here have any experience with f2fs and would know what options might help in my case?
midtskogen
 
Posts: 92
Joined: Mon Jul 27, 2015 3:57 am
languages_spoken: english norwegian
ODROIDs: U3 XU3-Lite XU4

Re: f2fs tuning

Unread postby midtskogen » Sun Aug 12, 2018 4:06 pm

I did some more experiments. By default mkfs.f2fs allocates very little for overprovisioning (about 0.5% in my case). Increasing that to 10% seems to help a lot.
midtskogen
 
Posts: 92
Joined: Mon Jul 27, 2015 3:57 am
languages_spoken: english norwegian
ODROIDs: U3 XU3-Lite XU4

Re: f2fs tuning

Unread postby meveric » Sun Aug 12, 2018 7:11 pm

its better to use ext2 or ext4 without journal for flash memories such as SD cards, which reduces write operations.
Under Linux it's also good to set the "noatime" flag to make sure the filesystem does not save all the time when you access a file.
And of cause using fstrim also helps ALOT to keep SD cards fast, but not all devices support this (the XU4 does).
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.
User avatar
meveric
 
Posts: 8988
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1

Re: f2fs tuning

Unread postby midtskogen » Mon Aug 13, 2018 1:47 am

I have not tried ext2 or ext4 without journaliing, only ext4 with the noatime flag. And ext4 (with noatime) performed poorly for continuous write, whereas f2fs performed much better in my case until the partition was more than 90% full. At near 100% for f2fs totally collapses eventually using the default overprovisioning. Simple commands like "ls" and "df" could take minutes. And umount could take hours while some kernel task was runnig at ~50% cpu. So there are pros and cons. My impression is that f2fs does its job given sufficient overprovisioning (I need to see if this is true also after a few weeks), though it's much more cpu intensive than ext4.

More expensive microsd cards might perform better, though. I'm using the cheapest 256GB cards that I could find.

So ext4 is probably a good initial choice. If its performance is good enough, fine. If not, f2fs is worth looking into, but might require some tuning depending on what the partition is used for.
midtskogen
 
Posts: 92
Joined: Mon Jul 27, 2015 3:57 am
languages_spoken: english norwegian
ODROIDs: U3 XU3-Lite XU4


Return to General Chat

Who is online

Users browsing this forum: No registered users and 0 guests

cron