[ONE General] adithya2306:
Hi everyone,

This is a simple guide on how to fomat ext4 to f2fs without losing any of the internal storage & data.

Cuz, nowadays many ROMs, specially the new marshmallow ROMs are having F2FS support. And f2fs has much better I/O perfomance when compared to Ext4 (it really boosts your bacon's read & write speed)

IMPORTANT: F2FS is useful only if the ROM & Kernel which you are using supports F2FS (it shoud be written in the description in the thread of the ROM & kernel). If it doesnt support, & you formatted partitions as f2fs, then maybe you wont be able to boot.

/* DISCLAIMER:
*
* Your warranty is... still valid?
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about steps included in this guide
* before formatting the phone! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*
*/

First of all what is F2FS?

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 systemthat, 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.

Benefits:

- Much Increased I/O speed

- Increase life span of flash storage due to less write required

- Doesn't suffer file size limitation of 4GB​

Why F2FS is better than Ext4?

Because, it has much better I/O perfomance when compared to Ext4. It also has much higher write speeds. It is specially meant for eMMC card & to use its full potential. See various benchmarks & comparison of Ext4 & F2FS here: http://xdaforums.com/showthread.php?t=2697069​

I even got very high UX I/O Perfomance Score in AnTuTu Benchmark (much higher than my old ext4 exodus cm12 ux score) (UX Score 29513 out of total score 56581) (Sultanxda CM13 build 4.4.2016, lightning kernel, /data & /cache formatted as F2FS): https://forums.oneplus.net/threads/cm13-what-is-your-antutu-score-in-cm13.440380 (see screenshot). :D :) :cool:​

Why am I making a seperate guide? Isnt this very easy?

Cuz, many people (even I before) didnt know that formatting /data, /system & /cache to f2fs would wipe the internal storage too, and at later would end up crying after losing their precious internal storage files. This had happened to me a few weeks ago. And this involves some other steps too. So I am making this guide so that others wont lose their precious files.​

​

Pre-Requisites:

OnePlus One (lol) :p & working usb cable

TWRP 3.0.1

ROM & Kernel that supports F2FS

Windows Laptop/PC with ADB Drivers & ADB 1.0.32 installed (how to install adb driver & adb is given in Steps 4 & 5) & with atleast 60GB Space in your PC.

70% battery in your bacon atleast.

Procedure:

If you are gonna wipe /system & /data for flashing new ROM (like a new cm13 rom), then first take titanium backup of all the required stuff.

Reboot to recovery mode (TWRP)

In TWRP, Go to Backup >> Tick all the partitions >> Go to options tab & enable compression (this will make the backup process slower but will make the backup files smaller, optional) >> Swipe to backup >> Wait until backup gets over. Dont cancel.

After the backup process is complete, go to twrp home >> Mount >> Enable MTP (if the button shows Disable MTP, that means MTP is already enabled) >> Now connect your opo to computer/laptop. In My Computer or This PC, it should show up as A0001 >> Now open the device A0001 in This PC/Computer >> Internal Storage >> Select everything (dont miss anything) >> Right click > Copy >> Now make a folder anywhere (I made it in root of C: drive) >> paste everything. This will take some time, wait till everything gets over. MTP is too slow & sometimes some files do not copy properly. Instead, do this failproof ADB method (for windows user): Install Universal ADB Driver from here (ignore if you have already installed adb)

Now download minimal adb & fastboot from here >> Open the downloaded file (Its a setup wizard) >> when it asks for installation path, change the default path to "C:\adb" (without quotes) & install it.

Now open command prompt (press win+R from keyboard, type cmd & press enter) & type the following one by one:

cd c:\adb
adb pull -p /sdcard c:\bacon_full_backup

The full backup is gonna take several minutes. Relax with some music until then. :p :D :good:

Now you are ready to go! WARNING: This step will wipe your /system completely. But dont worry. Everything is safe in your PC. Now go to TWRP Home >> Wipe >> Advanced Wipe >> tick system (verify if your ROM & kernel supports /system as f2fs, else skip this step) >> Repair or Change File System >> Change File System >> F2FS >> Swipe to change. Now your system partition is cleanly formatted to F2FS. [@Sultanxda's CM13 does not support /system as f2fs]

WARNING: This step will wipe your /data & internal storage (sdcard) completely!! . Go to TWRP Home >> Wipe >> Advanced Wipe >> tick data (verify if your ROM & kernel supports /data as f2fs, else skip this step) >> Repair or Change File System >> Change File System >> F2FS >> Swipe to change. Now your data partition is cleanly formatted to F2FS, & internal storage is empty (dont get freaked out, everything is in your PC!). [@Sultanxda's CM13 supports /data as f2fs.]

This step will wipe your /cache. Now go to TWRP Home >> Wipe >> Advanced Wipe >> tick cache (verify if your ROM & kernel supports /cache as f2fs, else skip this step) >> Repair or Change File System >> Change File System >> F2FS >> Swipe to change. Now your cache partition is cleanly formatted to F2FS. [@Sultanxda's CM13 supports /cache as f2fs.]

If you are flashing new ROM after wiping data & system, then skip the steps 12 & 13.

Now plug your opo into your PC & copy everything of the internal storage, which you copied erlier to your PC, back into the internal storage of OPO. This will take several minutes. MTP transfer is too slow. Instead, do the ADB method: Open a command prompt & type these commands one by one wait till it completes (will take a long time):

cd c:\adb
adb push -p c:\bacon_full_backup /sdcard

Now go to TWRP Home >> Settings >> tick use rm -rf instead of formatting (else while restoring the twrp backups, twrp will reformat the partitions as ext4 again).

Now go to twrp home >> restore >> select the latest backup (see the date & time in the name of the backup if you have multiple backups) >> tick every partitions >> tick enable md5 verification >> Swipe to restore.

Done.

Voila! Now your device is formatted as F2FS! Enjoy the much faster I/O read & write speed. :) :)

I actually made this guide here: https://forums.oneplus.net/threads/...-without-losing-internal-storage-data.439999/ & copy pasted in xda forum.