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

Search This thread

Relentless D

Senior Member
Jun 4, 2012
729
328
Chico, CA
What am I missing?

I was having a few issues with my phone so I wanted to head back to stock for a fresh start. Figured it would be a great time to try converting to f2fs.

I flashed the stock 7.1.2 image. Phone booted up fine, everything as expected.

Rebooted to bootloader and fastboot flashed modified twrp (3.1.0-7).

Went in to recovery, converted data and cache to f2fs

Rebooted back to recovery and verified file systems were still showing f2fs

Flashed latest purenexus (4/23), beans Gapps and latest flash kernel (verified all 3 checksums matched)

Bootloop.

I let it sit for 30 mins and it never boots.

Back to recovery and now data is showing as ext4?

I tried wiping, reflashing, etc... no go.

I converted cache back to ext4 but it still won't boot after reflashing the rom again.

The only way I can get this sucker booting right now is with a full stock image.

Am I missing something?
 
Last edited:

JRJ442

Senior Member
Jan 18, 2011
3,457
2,345
Salisbury, Md
What am I missing?

I was having a few issues with my phone so I wanted to head back to stock for a fresh start. Figured it would be a great time to try converting to f2fs.

I flashed the stock 7.1.2 image. Phone booted up fine, everything as expected.

Rebooted to bootloader and fastboot flashed modified twrp (3.1.0-7).

Went in to recovery, converted data and cache to f2fs

Rebooted back to recovery and verified file systems were still showing f2fs

Flashed latest purenexus (4/23), beans Gapps and latest flash kernel

Bootloop.

I let it sit for 30 mins and it never boots.

Back to recovery and now data is showing as ext4?

I tried wiping, reflashing, etc... no go.

I converted cache back to ext4 but it still won't boot after reflashing the rom again.

The only way I can get this sucker booting right now is with a full stock image.

Am I missing something?
Are you flashing SuperSU as well?
 
  • Like
Reactions: Relentless D

Relentless D

Senior Member
Jun 4, 2012
729
328
Chico, CA
Yeah I was gonna say be sure that's disabled. I'm out of ideas then.

I do appreciate you jumping in and trying to help me out though! : )

---------- Post added at 08:51 AM ---------- Previous post was at 08:36 AM ----------

What am I missing?

I was having a few issues with my phone so I wanted to head back to stock for a fresh start. Figured it would be a great time to try converting to f2fs.

I flashed the stock 7.1.2 image. Phone booted up fine, everything as expected.

Rebooted to bootloader and fastboot flashed modified twrp (3.1.0-7).

Went in to recovery, converted data and cache to f2fs

Rebooted back to recovery and verified file systems were still showing f2fs

Flashed latest purenexus (4/23), beans Gapps and latest flash kernel (verified all 3 checksums matched)

Bootloop.

I let it sit for 30 mins and it never boots.

Back to recovery and now data is showing as ext4?

I tried wiping, reflashing, etc... no go.

I converted cache back to ext4 but it still won't boot after reflashing the rom again.

The only way I can get this sucker booting right now is with a full stock image.

Am I missing something?

Got it working.

I noticed that after flashing when I went back into recovery and it was showing as ext4 again all the default android folders (ringtones, podcasts, etc...) were there. I did a format data in twrp, rebooted, change cache and data partitions back to f2fs, moved my files back over, flashed them and everything booted up as expected.

YMMV but I'm running now.
 
  • Like
Reactions: enormous and JRJ442

enormous

Senior Member
Feb 17, 2008
244
35
D.C. Area
I did a format data in twrp, rebooted, change cache and data partitions back to f2fs, moved my files back over, flashed them and everything booted up as expected.

The exact same thing was happening to me. This really helped. Thanks!

Now with bullet points:

  1. Flash TWRP with f2fs support
  2. Reboot recovery
  3. Format data in TWRP
  4. Reboot recovery
  5. Make changes to data and cache partition (switch to f2fs)
  6. Copy zip files back to device
  7. Flash PN, Gapps, Kernel, etc
  8. Reboot system
 
  • Like
Reactions: CyberpodS2

Az Biker

Senior Moderator / RC- RT Committee / Semper Salty
Staff member
What am I missing?

I was having a few issues with my phone so I wanted to head back to stock for a fresh start. Figured it would be a great time to try converting to f2fs.

I flashed the stock 7.1.2 image. Phone booted up fine, everything as expected.

Rebooted to bootloader and fastboot flashed modified twrp (3.1.0-7).

Went in to recovery, converted data and cache to f2fs

Rebooted back to recovery and verified file systems were still showing f2fs

Flashed latest purenexus (4/23), beans Gapps and latest flash kernel (verified all 3 checksums matched)

Bootloop.

I let it sit for 30 mins and it never boots.

Back to recovery and now data is showing as ext4?

I tried wiping, reflashing, etc... no go.

I converted cache back to ext4 but it still won't boot after reflashing the rom again.

The only way I can get this sucker booting right now is with a full stock image.

Am I missing something?

The only thing I see that you did diff than me is I just installed Flash's TWRP via flashing the image in TWRP.

Not sure if/ how that would make any diff, but I followed the same steps as you without any issues. I didn't flash Magisk until after I started setting up the phone.
 

Ozark_8125

Senior Member
Sep 19, 2007
1,155
346
Springfield, MO
Got it working.

I noticed that after flashing when I went back into recovery and it was showing as ext4 again all the default android folders (ringtones, podcasts, etc...) were there. I did a format data in twrp, rebooted, change cache and data partitions back to f2fs, moved my files back over, flashed them and everything booted up as expected.

YMMV but I'm running now.

If I'm reading you correctly, a clean flash is taking your data and/or cache back to a ext4 format. I know you're running now, that's great, but I'm guessing the only caveat is for folks clean installing is to convert data and cache to f2fs after flashing the rom (probably also rebooting to recovery after flashing rom / gapps / Su / kernel) and verifying data and cache are still in f2fs format. I got a warning message when restoring my ext4 data parition after changing to f2fs that my data was in ext4 format, but it booted up just fine (I ran a f2fs repair from twrp just to make sure it was ok before booting up into the rom the first time after restoring).
 
Last edited:
  • Like
Reactions: CyberpodS2

xflowy

Senior Member
Jun 4, 2011
1,708
199
Yeah I was gonna say be sure that's disabled. I'm out of ideas then.

I believe the poster was trying to say when you convert to f2fs, make sure "use rm -rf when formatting" isn't checked, so it does a proper format for the new file system, then check it back on before you wipe and flash to make sure it doesn't try to format and revert to ext4. But I've been wrong before...

Have a good one!

What's it with that option? What does it do? When i convert to f2fs for the first time, it should be off, right? But then i leave it enabled forever during flashing and wiping for new roms, for example?

Thanks much! :)
 

JRJ442

Senior Member
Jan 18, 2011
3,457
2,345
Salisbury, Md
What's it with that option? What does it do? When i convert to f2fs for the first time, it should be off, right? But then i leave it enabled forever during flashing and wiping for new roms, for example?

Thanks much! :)
The only time you need that option enabled is if you're restoring a data backup made in TWRP that was made while the file system was ext4. Otherwise it's not needed and has caused issues for some people causing data to revert back to ext4. So, unless you're restoring a backup that you made before you switched to f2fs, leave it off. It's not needed.
 
  • Like
Reactions: xflowy

drewski_1

Senior Member
Jul 20, 2012
3,828
1,602
SF Bay Area, CA
What's it with that option? What does it do? When i convert to f2fs for the first time, it should be off, right? But then i leave it enabled forever during flashing and wiping for new roms, for example?

Thanks much! :)

the post you quoted explained it.

when unchecked, wiping will physically format vs. the -rf will just recursively erase the files.

when you are restoring an Ext4 Nandroid to a F2FS partition, this unchecked can change the filesystem back to Ext4 so you need to check the box to just erase and preserve the F2FS formatting.
 
  • Like
Reactions: xflowy

trimeistr

Member
Apr 30, 2015
33
4
Can anyone confirm if encryption works with F2FS? If my device is encrypted and I do a clean flash, it goes into EXT4 during the boot. If I convert to F2FS while not being encrypted and clean flash it works, but as soon as I encrypt the device it refuses to boot again.
 

sp0rky

Member
Nov 30, 2011
45
2
I do appreciate you jumping in and trying to help me out though! : )

---------- Post added at 08:51 AM ---------- Previous post was at 08:36 AM ----------



Got it working.

I noticed that after flashing when I went back into recovery and it was showing as ext4 again all the default android folders (ringtones, podcasts, etc...) were there. I did a format data in twrp, rebooted, change cache and data partitions back to f2fs, moved my files back over, flashed them and everything booted up as expected.

YMMV but I'm running now.

I am having the same problem. Bootlooped.

So i went back to recovery. Wipe everything except internal storage. Then converted DATA and CACHE to F2FS.

Copied all the files while in TWRP.

Flash PN. GAPPS. Flash.

Reboot system. stuck in bootloop again.

I would rinse and repeat. Go back into recovery. Find that its back to ext4. changed it to F2FS and copied and reinstall everything... UGH!!!!
 

Relentless D

Senior Member
Jun 4, 2012
729
328
Chico, CA
Got it working.

I noticed that after flashing when I went back into recovery and it was showing as ext4 again all the default android folders (ringtones, podcasts, etc...) were there. I did a format data in twrp, rebooted, change cache and data partitions back to f2fs, moved my files back over, flashed them and everything booted up as expected.

YMMV but I'm running now.

I am having the same problem. Bootlooped.

So i went back to recovery. Wipe everything except internal storage. Then converted DATA and CACHE to F2FS.

Copied all the files while in TWRP.

Flash PN. GAPPS. Flash.

Reboot system. stuck in bootloop again.

I would rinse and repeat. Go back into recovery. Find that its back to ext4. changed it to F2FS and copied and reinstall everything... UGH!!!!

Did you try formatting data like in the post you quoted?
 

sp0rky

Member
Nov 30, 2011
45
2

Lucius1972

Senior Member
May 6, 2010
759
442
Can anyone confirm if encryption works with F2FS? If my device is encrypted and I do a clean flash, it goes into EXT4 during the boot. If I convert to F2FS while not being encrypted and clean flash it works, but as soon as I encrypt the device it refuses to boot again.
Converting to F2FS will remove the encryption possibility, it's a sacrifice you need to make but therefore you gain more speed and snappiness. Up to you to decide what's more important for you.
 

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!
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone