yashsingh1/xdaforums huggingface dataset:
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
It is easy, The kernel patch is just to inject the optimizations in fstab and it is something you can flash to the stock kernel right now without reformatting (do not forget to create a backup of your boot partition, just in case). However the structure you have now in the data and internal storage is not optimal since it is configured when restoring the data. The latest is not related to this patch but with the guide. First apply the kernel patch and if everything looks fine, continue with the rest to optimize your current F2FS filesystem.

If you have already patched the kernel with the F2FS patch but switched to F2FS filesystem without the optimization parameters while restoring the backup (The first version of the guide), then you just have to enter in TWRP and do all this steps without leaving recovery:

STEP 1: reboot to recovery and go to advanced / terminal. Type the command df. This will give you the current usage of the partitions. Write down the total 1K blocks, used and available statistics for the /dev/block/dm-0, the partition shared by data and sdcard. You will use these statistics to compare before and after.

STEP 2: Backup of your system (Boot, system and Data) to external SD.

STEP 3: Backup your internal storage (either way of those detailed in the guide)

STEP 4: Format Data and internal storage.

STEP 5: Open the terminal under advanced menu and type

mount -o remount,discard,nosuid,nodev,noatime,nodiratime,nobarrier,inline_xattr,inline_data /data
mount -o remount,discard,nosuid,nodev,noatime,nodiratime,nobarrier,inline_xattr,inline_data /sdcard

STEP 6: Restore your Data partition.

STEP 7: Restore your internal storage.

STEP 8: Go again to the terminal inside TWRP and type df again to see the difference in the data and sdcard shared partition.

Please let us know your statistics before and after.

That's all.
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
System doesn't boot after applying the patch. I'm using BeastMode Kernel v12. I'll try with another kernel and report back.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
The patch only works for the stock kernel.

In case you use a kernel with init.d support like BeastMode, it is even easier. Just open a terminal in your phone using terminal app or adb interface using adb shell. Type the following commands:

su
mount -o remount,rw /system
echo "#!/system/bin/sh" > /system/etc/init.d/F2FSplus
echo mount -o remount,discard,nosuid,nodev,noatime,nodiratime,nobarrier,inline_xattr,inline_data /data >> /system/etc/init.d/F2FSplus
chmod 777 /system/etc/init.d/F2FSplus

These commands will create a file that will apply the optimized settings at boot. That is all you should need with any kernel supporting init.d. To check that everything was properly applied, reboot the system, open a terminal and type mount. You will see that the lines for /sdcard and /data show the new options along with a few more, added as default by the system.

After you had checked that the F2FS options were properly installed, you will have to apply the steps from my previous message to optimize your current partitions with the new options.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
How was everything with the init.d patch under BeastMode Kernel?
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
I couldn't get it to boot so I reverted back to the stock kernel. Haven't had time to do the optimization yet. I'll be sure to report back once I do though!
[ZTE Axon 7 Themes, Apps, and Mods] blackknightavalon:
For those of you who have internal SD rw issues, boot into Recovery and in an ADB shell log in as root and chmod 777 the /sdcard partition.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
The exact command that needs to be typed in the terminal window of TWRP is:

chmod -R 777 /sdcard

I updated the guide this morning to integrate that step. I have always been worried about doing uncompressed backups through adb since the restore process doesn't create empty directories. This is why I prefer using the micro SD to perform the backups. I tried to store the whole /sdcard into a tar.gz archive, but the tar command only supports path+names up to 100 characters, and that is easily surpassed when you start installing apps.

I really miss zip, midnight commander and nano in TWRP. Now we are forced to use vi, tar and use commands to manage files.

Regards
[ZTE Axon 7 Themes, Apps, and Mods] blackknightavalon:
Anybody who has gotten this far in root should know the chmod syntax. ?
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
The process doesn't require root, neither unlocked bootloader. Even TWRP can be run from fastboot without requiring flash, so it is compatible with full stock devices.

