[Sprint Samsung Galaxy S 4 General] AlkaliV2:
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/Documentation/filesystems/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!