Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,813,143 Members 54,038 Now Online
XDA Developers Android and Mobile Development Forum

[HOWTO] Changing Filesystem to F2FS on the Sprint S4

Tip us?
 
AlkaliV2
Old
(Last edited by AlkaliV2; 12th May 2014 at 06:47 PM.) Reason: Major revision to the guide
#1  
Senior Member - OP
Thanks Meter 374
Posts: 340
Join Date: Jun 2012
Location: Charlotte
Default [HOWTO] Changing Filesystem to F2FS on the Sprint S4

This guide is for the Sprint Galaxy S4 only and as of now it is only compatible with two kernels: KToonsez S4 Kernel 4.4 AOSP (4/17 or later) and PoKernel 1.7 F2FS ONLY Build. This guide CANNOT be used on Touchwiz or Android 4.3 yet. I will update it when and if that becomes possible
*Disclaimer: You are doing this to your phone under your own consent. This is an experimental procedure and may not work on some hardware revisions or on devices where certain conditions are not met. You assume all the risk by flashing any of the software below or changing your filesystems. I am not responsible if your phone does not work based on the method I am describing below. Modify at your own risk.

This guide had to be updated in order to correct misinformation. The guide will follow KT's instructions explicitly until it gets to the formatting of the system partition

***If you want to format your /system partition to F2FS please read that section first as it requires steps to be taken from your currently working AOSP rom!
***



First, go this link download the file:TWRP-KT.ALL-IN-1.zip
http://goo.gl/HLz4al


Formatting Data and Cache to F2FS
NOTE: Follow these steps EXACTLY, do NOT add or remove any steps, period!!!!

1. Backup everything from your internal SD to your PC or external SD, since the entire internal SD is going to get wiped out with format!!!!!!!!!!
2. Download the files from the folder that you got these instructions from (Ignore the OLD WAY folder) and SAVE TO THE EXTERNAL SD!!!
3. ONLY DO THIS STEP IF YOU ARE ON AN OLD VERSION OF MY TWRP. Flash TWRP-KT.ALL-IN-1.zip (this is what gives us the ability to format using F2FS)
4. Reboot recovery
5. Go to "Settings" and check the box to force F2FS for data and cache (you can also check the box to include /system partition if you want to convert your ROM's zip to use that too)
6. Go to "Wipe->Advanced" option and wipe the "Cache" partiton
7. Go to "Wipe->Format Data" option (THIS WIPES YOUR ENTIRE INTERNAL SD CARD, all files and folders, all gone so make a backup to your external SD or PC!!!!!!!!!!!!!)
8. This step you have 2 choices:
A. Flash your ROM/gapps to start completely fresh
B. Go to restore option and ONLY restore your "Data" (you can also restore /system if you are doing the f2fs conversion on /system partition too)
9. ONLY DO THIS STEP IF YOU INSTALLED A NEW ROM. Flash my newest kernel (needs to be a kernel dated 05.05.2014 or newer)
10. DONE!!!!!!!!!!!!!
11. KTweaker has a new option under "Tools" screen to "Get Partition info" to double check your work.

Formatting System Partition with F2FS (Required: KT SGS4 Kernel 4/28 or later!)
Steps:
1.) Before doing any F2FS conversion with the above instructions, use your currently working AOSP ROM to grab the AOSP 4.4 Kernel from HERE (4/28 or later only!) and save it to your external memory card
2.) Once it is saved reboot to recovery and install it (Flashing a kernel in TWRP is Install -> Folder where kernel is -> Click KT 4/28 kernel -> Swipe to install -> Clear cache/dalvik -> Main menu -> click advanced -> Fix Permissions -> Reboot to system)
3.) After you are back in your working AOSP ROM with KT 4/28 kernel installed, download the AOSP rom you want to use and save it to your external sd card (You can leave the filename as it is, the program will rename it for you)
4.) Open KTweaker and click "Tools" and at the very bottom choose "F2FS: Convert ROM ZIP"
5.) It will ask you to locate the file, ask if you're sure, and then it will do the conversion; upon completion the zip file that was created will have "-F2FS.zip" at the end of it
6.) Now you can follow the steps above, but when you get to step 9A you will use the "-F2FS.zip" file instead of the standard ROM file