On the other hand I always try to write guides for everyone, including newbies. At the end they are usually lost, a lot more than experienced users and they need the guides to be very clear more than anyone.
[ZTE Axon 7 Themes, Apps, and Mods] blackknightavalon:
I usually lead them to this page.
[ZTE Axon 7 Themes, Apps, and Mods] amphi66:
Worked well, thanks!
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
I factory reset everything and then applied the steps to fix the mount options. How do I check to see if I did it right?
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Open a terminal in your phone, or through adb, after your device had finished booting into system. Type mount | grep /data and look for the current options for that mount point. You /data mount should be f2fs and it should have the following options: rw, seclabel, nosuid, nodev, noatime, nodiratime, background_gc=on, discard, user_xattr, inline_xattr, inline_data, nobarrier, active_logs=6. Disregard those two trailling zeroes, those are not mount option. These are just the default mount options set plus those you added in the init.d
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
Seems I'm missing a few. Maybe I missed a step?
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
OK, I know what happened, when you typed the commands to create the file under init.d, your /system was mount as read only. Type these commands for creating the file and reboot again for the changes to have effect:

su
mount -o remount,rw /system
echo "#!/system/bin/sh" > /system/etc/init.d/F2FSplus
echo mount -o remount,discard,nosuid,nodev,noatime,nodiratime,nobarrier,inline_xattr,inline_data /data >> /system/etc/init.d/F2FSplus
chmod 777 /system/etc/init.d/F2FSplus
reboot

This should work. Otherwise, please type ls -l /etc/init.d/ , you should have a line like this:

-rwxrwxrwx root root 115 2017-01-24 14:47 F2FSplus

if it is there but when typing mount | grep /data your options are not there, then it is a problem of the init.d support.
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
So close!
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
It is really strange. Before using the patch, you had user_xattr and now you have nouser_xattr. Same for acl mount option. Where are thone changes coming from? On the other hand I do not see noatime nor nodiratime.

You can execute it manually the script at any time by typing:

su

sh /etc/init.d/F2FSplus

However the objective of init.d is to have it executed when system is booting. Do you have any other app modifying the mount options?
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
No, I'm pretty much stock with the exception of SuperSU and Xposed.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
There is something else in your system modifying your mount options. The first screenshot you posted displays the stock mount options for the F2FS partition. However the second mount options has very different options. And they are not coming from the init.d patch

There is something else changing them afterwards.
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
I don't know what happened, but suddenly everything's a-ok. Thanks for being so patient with me [MENTION=319057]Oki[/MENTION]
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
Before and after F2FS mount option optimizations in AnTuTu!

Anyone know of any better benchmarks for testing storage than AnTuTu? Don't know if AnTuTu really reflects the impact that f2fs properly setup can do. In real world use, I feel like there's a noticeable difference.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Well you got it right this time. I am still curious about what could happen to your unit before.

There are several tests you can run. Chainfire's CF-bench is a good one since it has IO testing. Take a look at the link in the OP. There you can find several tests. AnTuTu is a good test for games and not quite focused on interface performance. But even in AnTuTu the difference is noticeable. Probably heavy write intensive apps such as media recording will have less problem with the storage.

The last TWRP 3.0.4 has F2FS drivers backported from the latest Android kernel 4.10 source and it is better than this one from 2014.I can't wait to see this new implementation in the new custom kernel by [MENTION=309990]freeza[/MENTION]. I am still hoping ZTE had included them in the Nougat stock kernel too.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
You must notice it. Your User eXperience index was increased 10.2%. Just imagine the overclock index you 'd need to obtain that performance bump.
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
I definitely do! And thank you for that!
[ZTE Axon 7 Themes, Apps, and Mods] baconboy:
What happened with this topic? Do people still use this? It looks interesting! I'm going to install the Bad Boyz Rom, and am thinking about following this guide too.
[ZTE Axon 7 Themes, Apps, and Mods] JeromeLeung:
F2fs doesn't seem to be working well with encryption at the moment. I would advise against doing this for badboyz
[ZTE Axon 7 Themes, Apps, and Mods] Zeiad98:
Will it also take effect on adoptable storage?
[ZTE Axon 7 Themes, Apps, and Mods] Valentyn_L:
I wish LineageOS FULLY supported F2FS. It just makes the whole OS so much snappier!
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Well, all you need to do is to flash a new kernel. That way you can flash Marshmallow stock, Nougat Stock or LOS without formatting the Data partition while keeping your internal SD untouched. The flash procedure for a clean LOS installation while maintaining f2fs Data partition would be:

1. Wipe System, Data and cache/dalvik partitions

2. Flash universal bootstack and the modem for the Chinese, USA and German versions (step required when you come from any stock ROM)

3. Flash LOS ROM

4. Flash gapps (unlike open gapps, beans gapps doesn't fail during installation)

5. Flash BeastMode or Hybrid kernel. Both support F2FS for data and Cache partitions.

That's all. Same procedure applies for any other LOS based ROM such as Resurrection Remix. In fact, I am now writhing this from the latest RR ROM with F2FS partitions 100% Stable and lightning fast. Just use your favorite ROM instead of LOS in step 3.
[ZTE Axon 7 Themes, Apps, and Mods] troy5890:
Wait so let me get this straight, do we have to flash the universal bootloader if we came from stock nougat(B25)?
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
LOS ROMs check for the TrustZone in your bootstack, so it is possible that you will need to flash the universal (old) bootstack if you come from a newer one. I haven't tested it, but the possibility is there, so to be sure flashing a proven bootstack is the safe way.
[ZTE Axon 7 Themes, Apps, and Mods] troy5890:
I see, thanks for telling me because I plan on going to LOS soon from the B25 update. No one told me I had to flash the universal bootloader if I wanted to go to custom roms.
[ZTE Axon 7 Themes, Apps, and Mods] piet8stevens:
Is it correct that f2fs does not play well with an encrypted data partition? Does anyone have any experience in this matter (good or bad)?
[ZTE Axon 7 Themes, Apps, and Mods] voetbalremco:
Recently did the migration to f2fs and can confirm, it breaks encryption.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
It depends on your setup. I am now on Resurrection Remix Oreo + Hellsgate Oreo Kernel and I have my phone encrypted while enjoying F2FS filesystem in Data and Cache partitions. See the phone info page screenshot attached.
[ZTE Axon 7 Themes, Apps, and Mods] EBeatFLA:
Wow, completed this without a hitch, following the OP. Great guide, this is a must do for this device. Improvements were very noticeable before even looking at the stats.
[ZTE Axon 7 Themes, Apps, and Mods] dwnoel:
migration from O-AEX + hellgate 2.2

many thanks [MENTION=319057]Oki[/MENTION] for this thread; perf & battery improvements look great :)

I've just read the OP, and just wondering :

- do we need specifically to use twrp 3.0.3/4; or we can stay with 3.1.2-7 for example ?

- reading the intro, it's clear that improvements are more for data/int storage, and cache; but I don't see much commands that concern cache partition in the INSTALL section. Is it because cache depends of internal storage that it will be well impacted by the migration

- after restoring data and internal (steps 6/7), do we will still need to reinstall apps & launcher etc afterwards? (I have the feeling that NO reading the posts here; but I remember a comment under Hellgate thread saying we have to)

many thanks
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
- The latest TWRP the better. TWRP 3.1.2-7 is good to go. TWRP 3.0.3 was the minimum with proper F2FS support.

- Cache partition needs to be formatted too. it should have been in step 3. I have modified that details. Thanks for catching it! Cache partition can be migrated to F2FS at any time without losing data.

- No need to reinstall anything since you are not doing a clean install. If you have recovered your data and internal SD, then everything should be the same. You can only face the problem with the locksettings, but the link on how to fix it was already in the guide.
[ZTE Axon 7 Themes, Apps, and Mods] Zobat:
Hi, Maybe it is a stupid question, but if we do a nandroid-backup before we start this procedure, cant we just restore the data partion from our nandroid backup to get /data back?

edit: ofcourse your twrpbackup should be on external sdcard

regards
[ZTE Axon 7 Themes, Apps, and Mods] dwnoel:
Did it! Everything went well, painless with only cache partition ?

Just notice that Magisk now requires systemless host parameters to allow adblock working (might be link to an other recent update too, like Hellgate 2.2??)
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
The problem is that the internal sd is inside the Data partition and a nandroid backup can't do a backup of it. If you want to keep the contents of the internal sd then you have to create a backup somewhere else, in the external sd or in a computer. This is why it is so complicated.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Flashing the kernel overwrites Magisk. So, Magisk has to be reflashed after every kernel upgrade. For sure it is not related to the F2FS migration.

Having only cache partition under F2FS will not provide all the benefits. Having Data and internal storage too provides the real F2FS experience.
[ZTE Axon 7 Themes, Apps, and Mods] Kingo64:
Just followed the guide and the results are night and day. I'm actually amazed this runs so well. Thank you!
[ZTE Axon 7 Themes, Apps, and Mods] dwnoel:
No it's fine: I forgot to mention that I had already data on f2fs (most probably from the beginning, didn't know! ). Thanks
[ZTE Axon 7 Themes, Apps, and Mods] GodOfPsychos:
[MENTION=319057]Oki[/MENTION] i followed the guide to step 5 and my system is stuck at boot (axon bootlogo with the photos). It doesn't get to the welcome wizard.

Using A2017G 1.2.0 B10 (only rooted, otherwise its completely stock)

Used TWRP 3.2.1-0

Could it be that it doesn't work on the latest stock rom?
[ZTE Axon 7 Themes, Apps, and Mods] GodOfPsychos:
Found the issue.

Cache partition seems to be the culprit. After reverting the cache partition format back to ext4, system boots just fine.

Having data in f2fs format is no problem at all

Edit: reverted data back to ext4 since supersu doesnt work on f2fs (says root undetected)
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
I updated the guide a couple days ago just to add the cache partition migration. I will add a note for those still in Nougat with the old stock ROM. I forgot that.

SuperSU is not the best root solution since Magisk solved the problems it had. Probably you could try using it. Nonetheless, I was using SuperSU long ago along with F2FS so it must be something else. Have you tried to upgrade the kernel?
[ZTE Axon 7 Themes, Apps, and Mods] GodOfPsychos:
I dont have any problems with using supersu.

I tried magisk 16.4 (which had at least working safetynet) in the last 2 days and it was nothing but pain with all its issues. First, the modules didnt want to install (some did install but were gone after reboot). Turns out it was because of data being in f2fs format. Then i installed the f2fs loopback workaround module which fixed the modules from disappearing. But one issue didnt get resolved. Magisk forgot which apps have requested root after reboot. So basically i had to re-allow root access to every single app that needs it, one by one, after every single reboot.

Some users on reddit had the same problem. One got the issue fixed by formatting data back to ext4 format. So i tried that. Clean flash the bootstack, rom and then magisk. The f2fs issues with disappearing modules were gone. But magisk still forgot all the apps it gave root acces to every reboot.

At that time i got tired of it and reverted back to using supersu.

And as for your question about the kernel: No, i can't upgrade the kernel since there are no custom kernels available for stock roms. Also 1.2.0 B10 is the latest stock rom for the A2017G. So i couldn't even experiment with a newer stock kernel
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Have you considered upgrading to an Oreo custom ROM? Many people consider this a better option, including me. So far there is only an issue when using both voice calls under dual SIM. SafetyNet passes, sound quality is perfect and you would enjoy Camera2 API. You must have a powerful reason to remain in stock Nougat.
[ZTE Axon 7 Themes, Apps, and Mods] GodOfPsychos:
Camera2api isnt fully there, yet. Most of the time its either legacy or limited mode. We would need level 3 camera 2 api implementation to get the most use out of our camera. And we probably would have got it with official Oreo from ZTE, but now it doesnt seem likely that we get it. On one thread i saw that someone got gcam hdr+ semi-working on frontcam with the RR Oreo rom but it was still far from stable. So in the end we don't have real camera2 implementation like everybody wants to.

Also im staying on stock because of the various issues many ppl have at the moment. There is always gonna be something that doesnt work correctly, i know that.

But the camera for example, doesn't have a working slow mo in some custom roms or something else from the camera doesnt work or there are issues with the inbuilt DAC (not all roms have the DAC issue tho).

