[GUIDE] Formatting EXT4 to F2FS without losing internal storage & data

Adithya R

Senior Member
Apr 3, 2015
392
673
133
Bangalore
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.

Code:
/* 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://forum.xda-developers.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:
  1. 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.
  2. Reboot to recovery mode (TWRP)
  3. 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.
  4. 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)
  5. 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.
  6. Now open command prompt (press win+R from keyboard, type cmd & press enter) & type the following one by one:
    Code:
    cd c:\adb
    adb pull -p /sdcard c:\bacon_full_backup
  7. The full backup is gonna take several minutes. Relax with some music until then. :p :D :good:
  8. 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]
  9. 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.]
  10. 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.]
  11. If you are flashing new ROM after wiping data & system, then skip the steps 12 & 13.
  12. 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):
    Code:
    cd c:\adb
    adb push -p c:\bacon_full_backup /sdcard
  13. 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).
  14. 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.
  15. 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.
 
Last edited:
S

#sychrome#

Guest
cool but i thought there would be no backup involved like windows where i changed from mbr to gpt without damaging data
 
Last edited:

shinemonmond

Senior Member
Nov 13, 2013
60
8
28
BKK
Umm, So if I use 6.0.1 sultan I can format to f2fs except 'system' directory right?
That mean I need to skip step 6 . Am I right ?
Sorry for newb question XD
 
S

#sychrome#

Guest
Oh my god.... This was the most obvious guide I have ever come across on XDA.... Please make a guide on how backup and restore my apps if I overheat and burn my phone?
lol and apparently some people needs a 3 click guide and some full blown guide . hey, i respect the author for helping someone
 

dwaipayanray95

Senior Member
Jul 24, 2012
1,438
2,414
153
Pune
www.youtube.com
lol and apparently some people needs a 3 click guide and some full blown guide . hey, i respect the author for helping someone
No the author has has definitely put a great amount t of efforts to write.... I give him that.... I came to guide to find some other way of backing up the data from your internal storage partition directly... But copying g onto your laptop is something almost what everyone does... I think the warning that the OP gave after how formatting would erase the complete partition... I think it should indicate as to what happens.... He has stated that clearly too...

I was looking g for a better alternative
 

lapapunk

Senior Member
Aug 22, 2014
402
156
0
Odessa
hi. thanks for guide.
cd c:\adb
adb pull -p \sdcard c:\bacon_full_backup
but this lines dont work as should. for windows users this lines will work correctly (its work for me \ win 10 64)
cd c:\adb
adb pull -p /sdcard c:\bacon_full_backup
some things about 12 item:
for me adb dont want to work, because i wipe all partitions and didnt install the rom. After installing ROM, go to develop options and check adb debug, only after this step adb command in cmd was working well.
 
Last edited:

donk165

Senior Member
Dec 11, 2012
721
155
63
West Midlands
How can I put a ROM on my phone after converting data and cache? In TWRP, mounting doesn't give me a storage device in Windows, and using ADB Sideload, it just gets stuck on 'starting service'. I plan to move from sultans CM12.1 up to CM13 but I dont know how to load a ROM zip onto the phone after converting the file system?
 

mrm136

Member
Mar 1, 2010
12
4
0
Germany
Oh my god.... This was the most obvious guide I have ever come across on XDA.... Please make a guide on how backup and restore my apps if I overheat and burn my phone?
For me, who just wants to flash (and destroy and flash and destroy again - 2nd bootloader ftw!) his 7 year old Samsung Galaxy S1, is this completely new. Never heard of f2fs before today.
For the SGS1, only roms from 5.x on supports f2sf. But its manditory to try the 6.x roms.

I thankfully stumbled across this guide - now im only in the need to figure out, which from with version on TWRP & CWM can do this trick, where i can found them and what i need to do, to be able to flash them. (If your handset is on android 2.2/2.3, its not that easy to change to an up-to-date version)
 

Adithya R

Senior Member
Apr 3, 2015
392
673
133
Bangalore
hi. thanks for guide.

but this lines dont work as should. for windows users this lines will work correctly (its work for me \ win 10 64)


some things about 12 item:
for me adb dont want to work, because i wipe all partitions and didnt install the rom. After installing ROM, go to develop options and check adb debug, only after this step adb command in cmd was working well.
Yup sorry for the mistake. Its a slash instead of a backslash in adb pull \sdcard.I have updated it. :)
Someone pointed out the same mistake in my OPO forums thread and had fixed it, but forgot to fix it in XDA thread.
 

pierino2010

Member
Feb 15, 2017
30
1
0
hello i read the guide to convert filesystem, byt when i tick partition system and changhe file system with twrp 3.1.0 i can not chose f2fs is not present why? only ext2 ext 3 ext4 etc but not f2fs? why???
thanks