This procedure is necessary because KTweaker changes your favorite ROM to pass the command mkfs.f2fs so that your system partition is formatted to F2FS before the files are installed. I did this myself to verify and it works a treat. One crucial step to remember though is that after you install your F2FS converted ROM you absolutely must install KT's kernel so your phone will boot.

Returning to EXT4
NOTE: Follow these steps EXACTLY, do NOT add or remove any steps, period!!!!

1. Backup everything from your internal SD to your PC or external SD, since the entire internal SD is going to get wiped out with format!!!!!!!!!!
2. Download the files from the folder that you got these instructions from (Ignore the OLD WAY folder) and SAVE TO THE EXTERNAL SD!!!
3. ONLY DO THIS STEP IF YOU ARE ON AN OLD VERSION OF MY TWRP. Flash TWRP-KT.ALL-IN-1.zip (this is what gives us the ability to format using F2FS)
4. Reboot recovery
5. Go to "Settings" and uncheck the box to force F2FS for data and cache (If you checked the box to include /system partition uncheck it first)
6. Go to "Wipe->Advanced" option and wipe the "Cache" partiton
7. Go to "Wipe->Format Data" option (THIS WIPES YOUR ENTIRE INTERNAL SD CARD, all files and folders, all gone so make a backup to your external SD or PC!!!!!!!!!!!!!)
8. This step you have 2 choices:
A. Flash your ROM/gapps to start completely fresh
B. Go to restore option and ONLY restore your "Data" (you can also restore /system if you are doing the f2fs conversion on /system partition too)
9. ONLY DO THIS STEP IF YOU INSTALLED A NEW ROM. Flash my newest kernel (needs to be a kernel dated 05.05.2014 or newer)
10. DONE!!!!!!!!!!!!!
11. KTweaker has a new option under "Tools" screen to "Get Partition info" to double check your work.

FAQ
Q: Why can't I use this on Touchwiz?
A: It has been developed for the most recent Linux kernel 3.8 and has been implemented in kernels built for 4.4.x OSP builds. This isn't to say it cannot be used on Touchwiz, it is a filesystem and as long as there is a kernel that offers support for reading it installed on your device it should theoretically work on your hardware. However, this can be proven/disproven by the devs here and I will update this answer if it cannot be implemented in a backwards fashion.

Q: Are there advantages to using F2FS?
A: It is built and intended for use on flash filesystems which our devices run exclusively. So since it was developed for flash memory there will be a benefit to using it as it matures. However, this does not imply that benchmarks will increase or your whole phone will become more responsive, its intent is to have files be accessed and written more efficiently. It is supposedly also built for the long-term user who does not constantly reformat their devices because it is supposed to handle large amounts of old files and cleaning more effectively that EXT4. Source: https://www.kernel.org/doc/Documenta...stems/f2fs.txt

Q: Will this trip Knox?
A: No more than installing a custom recovery would. So if you already had a custom recovery (Read: TWRP, PhilZ, CWM) in place you are safe following this guide. For now of course; I do not know if there will be another iteration of Samsung software that locks down the device futher.

Q: Can I clear Cache and Dalvik to troubleshoot after changing my filesystem?
A: I tried this myself and the answer is yes. As long as you are using the F2FS custom recovery made by KToonsez you can wipe Cache and Dalvik from recovery and it will rebuild your system. Something I did notice is that first boot will stay on the splash screen longer with F2FS than with EXT4. I saw it hang on the splash screen of my Liquid rom for an extra minute before actually booting and showing cache rebuild. **Your Mileage May Vary**

Q: Why isn't the System Partition formatted into F2FS?
A: This can be done now with KTweaker. See section above.

Q: What ROMs can I use with this filesystem?
A: Any 4.4.x rom (most are 4.4.2 now) that is compatible with either KToonsez S4 AOSP kernel or Pokernel 1.7 F2FS Only.

