[UNOFFICIAL] [07/19] TWRP 3.1.1 with F2FS support

Search This thread

nathanchance

Senior Recognized Developer / Contributor
Jul 22, 2015
13,758
50,047
28
Mesa, AZ
nathanchance.dev
Introduction

Hello all, this is my version of TWRP for the Nexus 6P, which includes the ability to convert your /data and /cache partitions to F2FS. This will stay inline with TWRP's changes for the most part, the changes will be listed below.

What in the world is F2FS?

From Wikipedia:

F2FS (Flash-Friendly File System) is a flash file system initially developed by Samsung Electronics for the Linux kernel.

The motive for F2FS was to build a file system that, from the start, takes into account the characteristics of NAND flash memory-based storage devices (such as solid-state disks, eMMC, and SD cards), which are widely used in computer systems ranging from mobile devices to servers.

F2FS was designed on a basis of a log-structured file system approach, which it adapted to newer forms of storage. Jaegeuk Kim, the principal F2FS author, has stated that it remedies some known issues of the older log-structured file systems, such as the snowball effect of wandering trees and high cleaning overhead. In addition, since a NAND-based storage device shows different characteristics according to its internal geometry or flash memory management scheme (such as the Flash Translation Layer or FTL), it supports various parameters not only for configuring on-disk layout, but also for selecting allocation and cleaning algorithms.
Before diving into this, I would recommend reading the official F2FS documentation to understand why this may be good for you. This is potentially unstable, F2FS is a file system that is very much in active development. There is a reason that most OEMs go with ext4 out of the box. But I digress, I am NOT here to sell you on F2FS; it makes zero difference to me if you use it or not, I am merely providing you with a tool to do so.


Changelog + differences

