[Galaxy S 4 Mini Android Development] F4k:
[MOD][RECOVERY] All-F2FS for GT-I9190|GT-I9192|GT-I9195 [TWRP 2.8.6.0 & Philz Touch]

Hi!

Here I'll try to explain how to use F2FS partitions on your Galaxy S4 Mini.

This is for "All-F2FS" that mean that /system, /cache, /data and /external SD are formatted with F2FS, keep in mind that this can work only with a compatible kernel and ROM.

About F2FS

F2FS (Flash-Friendly File System) is a flash file system created by Kim Jaegeuk (Hangul: 김재극) at Samsung for the Linux operating system 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.

Samsung chose a log-structured file system approach, which it adapted to newer forms of storage. F2FS also remedies some known issues of the older log structured file systems, such as the snowball effect of wandering trees and high cleaning overhead. Because 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), Samsung also added various parameters not only for configuring on-disk layout, but also for selecting allocation and cleaning algorithms.

Warning

* You agree to use this MOD/Guide on you own risk and I don't take any responsability if you encounter any issue or if your personal data is lost

Requirements

Your S4 Mini, GT-I9190 or GT-I9195 or GT-I9192 (serrano3g, serranolte, serranods)

An external MicroSD card or a PC (for backup/restore)

Preinstalling Steps

Backup of your personal data to an external SD card or PC (photo, music, ringtones, etc).

Make a full nandroid (just in case that you want to rollback to EXT4) and copy to your PC.

Download and copy to your External SD Card TWRP or Philz Touch with full F2FS support. (Downloads on Second Post)

Download and copy to your External SD Card latest version of f4ktion kernel or use one with All-F2FS support.

Download and copy to your External SD Card CarbonROM with F2FS support, or you can test on your favorite ROM, take in mind that using F2FS on External SD Cards will require F2FS support on your ROM of minivold for vold managed volumes. (Downloads on Second Post)

How can you test your favorite ROM?

I'll include this time CarbonROM with support for F2FS, on upcoming builds you'll need to edit manually the updater-script.

You need to edit updater-script on the zip file, you need to change the following:

Look for:

mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");

And change it for:

run_program("/sbin/busybox", "mount", "/system");

Look for:

format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");

And change it for:

run_program("/sbin/mkfs.f2fs", "/dev/block/platform/msm_sdcc.1/by-name/system");

Installation Steps (Clean Install)

1) Install your favorite recovery and reboot to recovery.

For TWRP

1.1) Go to Settings and select "

Force data and cache wipe functions to use F2FS

" and if you want F2FS support on /System partition, select "

Include system partition

"

1.2) Now go to Wipe menu and select Format Data and type "yes" (Warning this will format Data partition and your Internal Storage, so please don't forget to make a backup of your

personal data

)

1.3) Optional, select Advanced Wipe menu and check System and Cache partitions to convert to F2FS respectively.

For Philz Touch

1.1) Go to Mounts and Storage and select "

toggle f2fs <-> ext4 migration

"

1.2) Select format /data and confirm, now select format /data and /data/media (/sd, confirm, choose f2fs option and confirm again.

1.3) Optional, you can select format /system and format /cache to convert to F2FS respectively.

2) Install your ROM as usual, then flash your GApps and f4ktion kernel in this order.

3) Restore your personal data to your internal SD Card.

If you don't want to make a clean install, you can convert /data partition to F2FS using and restoring a /data nandroid backup.

Installation Steps (Restoring /Data partition)

1) Install your favorite recovery and reboot to recovery.

For TWRP

1.1) Make a nandroid of /data partition.

1.2) Go to Settings and select "

Force data and cache wipe functions to use F2FS

" and if you want F2FS support on /System partition, select "

Include system partition

"

1.3) Now go to Wipe menu and select Advanced Wipe menu and check Data, swipe to confirm wipe.

1.4) You can restore your /data nandroid now.

1.5) Optional, you can select format /system and format /cache to convert to F2FS respectively and install a new ROM.

For Philz Touch

1.1) Make a custom nandroid of /data partition.

1.2) Go to Mounts and Storage and select "

toggle f2fs <-> ext4 migration

"

1.3) Select format /data and confirm, now select format /data and /data/media (/sd, confirm, choose f2fs option and confirm again.

1.4) You can restore your /data nandroid now.

1.5) Optional, you can select format /system and format /cache to convert to F2FS respectively and install a new ROM.

How to check if you have correctly formatted partitions to F2FS?

Through terminal do:

su
mount | grep f2fs

Through adb do:

adb shell
su
mount | grep f2fs

Also you can check F2FS's status by doing:

cat /sys/kernel/debug/f2fs/status

Or just install DiskInfo app

Credits

[MENTION=912474]Dees_Troy[/MENTION] for TWRP

[MENTION=4325945]ktoonsez[/MENTION] for F2FS mod

[MENTION=4666971]Phil3759[/MENTION] for Philz Touch