I mean, everything on stock just works as i want it to. So there is currently no need for me to switch.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
No problem here with the DAC, HDR or stability. GCAM HDR is not working for me, nonetheless Snap Camera HDR paid app works pretty well using Camera2 API, including the different video modes.
[ZTE Axon 7 Themes, Apps, and Mods] Gachmuret:
What about recording quality? Most people chose A7 because of its playback quality but for me it was the superior sound recording quality (even from a distance) as I need it professionally... Is it as good as in stock in custom Oreo?
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Yes, mic uses the HiFi recording DAC. Recordings have amazing audio realism. The other day my boss was listening a video of an engineering test I recorded with my phone and he asked me about the recording equipment because he felt like if he was "there". Nonetheless audio has no relation to F2FS. You should ask questions about Oreo upgrades in this thread https://xdaforums.com/axon-7/how-to/guide-axon-7-custom-oreo-roms-newbies-t3786693/page3
[ZTE Axon 7 Themes, Apps, and Mods] reas0n:
okay, fast question, does aex 8.1 work with f2fs?
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Short Answer, Yes.
[ZTE Axon 7 Themes, Apps, and Mods] janthe6th:
hi if I set up everything as new and I don't have anything in the phone needed backup, I only need to follow up to step 5 right?
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
If you do not want to keep anything from your data partition or internal storage then head straight to steps 3 and 4. After step 4 you can begin flashing any rom as usual.
[ZTE Axon 7 Themes, Apps, and Mods] janthe6th:
What I did was I was following your RR install guide up to this F2FS step so I already have the RR rom installed. For this F2FS procedure I followed from beginning and backed up files to computer thinking when I wipe, the ROM will also be wiped. But as I go along I stopped at step 5 after rebooting to system just fine. I just want to make sure that it's ok? Is there a way to check if the procedure is successful?
[ZTE Axon 7 Themes, Apps, and Mods] GodOfPsychos:
The rom only gets wiped when you wipe /system. This tutorial is just talking about /data and /cache partitions. The data partition only holds your stuff you installed (like apps from play store etc). Therefore its important to make a backup of data so you can restore all that instead of having to manually install every app one by one and configure them again.

After reformatting data and cache to f2fs you can install an app called "Diskinfo" and check the data and cache partition to see if it was successful in the end. If it was, it should say they are in f2fs format.
[ZTE Axon 7 Themes, Apps, and Mods] janthe6th:
Thanks! Sounds like I'm ok stopping at step 5 then. Downloaded diskinfo and my Data is f2fs but Cache is ext4. Did I miss something?

Edit: nvm I forgot to do Cache...does it really matter? do I need to wipe data again to format f2fs?
[ZTE Axon 7 Themes, Apps, and Mods] baconboy:
I just found out my cache is still EXT4 too (and my ex SD card is Vfat???) so I'd like to know this too
[ZTE Axon 7 Themes, Apps, and Mods] GodOfPsychos:
No you don't have to do anything to the data partition anymore.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Just redo step 3 but formatting only cache partition.
[ZTE Axon 7 Themes, Apps, and Mods] janthe6th:
Hmm I tried multiple times with the cache but after reboot it change back to ext4. I made sure the rm -rf is checked. Weird

Also diskinfo reporting external storage 6gb being ext4 as well. I don't have an SD card.
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
What rom are you using? The stock rom will format cache to ext4 no matter what filesystem you format it. Only AOSP ROMs are using f2fs filesystem in the cache partition.
[ZTE Axon 7 Themes, Apps, and Mods] janthe6th:
RR 20180511 Oreo
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Just a quick experiment, please open TWRP change filesystem of cache to f2fs, the once done reboot to recovery again without booting into system. What filesystem is reported in TWRP? You can see it in the change filesystem menu.
[ZTE Axon 7 Themes, Apps, and Mods] janthe6th:
Right after swipe right to confirm changing cache to f2fs, I press back button and still see the system listed as ext4. After reboot to recovery still same
[ZTE Axon 7 Themes, Apps, and Mods] Oki:
Try reflashing recovery. There must be a problem in yours. There shouldn't be any problem formatting the partition.
[ZTE Axon 7 Themes, Apps, and Mods] Tunox:
The Solution is to uncheck rm -rf Box, then change the cache Partition to f2fs, then again check the rm -rf Box and reboot to Recovery and Checkout, if it works for you also.

For me it works this way.