Differences:
  • f2fs-tools bumped to 1.7.0 (Omni's 6.0 branch is on 1.4.0)
  • TWRP app installation offer disabled by default


Conversion procedure

  1. Download TWRP from the link above
  2. Grab a kernel that supports F2FS (I use my own as I know it works)
  3. Back up any important data as this will wipe your entire internal storage
  4. Boot into the bootloader and flash the recovery
  5. Boot into TWRP and go into Wipe > Advanced Wipe
  6. Select Data and then hit "Change or Repair File System"
  7. Hit Change File System
  8. Choose F2FS and slide to confirm
  9. Repeat the previous three steps for cache
  10. Reboot and move all of your files back over (if restoring through TWRP, make sure to check the option to use rm -rf instead of formatting)
If you have any issues with this, you may need to ask your ROM developer to merge the two commits below.

Bug reports

You are NOT in ANY circumstance to report ANY bugs to the TWRP team.

  • If you have an issue with flashing something in TWRP, copy the recovery log to your sdcard and post it here.
  • If swapping to F2FS does not stick, try formatting your data with TWRP (Wipe > Format Data) or fastboot format userdata first.
  • If your phone does not boot after swapping to F2FS, either your kernel or ROM does not have proper support; post in their thread.
Additionally, check out some of these helpful posts:


Adding support to ROM

In order to properly support the initial conversion to F2FS, please add these two commits to your source:
https://github.com/omnirom/android_system_core/commit/1c6700a8fb31c6e314df4f031fa23fa9178c7ca7
https://github.com/omnirom/android_system_vold/commit/c879edb2fecae709f404c2d71c1d47ceac3a325e

The reason some people have issues converting is fs_mgr will try to read the block device as ext4 and destroy the f2fs block. This commit skips that check, allowing F2FS to pass through.

Sources

TWRP is licensed under GPLv3, meaning my changes must be disclosed. I also inline a custom kernel so that source is included as well. I also add in the other repos I modify.

 

Attachments

  • twrp-3.1.1-13-angler-f2fs-20170719.img
    18.4 MB · Views: 455
  • twrp-3.1.1-10-angler-f2fs-20170528.img
    18 MB · Views: 50
  • twrp-3.1.1-11-angler-f2fs-20170612.img
    19 MB · Views: 32
  • twrp-3.1.1-11-angler-f2fs-20170704.img
    18.6 MB · Views: 32
  • twrp-3.1.1-12-angler-f2fs-20170704.img
    18.6 MB · Views: 83
Last edited:

NoobInToto

Senior Member
Dec 4, 2013
856
246
Coimbatore
First! :p
Thanks for the recovery. Been using it with flash kernel. I see considerable performance improvement in asphalt Xtreme game( idk if its the f2fs or kernel ).
 
  • Like
Reactions: nathanchance

radjad

Senior Member
Jul 21, 2013
56
24
Thank you, and thank you for the exemplary GPL compliance. It's noticed and appreciated.
 

ariefabuzaky

Senior Member
Dec 19, 2013
1,778
423
36
So what rom is compatible with f2fs ?
Lineage : yes
RR : yes
UberRom : of course
pN : idk
DU : idk
Nitrogen : yes
Somebody must report it and i will update my post.
ThNks
 
Last edited:
  • Like
Reactions: Jammol and nardow

jochem86

Senior Member
Oct 24, 2013
373
120
Amsterdam
So what rom is compatible with f2fs ?
Lineage : yes
RR : yes
UberRom : of course
pN : idk
DU : idk
Somebody must report it and i will update my post.
ThNks

Nitrogen should also work but i am doing something wrong... PN should only work with data to f2fs... i am trying different ways right now.

I restored everything to ext4 but i get bootloops now with everyrom... reboots constand... damnit

restored my twrp to latest 3.0.3 but i still get bootlooping... whay did i wrong :S Going back to complete stock latest google image... can anoyone tell me what i did wrong here?!

Restoring factory worked... back on 3.0.3 twrp and with PN rom installed. I will wait a couple of days on how to get it working properly on PN :p
 
Last edited:

bsg411

Senior Member
Nov 23, 2007
1,517
288
Google Pixel 4 XL
I tried this with PN and am now stuck in a boot loop. I flashed the twrp with F2FS support then tried to change the file system followed by installing the latest vendor, latest flashable bootloader+radio, latest pure nexus and gapps, flash kernel, and latest su. Didnt work. Im not stuck in a boot loop I cant get out of. Ive tried every combination of the above. I also tried restoring my backup but that gives me an error. I also tried changing the file system back to ext4. Nothing works. Anyone experience this or have any suggestions?

---------- Post added at 09:09 AM ---------- Previous post was at 08:58 AM ----------

Nitrogen should also work but i am doing something wrong... PN should only work with data to f2fs... i am trying different ways right now.

I restored everything to ext4 but i get bootloops now with everyrom... reboots constand... damnit

restored my twrp to latest 3.0.3 but i still get bootlooping... whay did i wrong :S Going back to complete stock latest google image... can anoyone tell me what i did wrong here?!

Restoring factory worked... back on 3.0.3 twrp and with PN rom installed. I will wait a couple of days on how to get it working properly on PN :p

Im in the same boat.....what steps did you do to get back to stock?
 

minhgi

Senior Member
Back then when I was using Temasek on my Note 3, he incorporate a script that automatically format the system partition to F2FS when flashing his ROM. That is if the system partition is already in f2fs and I think that was pretty amazing but short live. I wonder if other ROM developer could go the same route if formatting F2FS system was popular enough. That would make updating new rom one step easier. Just for thought.

---------- Post added at 09:38 AM ---------- Previous post was at 09:16 AM ----------

Hi All,

Make sure to restore your backup with "Use rm -rf instead of formating"; else the restore will reformat the partition back to the file system use in the backup.
 
  • Like
Reactions: 4930
I

Iceburn1

Guest
Because that's what's happening to me. Maybe it's because I'm on PN. At this time f2fs has not been widely adopted by too many devs so compatibility could be an issue. I think I'll stick with ext4 a bit until f2fs is fully mature.

That's too bad its not working for you, its working on my side no problem, did you format in twrp if its not sticking? Im on RR with Flash kernel.
 

Attachments

  • Screenshot_2017-01-23-10-46-06.png
    Screenshot_2017-01-23-10-46-06.png
    110.2 KB · Views: 762
  • Screenshot_2017-01-23-10-46-00.png
    Screenshot_2017-01-23-10-46-00.png
    109.9 KB · Views: 757
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 67
    Introduction

    Hello all, this is my version of TWRP for the Nexus 6P, which includes the ability to convert your /data and /cache partitions to F2FS. This will stay inline with TWRP's changes for the most part, the changes will be listed below.

    What in the world is F2FS?

    From Wikipedia:

    F2FS (Flash-Friendly File System) is a flash file system initially developed by Samsung Electronics for the Linux kernel.

    The motive for F2FS was to build a file system that, from the start, takes into account the characteristics of NAND flash memory-based storage devices (such as solid-state disks, eMMC, and SD cards), which are widely used in computer systems ranging from mobile devices to servers.

    F2FS was designed on a basis of a log-structured file system approach, which it adapted to newer forms of storage. Jaegeuk Kim, the principal F2FS author, has stated that it remedies some known issues of the older log-structured file systems, such as the snowball effect of wandering trees and high cleaning overhead. In addition, since a NAND-based storage device shows different characteristics according to its internal geometry or flash memory management scheme (such as the Flash Translation Layer or FTL), it supports various parameters not only for configuring on-disk layout, but also for selecting allocation and cleaning algorithms.
    Before diving into this, I would recommend reading the official F2FS documentation to understand why this may be good for you. This is potentially unstable, F2FS is a file system that is very much in active development. There is a reason that most OEMs go with ext4 out of the box. But I digress, I am NOT here to sell you on F2FS; it makes zero difference to me if you use it or not, I am merely providing you with a tool to do so.


    Changelog + differences

    Differences:
    • f2fs-tools bumped to 1.7.0 (Omni's 6.0 branch is on 1.4.0)
    • TWRP app installation offer disabled by default


    Conversion procedure

    1. Download TWRP from the link above
    2. Grab a kernel that supports F2FS (I use my own as I know it works)
    3. Back up any important data as this will wipe your entire internal storage
    4. Boot into the bootloader and flash the recovery
    5. Boot into TWRP and go into Wipe > Advanced Wipe
    6. Select Data and then hit "Change or Repair File System"
    7. Hit Change File System
    8. Choose F2FS and slide to confirm
    9. Repeat the previous three steps for cache
    10. Reboot and move all of your files back over (if restoring through TWRP, make sure to check the option to use rm -rf instead of formatting)
    If you have any issues with this, you may need to ask your ROM developer to merge the two commits below.

    Bug reports

    You are NOT in ANY circumstance to report ANY bugs to the TWRP team.

    • If you have an issue with flashing something in TWRP, copy the recovery log to your sdcard and post it here.
    • If swapping to F2FS does not stick, try formatting your data with TWRP (Wipe > Format Data) or fastboot format userdata first.
    • If your phone does not boot after swapping to F2FS, either your kernel or ROM does not have proper support; post in their thread.
    Additionally, check out some of these helpful posts:


    Adding support to ROM

    In order to properly support the initial conversion to F2FS, please add these two commits to your source:
    https://github.com/omnirom/android_system_core/commit/1c6700a8fb31c6e314df4f031fa23fa9178c7ca7
    https://github.com/omnirom/android_system_vold/commit/c879edb2fecae709f404c2d71c1d47ceac3a325e

    The reason some people have issues converting is fs_mgr will try to read the block device as ext4 and destroy the f2fs block. This commit skips that check, allowing F2FS to pass through.

    Sources

    TWRP is licensed under GPLv3, meaning my changes must be disclosed. I also inline a custom kernel so that source is included as well. I also add in the other repos I modify.

    33
    Version 3.1.1-8 now available!

    Image: http://nchancellor.net/Downloads/TWRP/angler/twrp-3.1.1-8-angler-f2fs-20170512.img
    MD5: http://nchancellor.net/Downloads/TWRP/angler/twrp-3.1.1-8-angler-f2fs-20170512.img.md5sum

    Changelog:
    Code:
    805a5dfe 3.1.1
    0afc1fdc Fix reboot when no OS is present
    84d61ce3 Update TWRP to AOSP 7.1.2
    6355b56c Adopted Storage: backup keys but do not wipe them
    b5ecaad2 ADB Backup: fix adb restore issues
    26
    Update!

    Bumped to version 10, with the following changelog:
    • Updated to the latest Flash Kernel, which has several f2fs, ext4, and dm block commits
    • Update decryption libs to latest N image
    • Removed SuperSU from recovery ramdisk
    • Fixed backlight dimming issue

    Downloads

    Image: http://nchancellor.net/Downloads/TWRP/angler/twrp-3.1.1-10-angler-f2fs-20170527.img
    Checksum: http://nchancellor.net/Downloads/TWRP/angler/twrp-3.1.1-10-angler-f2fs-20170527.img.md5sum
    26
    Alright guys, new build is up. This should be much more stable than it was since it's built off of Omni's 6.0 branch (thank you so much to @jcadduono for pointing me in the right direction). Here's what's been tested and verified working:
    • F2FS tools (1.7.0, both make.f2fs (log) and fsck.f2fs (log) work fine for me)
    • The Nethunter kernel zip @t83wood had issues with flashing (log)
    • ElementalX zip (log, boot fine for me on Pure Nexus)
    • Encryption (decrypts with or without the security enabled on boot option)

    Everything should be 100% good now, though if it isn't, I NEED a recovery.log (Advanced > Copy Log). Hope you all enjoy!

    @chevycam94, change the zips back to the previous way they were, we now have working Busybox :p
    20
    Update!

    Standard update, upstream fixes and such. The primary reason for this post is to notify you that your custom themes may or may not work, given the TWRP theme version has been bumped from 2 to 3. I know for a fact @z31s1g has some test themes for this here. Other than that, everything works perfect. Enjoy!