Q: In Advanced Wipe, Preload has been added to the options of things to wipe. Should I?
A: Ktoonsez answer found HERE was that he has never wiped preload. So I suggest against it unless you know what you are doing.

Thanks
Linux, Google, and Samsung (all this neat stuff comes from those communities)
TWRP Team for their custom recovery and its updates
Ktoonsez for his awesome kernel and the modified recoveries
CPA Poke for his awesome kernel that has F2FS support baked in
LuigiBull23 for edits and reminding me to add content
XDA for giving us a place to host experimental phone procedures
The XDA Devs for all the work they do for us with their time
The XDA community for providing feedback and making this a great place to hang out
If I forgot anyone specifically please let me know and I will update this section or any section

Enjoy and let us know how it works on your device!
The Following 11 Users Say Thank You to AlkaliV2 For This Useful Post: [ Click to Expand ]
 
LuigiBull23
Old
(Last edited by LuigiBull23; 24th April 2014 at 11:19 PM.)
#2  
LuigiBull23's Avatar
Recognized Contributor
Thanks Meter 5,399
Posts: 5,579
Join Date: Jan 2013
Location: Holyoke

 
DONATE TO ME
Great guide my friend!


 
Quote:
ROM: Liquidsmooth v3.0 (Nightly 3/13) ~ LiquidSmooth [Q&A/T]
Kernel: KT-SGS4 ~ Ktweaker Shop / Ktweaker User Guide
Radio: MDL
Recovery: TWRP 2.6.3.0
Mods: Xposed + Greenify + Project Comatose - Rebirthing profile
Andriod Terminology / Development Guide
The Following 3 Users Say Thank You to LuigiBull23 For This Useful Post: [ Click to Expand ]
 
AlkaliV2
Old
(Last edited by AlkaliV2; 25th April 2014 at 12:02 AM.)
#3  
Senior Member - OP
Thanks Meter 374
Posts: 340
Join Date: Jun 2012
Location: Charlotte
delete
 
mr.toyou
Old
#4  
Junior Member
Thanks Meter 2
Posts: 21
Join Date: Apr 2014
Thanx great guide

Sent from my SPH-L720 using XDA Premium 4 mobile app
The Following User Says Thank You to mr.toyou For This Useful Post: [ Click to Expand ]
 
Mistertac
Old
#5  
Mistertac's Avatar
Senior Member
Thanks Meter 1,599
Posts: 3,413
Join Date: Oct 2013
Location: Springfield, Ma

 
DONATE TO ME
Great guide OP! Always nice to have a thread to link to.
I'm sure it's been talked about but your posts doesn't mention the ramdisk files. They're listed but not talked about. Now I'm somewhat limited myself in understanding everything there is to know about these things but are those files to do with eventually formatting the system partition to f2fs?

May be worth putting a little note in there regarding those files... You know how some folks go flash crazy once in recovery lol

Sent from my SCH-I545 using Tapatalk
The Following User Says Thank You to Mistertac For This Useful Post: [ Click to Expand ]
 
LuigiBull23
Old
(Last edited by LuigiBull23; 30th April 2014 at 01:56 PM.)
#6  
LuigiBull23's Avatar
Recognized Contributor
Thanks Meter 5,399
Posts: 5,579
Join Date: Jan 2013
Location: Holyoke

 
DONATE TO ME
Quote:
Originally Posted by Mistertac View Post
Great guide OP! Always nice to have a thread to link to.
I'm sure it's been talked about but your posts doesn't mention the ramdisk files. They're listed but not talked about. Now I'm somewhat limited myself in understanding everything there is to know about these things but are those files to do with eventually formatting the system partition to f2fs?

May be worth putting a little note in there regarding those files... You know how some folks go flash crazy once in recovery lol

Sent from my SCH-I545 using Tapatalk
Hello again.. Lol

The ramdisk mod is now obsolete as it's already included in the kernel zip, which will automatically determine whether you're still on EXT4 or F2FS and make the required changes to the ramdisk accordingly. So no need to flash anything but the kernel as usual after following the steps.


 
Quote:
ROM: Liquidsmooth v3.0 (Nightly 3/13) ~ LiquidSmooth [Q&A/T]
Kernel: KT-SGS4 ~ Ktweaker Shop / Ktweaker User Guide
Radio: MDL
Recovery: TWRP 2.6.3.0
Mods: Xposed + Greenify + Project Comatose - Rebirthing profile
Andriod Terminology / Development Guide
The Following 3 Users Say Thank You to LuigiBull23 For This Useful Post: [ Click to Expand ]
 
Mistertac
Old
#7  
Mistertac's Avatar
Senior Member
Thanks Meter 1,599
Posts: 3,413
Join Date: Oct 2013
Location: Springfield, Ma

 
DONATE TO ME
OK yea I figured it was either to do with what I said or to do with the kernel obviously. Just figured I'd ask anyways

Sent from my SCH-I545 using Tapatalk
 
AlkaliV2
Old
(Last edited by AlkaliV2; 30th April 2014 at 09:02 PM.)
#8  
Senior Member - OP
Thanks Meter 374
Posts: 340
Join Date: Jun 2012
Location: Charlotte
I'll be the first to admit that I wasn't entirely sure what the ramdisk files were for. I knew they might have been for advanced users considering they were offered, but not listed in the instructions. I didn't know for sure and I didn't want to use the word "obsolete" because, well, I was so wrong before

I am glad LuigiBull23 jumped in and answered that for us. I'll get it added into the the guide so future users know what they are or are not used for. Keep the questions coming, I love learning about this stuff!
The Following 2 Users Say Thank You to AlkaliV2 For This Useful Post: [ Click to Expand ]
 
LuigiBull23
Old
#9  
LuigiBull23's Avatar
Recognized Contributor
Thanks Meter 5,399
Posts: 5,579
Join Date: Jan 2013
Location: Holyoke

 
DONATE TO ME
Quote:
I'll be the first to admit that I wasn't entirely sure what the ramdisk files were for. I knew they might have been for advanced users considering they were offered, but not listed in the instructions. I didn't know for sure and I didn't want to use the word "obsolete" because, well, I was so wrong before

I am glad LuigiBull23 jumped in and answered that for us. I'll get it added into the the guide so future users know what they are or are not used for. Keep the questions coming, I love learning about this stuff!
I understand. A lot of people were and still are confused about these files..

In short, during the testing phases of F2FS, KT compiled a separate zip for changes to the ramdisk that in turn would reflect the EXT4/F2FS mount points as a means to avoid possible bootloops and such. It was indeed a success and as a result was included in his kernel.

Now, upon flashing the kernel it is able to determine which partitions are formatted as EXT4 or F2FS and mod the ramdisk accordingly. He only left the files on his server in case he ever needed them again. So they are most definitely OBSOLETE. You certainly wouldn't have gone wrong using the term in this case.


 
Quote:
ROM: Liquidsmooth v3.0 (Nightly 3/13) ~ LiquidSmooth [Q&A/T]
Kernel: KT-SGS4 ~ Ktweaker Shop / Ktweaker User Guide
Radio: MDL
Recovery: TWRP 2.6.3.0
Mods: Xposed + Greenify + Project Comatose - Rebirthing profile
Andriod Terminology / Development Guide
The Following User Says Thank You to LuigiBull23 For This Useful Post: [ Click to Expand ]
 
AlkaliV2
Old
#10  
Senior Member - OP
Thanks Meter 374
Posts: 340
Join Date: Jun 2012
Location: Charlotte
Updated the guide for KT's new all-in-one TWRP recovery that will allow you to switch back and forth between F2FS and EXT4. I used his exact instructions from his guide in all areas except for the system formatting section which I wrote. If you are using his custom TWRP recovery go ahead and grab the new one so you can use it in the future!

The Following User Says Thank You to AlkaliV2 For This Useful Post: [ Click to Expand ]
Tags
f2fs, faq, filesystem, guide, howto
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes