[REF] Shell script for ROM installations - updated 4/21 - Fascinate Android Development

This thread is OLD, please follow this new link: http://forum.xda-developers.com/showpost.php?p=14016174&postcount=1

yay thank you, wiping data and cache between rom flashes is really hard.

Updated the script with more efficiency and functionality, now does mount checks with both rfs and ext4 and formats where necessary.

Related

[Q] Voodoo vs not Voodoo

What is the advantage having a kernel that has Voodoo in it, and other kernels that come with the roms.
Voodoo convert your /data to Ext4 which is a much faster and reliable file system than RFS.
However, because it changes your file system, when you flash anything, I meant ANYTHING, you need to disable it first. Otherwise, you will soft brick.
There's a new lag fix that's rising. It's call zMod, and it convert /data /dbcache and some other path I don't remember. But it is a full phone conversion besides /system. Look it up in the dev forum. I am not sure about all its details.
I am actually reading up on it now. It should be realised later on tonight, or tomorrow. So i should wait for that and don't bother with Voodoo at this point.
PaiPiePia said:
Voodoo convert your /data to Ext4 which is a much faster and reliable file system than RFS.
However, because it changes your file system, when you flash anything, I meant ANYTHING, you need to disable it first. Otherwise, you will soft brick.
There's a new lag fix that's rising. It's call zMod, and it convert /data /dbcache and some other path I don't remember. But it is a full phone conversion besides /system. Look it up in the dev forum. I am not sure about all its details.
Click to expand...
Click to collapse
Ahh thanks for the info.
I was hesitant to root my Vibrant but the lag has gotten Extreme and I am about to give up on Samsung and Froyo. After messing with a PSP for years you get tired of having to hack things, but Samsung really has failed with this file system and I just cant keep letting it slug along.
PaiPiePia said:
Voodoo convert your /data to Ext4 which is a much faster and reliable file system than RFS.
However, because it changes your file system, when you flash anything, I meant ANYTHING, you need to disable it first. Otherwise, you will soft brick.
There's a new lag fix that's rising. It's call zMod, and it convert /data /dbcache and some other path I don't remember. But it is a full phone conversion besides /system. Look it up in the dev forum. I am not sure about all its details.
Click to expand...
Click to collapse
z4mod converts
/data to ext4
/dbdata to ext4
/cache to ext2
And if you want
/system to ext4 or ext2
So it converts all of those. You just have to add system to the update script. You can also choose which ext you want to use by editing the update script. So it could be /data to ext2 if you'd like. My current set up is the one above but /system is ext4 for me.
Sent from my SGH-T959 using XDA App
Im using zmod right now and it works really well. Just make sure you get the zip that converts the file system back to rfs when you flash a new rom.
Samsung Vibrant using Bionix Final w/ z4mod

[HOW-TO] Custom MTD Partitions [12/30/2010]

DISCLAIMER: Nobody -- and I do mean nobody -- is responsible for a bricked device except for the person attempting this modification. Do not contact me, Firerat, Cyanogen or anyone else to complain that you borked your Slide by not following instructions.​
ORIGINAL THREAD
All credit for this work goes to Firerat and lbcoder -- especially to Firerat for making this so darn easy!​
This post will provide instructions for resizing your device's MTD partitions.
PREREQUISITES:
An understanding of basic arithmetic
Familiarity with disk partitioning
S-OFF
The Espresso has 465.1 MB to play around with and it ships with the following partition layout:
System: 240 MB
Data: 145.1 MB
Cache: 80 MB
You can check your current layout by launching an ADB SHELL and entering the following command:
Code:
busybox df -h
You will likely notice that the system partition has a *lot* of free space, likely well over 100 MB available! The instructions in this post will walk you through requisitioning that available space and putting it into the data partition, avoiding the need to ever use Apps2SD or Apps2EXT.
So let's get started...
Step 1: Downloading the necessary files​
Firerat's Mediafire repository can be found here... You will need two files from it:
Custom MTD recovery zip
Custom MTD boot zip
Download those files and place them on your sdcard.
Step 2: Configuring your partition scheme​
As I mentioned earlier, by executing the busybox command you'll get an idea of how much empty space you have on your system partition. Your choices in the section depend entirely on the rom you are using -- for the sake of simplicity I will be assuming the use of a CM6-based rom.
So, once again, launch an ADB SHELL...
You're going to be executing an echo command to create a text file on the root of your sdcard -- this text file will contain the information needed to re-partition your internal memory. This is where you have to make your own choice about sizing -- here is the format of the command you must enter:
Code:
echo "mtd [SYSTEM SIZE IN MB] [CACHE SIZE IN MB]" > /sdcard/mtdpartmap.txt
For my partition scheme on an Espresso running CM6.1.1 I executed the following:
Code:
echo "mtd 140 1.5" > /sdcard/mtdpartmap.txt
NOTES:
If you're using a CM6-based rom you do not need a large cache partition as a script will bind-mount cache -- the smallest size you can set is 1.5 MB -- other roms have their own cache size requirements, so do your research before setting this to a low value.
All partition sizes must be rounded up to the nearest 0.125 MB, but I recommend using increments of 0.5 MB.
All the excess storage not set aside for system and cache will be used for the data partition.
Step 3: Getting your hands dirty​
NOTE: If you had previously configured your device to use apps2ext you will need to perform one additional restoration in step 7. See below for more details...
So assuming you've now downloaded the two zip files (step 1) and added the mtdpartmap.txt file to the root of your sdcard (step 2), you're ready to proceed with the nitty-gritty work. For the sake of simplicity I'm assuming that during the S-OFF procedure you opted to [permanently] flash ClockworkMod Recovery 2.5.0.1 on your device.
Boot your Slide into recovery -- my preferred method is to use ADB REBOOT RECOVERY.
Execute a Nandroid Backup -- within recovery: nandroid->Backup
Wipe your data and cache partitions -- within recovery: wipe data/factory reset
Flash the recovery patcher -- within recovery: install zip from sdcard->choose zip from sdcard->recovery-v1.5.8-Beta-CustomMTD_S.zip
Format the system, data and cache partitions -- within recovery: partitions menu->format [system/data/cache]
Reboot into recovery -- within recovery: advanced->Reboot Recovery
Execute an advanced Nandroid restore of system and data* -- within recovery: nandroid->Advanced Restore->[CHOOSE THE BACKUP]->Restore [system/data]
Flash the boot patcher -- within recovery: install zip from sdcard->choose zip from sdcard->boot-v1.5.8-Beta-CustomMTD_S.zip
Reboot -- within recovery: reboot system now
* Devices with apps2ext configurations must remember to nandroid restore the sd-ext partition as well.
And that should do it. Be patient on first boot as it may take a little longer than expected. To verify that your changes have worked you can repeat the busybox command I listed earlier:
Code:
busybox df -h
Moving forward, let's say you want to flash the latest CM6 nightly -- simply flash the nightly zip (and gapps if necessary) and, immediately after that, flash the boot patcher (boot-v1.5.8-Beta-CustomMTD_S.zip).
I do not plan to field questions in this thread, so if you're looking for support I suggest that you visit the #mytouchslide channel on Freenode IRC.
And, once again, ALL CREDIT goes to Firerat and lbcoder.
Additional Notes (provided by Firerat)​
Removal
There are two ways to remove customMTD ( to return to stock layout ):
Flash an unmodified recovery.img (NOTE: You must format system, cache and data)
Edit the mtdpartmap.txt to have a system size of 0 -- e.g. echo "mtd 0" > /sdcard/mtdpartmap.txt -- and flash the recovery patcher (NOTE: You must format system, cache and data)
Resizing
If you wish to resize, change the mtdpartmap.txt and flash recovery patcher (NOTE: You must format system, cache and data)
Recovery Upgrade
The easiest way to upgrade recovery is to flash manually in recovery via an ADB SHELL while booted into recovery:
Code:
mount /sdcard
flash_image recovery /sdcard/RECOVERY_VERSION#.img
NOTE: You do not need to format system, cache and data in this case as you are not resizing.
Again, thanks go out to Firerat for these additional notes.
Damn I was going to post this later, well done bro thank you
Sent from my T-Mobile myTouch 3G Slide using XDA App
Many thanks for the clear instructions that were surprisingly easy to follow and the phone did boot up again just fine (as noted in the OP, the boot up took longer the first time around, but there is always
Code:
adb logcat
for anyone worried about what the phone is doing when it looks bored). Total data space is now 320 MB (and sleepykit is one happy kitten).
Many thanks, sir!
Sent from my HTC Espresso running CM6.
Ty very much
Sent from my T-Mobile myTouch 3G Slide using XDA App
@HebrewToYou
very good post
I think it's the clearest I have seen to date
just couple of points which I think would prove useful
Removal
there are two ways to remove customMTD ( to return to stock layout )
the first is to simply flash an unmodified recovery.img
Note You *must* format system, cache and data with clockwork or use
fastboot erase system -w
the second is to edit the mtdpartmap.txt to have a system size of 0
e.g.
echo "mtd 0" > /sdcard/mtdpartmap.txt
flash the recovery patcher
again you must format system, cache and data
Resizing
if you wish to resize
change the mtdpartmap.txt
flash recovery patcher
format system, cache and data
Recovery Upgrade
the easiest way to upgrade recovery is to flash manually
in recovery ( adb shell )
mount /sdcard
flash_image recovery /sdcard/recovery<version>.img
via running recovery ui
flash recovery patcher
Note, you don't need to format system, cache and data, as you are not resizing
Thanks for this!
myTouch 3G Slide using XDA App
Firerat said:
@HebrewToYou
very good post
I think it's the clearest I have seen to date
just couple of points which I think would prove useful
Click to expand...
Click to collapse
Firerat, thank you for the compliment! It means a lot.
I'll add your notes to the second post of the thread.
On Cm based roms you should be able to shrink system to atleast 100, mines is currently 100MB, but actual usage is 89MB(I removed some stuff)
Ace42 said:
On Cm based roms you should be able to shrink system to atleast 100, mines is currently 100MB, but actual usage is 89MB(I removed some stuff)
Click to expand...
Click to collapse
You're free to make system whatever size you like -- my recommendations are just that: recommendations. The size I suggested will likely be large enough to accommodate CM7 when it is released -- I cannot say the same about 100 MB...
Thank you for this clear, concise, well formatted tutorial. Easy to read and follow extra /data/ memory made my day.
nice tutorial. too bad im using cr-mod and current system usage is at 204. does this ever change or does it only change with different roms because I want to shrink it to about 210 but i dont want any hidden surprises
lilshortwun said:
nice tutorial. too bad im using cr-mod and current system usage is at 204. does this ever change or does it only change with different roms because I want to shrink it to about 210 but i dont want any hidden surprises
Click to expand...
Click to collapse
Sense roms always have large system sizes, vanilla ones are normally under 100~. You can always delete some apps from sys that you dont want to shrink it even more, but there should be no hidden traps if you make it 210. I am so happy that we finally have mtd cause i dont use ext anymore and i dont like apps2sd either. On Cm I have 372 in total for data, which is more than enough for me.
does it make the phone faster or just more space to install the app?
chiensibut said:
does it make the phone faster or just more space to install the app?
Click to expand...
Click to collapse
It doesn't make the phone faster... It gives you fine control over how your phone's internal memory is allocated. If you're running a non-stock rom, there's no reason to have such a huge /system partition. This will allow you to remedy that.
thank you for this. didnt even know we had all the extra space on our phones
only thing is i didnt understand what was said about the cache. i noticed my phone was using >60MB so i gave it 80. wish i could have gotten it down to 1.5 like you did
guitarist5122 said:
thank you for this. didnt even know we had all the extra space on our phones
only thing is i didnt understand what was said about the cache. i noticed my phone was using >60MB so i gave it 80. wish i could have gotten it down to 1.5 like you did
Click to expand...
Click to collapse
Cache is not permanently stored data -- it's just a temporary repository. CM6-based roms will bind-mount /cache to /data if the size is too small, which it will be if you set it to 1.5 MB. That way you can repurpose the 80 MB of /cache and put it directly towards /data -- then /data becomes a shared space /data and /cache which is much better (IMHO).
HebrewToYou said:
Cache is not permanently stored data -- it's just a temporary repository. CM6-based roms will bind-mount /cache to /data if the size is too small, which it will be if you set it to 1.5 MB. That way you can repurpose the 80 MB of /cache and put it directly towards /data -- then /data becomes a shared space /data and /cache which is much better (IMHO).
Click to expand...
Click to collapse
ahhhhh, now i get it. thx for breaking it down
Does this make the phone think that space on an SD card is in /data? So if lets say I have a 4GB partition on my sd card I can make the phone think that partition is /data?

[TEAM XPOSED] [Guide] Use Synergy EXT4 Tweaks on any ROM without losing data.

I was on a hunt to make this work without losing any data and I've figured out a way that works quite nice, and all it involves is a TWRP backup, ADB, and a bit of commandline.
Thanks to TrevE for his ever evolving tweaks to Android and for making them readily available to the community at the cost of one thanks per post, and maybe a beer or two (how many people really buy beer with donations?!)
Required:
TWRP backup
ADB
The EXT4 tweaks for /data
The EXT4 tweaks for /system
(If your ROM doesn't already have them, I will be providing the zips for them courtesy of Synergy.)
Step 1:
Connect your phone to your PC and like all things of this nature, BACKUP! Use TWRP to create a nandroid of your entire phone. We will need this backup to restore data and system via commandline. TWRP is the only tested method that works, since it creates backups that are actually TAR files (God, I love TWRP for this). Stay in recovery after completing backup.
Step 2:
While still in recovery, enable USB storage mode and download the two EXT4 files below (or applicable if your ROM already has one of the partitions optimized) onto the root of your microSD card. To make things easier, you can temporarily move your data.win and system.win files to the root of your microSD card. They are located in the TWRP folder on your microSD card. Afterward, disable USB storage mode.
Next, there are TWO ways to accomplish this. Choose which way you want to go before continuing.
Method 1: Reflash your ROM(NOT RIGHT NOW, later on in the guide--depending on ROM, this may format your /system and/or data partitions, rendering the tweaks useless.)
Method 2: Use commandline to restore your ROM from TWRP backup.
Step 3:
From recovery, wipe dalvik and cache and format data and and depending on method, your system partitions as well. NOTE: formatting the partitions can be done from TWRP in the advanced menu.
Step 4:
Flash the applicable EXT4 file.
Step 5:
Mount /data, /system, (if applicable), and /sdcard with TWRP and launch an ADB shell by typing "adb shell" then press enter while in your ADB folder from command prompt/terminal.
Step 6:
Type "cd /sdcard" and press enter. To make sure you're in your sdcard, type "ls" then press enter to verify that it's listing your microSD card contents.
Step 7:
Type "cd /data" and press enter. To make sure you're in /data, type "ls" then press enter to verify that it's empty. It will probably contain a lost+found folder, if so then that's fine.
Step 8:
If you moved your data.win and system.win backups to the root of your microSD card to make this easier, simply type "tar xvpf /sdcard/data.win" then press enter and it will begin extracting the backup file onto the /data partition. Otherwise, you will have to type "tar xvpf /sdcard/TWRP/nameofHTCfolder/nameofdatefolder/data.win" then press enter. This will take a few minutes to complete.
NOTE: MAKE SURE YOU ARE IN THE /DATA PARTITION BEFORE TYPING THAT COMMAND, OTHERWISE THINGS WILL GO WRONG.
Step 9:
Either reflash your current ROM (checking to make sure it doesn't format /system before installing) OR type "cd /system" then press enter. To make sure you're in /system type "ls" then press enter to verify that it's empty. It may contain another folder, if so that's fine. It should however be empty of ROM related files.
Step 10:
If you moved your data.win and system.win backups to the root of your microSD card to make this easier, simply type "tar xvpf /sdcard/system.win" then press enter and it will begin extracting the backup file onto the /system partition. Otherwise, you will have to type "tar xvpf /sdcard/TWRP/nameofHTCfolder/nameofdatefolder/system.win" then press enter. This will take a few minutes to complete.
NOTE: MAKE SURE YOU ARE IN THE /SYSTEM PARTITION BEFORE TYPING THAT COMMAND, OTHERWISE THINGS WILL GO WRONG.
Step 11:
Once this is all complete, exit ADB shell by typing "exit" then pressing enter. Next, unmount /system, /data, and /sdcard from TWRP and head on over to the fix_permissions option in TWRP and let it run. It will take a few minutes to complete.
Step 12:
Go ahead and wipe dalvik and cache again just to make sure, then reboot.
It will take a while to boot back into android, but if all goes well, you should have your data intact with fully optimized EXT4 partitions thanks to TrevE/Synergy.
NOTE: This worked for me, and if you follow the guide precisely, it should work for you too.
NOTE2: I did not try this method with /system, ONLY data, and it worked fine. I assume the same for /system as well.
Awesome! I as many others are appreciative of Team Xposed and how you explain mods to everyone. Most of the time we get a .zip with no explanation on how the .zip is doing what it does. We just know flash this and this happens, lol. With these breakdowns we all get a better understanding on how things work in our devices
Perhaps a sticky with all Team Xposed mods/tweaks, that would be
I believe this is what i used the last time i flashed synergy. If so, then it works great.
Wow the step by step was GREAT!! Man I did this in like 5 minutes....Granted it took me about 30 minutes to download all the tools I needed. Thanks for this one!!
Edit: So how do you know it truly worked?? How do I check if I am ext4 or not?
wow. I had EXT4 on my samsung phones and I LOVED it compared to this! I will definitely try this and make a video on my success or failure! lol
so what if i didnt care to lose data could i flash this with another rom.
Ok. So just trying to gain a better understanding here. So say if the rom were running already includes the /system tweaks but not the /data tweaks and the rom doesn't erase on flash can I just flash both of the files and flash the rom?? Also if I wanted to apply the tweaks to and existing nand can I just flash both the files and do a nand restore??? Or is restoring the data from the command line needed in order for the tweaks to work effectively???
Locked & Loaded
" Shooter on Deck "
Great write up, thanks for that!
Not to be a party pooper, but isn't there a tweaked version of the EXT4 optimized zip that backs up data to sd card, formats /data with ext4, then auto restores /data for you? I found it somewhere in the Synergy thread.
Correct me if im wrong if this does something more/different.
here is a link to it:
Synergy_Format_Data_EXT4_Optimized_apps_autorestored.zip
http://forum.xda-developers.com/attachment.php?attachmentid=708982&d=1315062399
I used it to go from Warm2.3 to Steel2.3 without any issues what so ever, except having to restore XDA app, wifi/bt networks and some widgets. It kept all my screens and settings just the way i like it. YMMV! i take no credit, and assume no responsibility if it rips your phone a new one.
Our phones are already ext4, the optimization just turns on some more features for ext4.
And the tool linked before me doesn't backup everything in /data... It should probably work, but if it misses anything this method will catch it
I just took the opportunity to wipe clean and reset some things.
Sent from my PG86100 using XDA App
youngpro83 said:
Wow the step by step was GREAT!! Man I did this in like 5 minutes....Granted it took me about 30 minutes to download all the tools I needed. Thanks for this one!!
Edit: So how do you know it truly worked?? How do I check if I am ext4 or not?
Click to expand...
Click to collapse
Good question. I suppose you could run a few Quadrant benches to ease your mind. You should get much better scores than you would normally. I suppose the only real way to know for sure is if someone created an EXT4 tweak checker of some sort lol. But the Quadrant benchmark should be enough, that is if you remember what kind of scores you were getting before hand.
digitalcrash said:
so what if i didnt care to lose data could i flash this with another rom.
Click to expand...
Click to collapse
Glad you asked! If you don't care about losing data, just go ahead and format your system and data partitions with TWRP or whatever recovery you use, then apply the tweaks zips and go ahead and flash the ROM of your choice. You should double check the updater-script of your ROM to make sure it doesn't reformat the /system partition or it will render the /system tweak useless.
laie1472 said:
Ok. So just trying to gain a better understanding here. So say if the rom were running already includes the /system tweaks but not the /data tweaks and the rom doesn't erase on flash can I just flash both of the files and flash the rom?? Also if I wanted to apply the tweaks to and existing nand can I just flash both the files and do a nand restore??? Or is restoring the data from the command line needed in order for the tweaks to work effectively???
Locked & Loaded
" Shooter on Deck "
Click to expand...
Click to collapse
Well, if the ROM you're running already contains the /system tweaks then you're half-way there. You still want a backup though, because each of these zips will format its respective partitions. You only want the zip that applies. In your case, you'd only need the data tweaks, but you'd still have to follow the guide that pertains to restoring your data partition after tweaking.
MFD00M said:
Great write up, thanks for that!
Not to be a party pooper, but isn't there a tweaked version of the EXT4 optimized zip that backs up data to sd card, formats /data with ext4, then auto restores /data for you? I found it somewhere in the Synergy thread.
Correct me if im wrong if this does something more/different.
here is a link to it:
Synergy_Format_Data_EXT4_Optimized_apps_autorestored.zip
http://forum.xda-developers.com/attachment.php?attachmentid=708982&d=1315062399
Click to expand...
Click to collapse
Glad you linked that. I actually looked over this yesterday, and while it does do something similar to this guide, It actually only restores part of your data partition, which is why it's said that you will need to repair your bluetooth devices and reenter your WiFi network settings. IIRC, it doesn't restore the entire data partition, just most of the important folders. If it were to do the entire partition, well, this guide would be much shorter.
freeza said:
Glad you linked that. I actually looked over this yesterday, and while it does do something similar to this guide, It actually only restores part of your data partition, which is why it's said that you will need to repair your bluetooth devices and reenter your WiFi network settings. IIRC, it doesn't restore the entire data partition, just most of the important folders. If it were to do the entire partition, well, this guide would be much shorter.
Click to expand...
Click to collapse
Thanks for clearing that up, i will try your method as well. I need more ADB exposure to help me learn.
so my next question is if the rom does format system on boot then i would install with adb as your guide says?
digitalcrash said:
so my next question is if the rom does format system on boot then i would install with adb as your guide says?
Click to expand...
Click to collapse
Yup...pretty much.
Thank you for this. I was able to apply this without any issues.
freeza said:
Yup...pretty much.
Click to expand...
Click to collapse
What would be the process if I didn't care about losing data? Would I just flash, and resign into my Google account and go through that process again?
LiquidSolstice said:
What would be the process if I didn't care about losing data? Would I just flash, and resign into my Google account and go through that process again?
Click to expand...
Click to collapse
If you don't care about losing data, you'd format/wipe the data and system partition from recovery, apply both ext4 zips... wipe dalvik+cache, reflash your ROM, and reboot
Keep in mind that this is pretty much the same process as factory reset, so you might as well just perform one of those lol
freeza said:
If you don't care about losing data, you'd format/wipe the data and system partition from recovery, apply both ext4 zips... wipe dalvik+cache, reflash your ROM, and reboot
Keep in mind that this is pretty much the same process as factory reset, so you might as well just perform one of those lol
Click to expand...
Click to collapse
So just to be clear, all that I need to do is before I flash a ROM, Superwipe/XRON wipe like I always do, flash the ROM, flash the EX4 zips, and then clear dalvik/cache and boot?
LiquidSolstice said:
So just to be clear, all that I need to do is before I flash a ROM, Superwipe/XRON wipe like I always do, flash the ROM, flash the EX4 zips, and then clear dalvik/cache and boot?
Click to expand...
Click to collapse
You wanna flash the zips before flashing ROM, as they format the partitions with the tweaks. You also want to double check the updater-script of your ROM to make sure it doesn't format the /system partition before installing, as it would remove the tweaks.
Soo..
Superwipe/XRON
EXT4 tweaks
ROM
No need to wipe anything as Superwipe/XRON already does this.
freeza said:
You wanna flash the zips before flashing ROM, as they format the partitions with the tweaks. You also want to double check the updater-script of your ROM to make sure it doesn't format the /system partition before installing, as it would remove the tweaks.
Soo..
Superwipe/XRON
EXT4 tweaks
ROM
No need to wipe anything as Superwipe/XRON already does this.
Click to expand...
Click to collapse
EXT4 before ROM?
Bear with me, I'm still a bit confused :X. Wouldn't flashing a ROM after the EXT4 data/system zips negate the zips' function?
LiquidSolstice said:
EXT4 before ROM?
Bear with me, I'm still a bit confused :X. Wouldn't flashing a ROM after the EXT4 data/system zips negate the zips' function?
Click to expand...
Click to collapse
lol no problem.......Well, what the tweaks does is format the system and data partitions a certain way as to improve io functions and other stuff. It's like formatting a drive in Windows with cluster switches etc. It's still empty once you flash the tweaks. The ROM simply puts all the information on the newly formatted filesystem. If you were to apply the tweaks after flashing the ROM, it would format the partitions and erase all data, which is why you do it first. The updater-script in ROMs also have the ability to format partitions, which is why in Synergy ROMs, simply flashing their ROM also applies the tweak and which is why you should check your updater-script beforehand to make sure it doesn't have a format command in it, as it would negate the tweaks.

F2FS | Improved I/O Performance on /data

For those who don't know what F2FS is, check these links out:
General info
Benchmarks
Warnings
1. Make sure you have a standard kernel for backup that uses ext4 just in case. If anything goes wrong, just install the backup kernel and reboot to recovery.
2. You will have to wipe your /data and /cache partitions for this. Basically factory reset.
3. For 2, you could try to backup data and restore after formatting. I haven't tried this but I could work.
Instructions to format /cache and /data as F2FS:
1. Boot into recovery
2. Install this kernel with F2FS CWM recovery
3. Reboot to recovery again
4. Go to 'Mounts and Storage'
5. Enable "toggle f2fs <-> ext4 migration"
6. Format /data and /cache to F2FS
7. Reboot
And now you have F2FS on /data and /cache :]
To install a new ROM that is not F2FS compatible, edit the updater-script as follows:
1. Replace strings
"mount("ext4", "EMMC", "/dev/block/mmcblk0p3", "/system");"
with string
"run_program("/sbin/busybox", "mount", "/system");"
2. Replace string
"format("ext4", "EMMC", "/dev/block/mmcblk0p3", "0", "/system");"
with string
"run_program("/sbin/mkfs.f2fs", "/dev/block/mmcblk0p3");"
Note: this string needs this patch in ROM
3. Add string
"run_program("/sbin/busybox", "mount", "/data");"
after strings
"run_program("/sbin/mkfs.f2fs", "/dev/block/mmcblk0p3");"
"run_program("/sbin/busybox", "mount", "/system");"
4. Add string
"unmount("/data");"
before string
unmount("/system");
what the benefit of this?
@up
if you read the links you will understand...
Seems faster... and using much more the /cache partition...
zipperX said:
what the benefit of this?
Click to expand...
Click to collapse
Read the first 2 links, mainly the 2nd one. It delivers better I/O performance than what ext4 has to offer.
monstro78 said:
@up
if you read the links you will understand...
Seems faster... and using much more the /cache partition...
Click to expand...
Click to collapse
It uses more /cache because it is a log-based filesystem
For install rom updates, the steps from install this kernel is always format data and cache?
Thanks by advance.
AtEExll
Sent from my GT-I8160 powered by CyanogenMod 11
AtEExll said:
For install rom updates, the steps from install this kernel is always format data and cache?
Thanks by advance.
AtEExll
Sent from my GT-I8160 powered by CyanogenMod 11
Click to expand...
Click to collapse
if you have already formatted to f2fs before, all you have to do is install this kernel again after installing the rom.
@zwliew Only /data for now? How about /system too?
exodius48 said:
@zwliew Only /data for now? How about /system too?
Click to expand...
Click to collapse
i'll work on it. probably have it done within a few days :]
when I try to format my cache partition I always get an error, that formatting was not possible.
also now im not able anymore to write on my /system partition. installing zips and restoring backups are always cancelled... sh***
S.AMU said:
when I try to format my cache partition I always get an error, that formatting was not possible.
also now im not able anymore to write on my /system partition. installing zips and restoring backups are always cancelled... sh***
Click to expand...
Click to collapse
Try re-partioning using this technique http://forum.xda-developers.com/showthread.php?t=2596521
or reflashing via ODIN.
zwliew said:
2. Install this kernel with F2FS CWM recovery
Click to expand...
Click to collapse
Hello! Where I can download separated F2FS CWM image?
ChronoMonochrome said:
Hello! Where I can download separated F2FS CWM image?
Click to expand...
Click to collapse
i believe we don't have separate recovery and boot partitions
zwliew said:
i believe we don't have separate recovery and boot partitions
Click to expand...
Click to collapse
I meant *.cpio image.
ChronoMonochrome said:
I meant *.cpio image.
Click to expand...
Click to collapse
lol i didn't think someone would want that. anyway i don't have it anymore.
zwliew said:
lol i didn't think someone would want that. anyway i don't have it anymore.
Click to expand...
Click to collapse
Is there any way to getting *.cpio image except compiling it from source? I can't extract initramfs from your kernel with f2fs support because it's compiled with LZ4 compression.
zwliew said:
anyway i don't have it anymore.
Click to expand...
Click to collapse
But why f2fs support hasn't been added in your newest kernel releases? it's unstable?
It's possible to format /system as F2FS also or not at the moment ?
No way ??!!!
And: can i use this Kernel for formatting F2FS on my codinap Device ?? Or that will be a brick ?
Many Thanks !!

Nexus 5 F2FS Tools

EDIT 05 September 2014: Added fstab.hammerhead formatted for f2fs-all and f2fs-data for those who wish to manually replace the ramdisk's fstab.hammerhead in a kernel to mount the partitions as f2fs.
NOTE: This will only work on kernels that have f2fs tools commited to their kernel image. Make sure the kernel you wish to modify has F2FS support otherwise it WILL NOT WORK!
22 July 2014: Made changes to the Android Kitchen to retain the USB stick mount.
16 July 2014 If you have used any previous version of F2FS ROM CONVERTER prior to the date, please update to the latest version in the links below to correct major errors, to put more fault checks in place and provide better instructions for non Nexus 5 devices to use. Version number is in the Window Title from v0.3.
First off I have to say that I did not create any of these tools but rather I brought them together and I modified them to make it straight forward and easier to format the partitions as F2FS, make a ROM F2FS-ALL and modify a kernel for F2FS-ALL or just F2FS-DATA.
I would suggest you click on each link and click Thanks for each of them.
Thanks and links to the original authors and software.
Hammerhead FSTAB files formatted for F2FS-ALL and F2FS-DATA
Note1: Rename the desired file to fstab.hammerhead to replace the exisiting one in the ramdisk.
Note2: Use Android Image Kitchen to unpack and repack a kernel file (boot.img) during which you can replace the fstab.hammerhead
Note3: Some kernels' updater-script mounts /system or /data as EXT4. Therefore it needs to be modified from the original and added back to the zip.
e.g. Change mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system"); to run_program("/sbin/busybox", "mount", "/system");
and change mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/userdata", "/data"); to run_program("/sbin/busybox", "mount", "/data");
Link: http://d-h.st/l87
Download: follow above link
Thanks: kdh2834
Tool: F2FS and F2FS-ALL kernels modified by kdh2834 with help on how to do it. (Actually it was because of him I can now get my N5 running with a full F2FS-ALL ROM and kernel)
Link: http://forum.xda-developers.com/showpost.php?p=52550395&postcount=1
Thanks: osm0sis
Tool: Android Image Kitchen (for unpacking and repacking a kernel)
Link: http://forum.xda-developers.com/showpost.php?p=36067074&postcount=1
Download my version: http://d-h.st/E74
Thanks: TeamWin
Tool: TWRP recovery for formatting the partitions as F2FS (use the latest version)
Note: It can also show the format of a partition in Wipe -> Advanced Wipe
Link: http://techerrata.com/browse/twrp2/hammerhead
Download follow above link
Thanks: Phil3759 and to rootSU for the Nexus builds
Tool: Philz touch recovery for formatting the partitions as F2FS (use the latest version)
Link: http://forum.xda-developers.com/showpost.php?p=48377548&postcount=1
Download: follow above link
Thanks: legolas93's FormatPartitions.zip
Note: These flashable zips need one of the above recoveries to work
Tool: Flashable zips to format the partitions automatically
Link: http://forum.xda-developers.com/showthread.php?t=2678140
Download my version to format all partitions to F2FS: http://d-h.st/RCz
Download my version to format the data partition to F2FS: http://d-h.st/2AI
Thanks: NABENDU1 for F2FS ROM CONVERTER
Note: Mine has been heavily modified for Nexus 5 phones but can be used by any device
Link: http://forum.xda-developers.com/showpost.php?p=52201672&postcount=1
Tool: F2FS ROM Converter v0.5 to make a flashable ROM with F2FS support.
Download my version: http://d-h.st/Uiq
EDIT: Latest version (v0.5) replaced the AOSP F2FS-ALL kernel (boot-f2fs-all.img) as it was not fully F2FS-ALL compatible. Previous version still had /cache partition as EXT4
EDIT: Latest version (v0.4) has support for Slimkat and similar ROMs that need to mount the /data partition.
Instructions
Note: The following steps can be done in any order EXCEPT that step 1. must be done before step 2.
1. Install one of the recoveries.
Note1: If you are on a stock recovery and your phone is locked you will need to backup everything first!
Note2: There is a flashable zip to lock and unlock the boot loader without formatting (only after initial unlock) and Philz Touch Recovery has a password lock as well if you are concerned about security.
WARNING: Before doing the below step, backup your ROM AND your DATA on your sdcard as it will be formatted!
Suggestion: Do an adb pull.
2. Format the partitions using the flashable zips.
3. Use the Android Image Kitchen I provided to modify a kernel with F2FS support. Drag and drop the boot.img on 1_mod_f2fs_kernel.bat file and just follow the instructions.
The kernel can then be installed by sideloading the zip file (see step 4.) or using fastboot from the bootloader (e.g. fastboot flash boot boot.img)
4. Use the F2FS Converter I provided to convert a ROM to mount the /system with a F2FS partition
The ROMs flashable zip will have to be sideloaded (In Philz Touch go to Install Zip -> Install zip from sideload, / In TWRP click Advanced -> ADB Sideload)
Note1: Only needs to be used with a F2FS-ALL kernel.
Note2: There is an option to use your preferred F2FS-ALL kernel as opposed to the default ones.
EDIT: Added which batch script to drop the image file onto in step 3.
Thanks, makes it easy for lazy people like me. Will use it later and let you know how it went.
Sent from my Nexus 5 using XDA Premium 4 mobile app
Волк said:
Thanks, makes it easy for lazy people like me. Will use it later and let you know how it went.
Sent from my Nexus 5 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
If I missed anything let me know although I tested it to make sure it worked for myself.
Please remember to do a sdcard backup on to your computer. The backups from the the custom recoveries does not back up the sdcard.
Any devs working on a similar method for sgh-I747?
Sent from my SAMSUNG-SGH-I747 using XDA Premium 4 mobile app
aircooledbusses said:
Any devs working on a similar method for sgh-I747?
Sent from my SAMSUNG-SGH-I747 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I found a TWRP recovery that should support f2fs for your i747 here:
http://techerrata.com/browse/twrp2/d2att
Download the latest version.
Or you can use Philz Touch Recovery but it seems like you will need to build it yourself (if you know how)
Backup everything and move the backups to a computer.
And run one of the format tools according to which partitions will have F2FS (only /data f2fs-data OR /system /data & /cache f2fs-all)
I found one kernel that supports F2FS, there are probably others.
http://forum.xda-developers.com/showthread.php?t=2390147
To answer your question: I am not sure. I am just sharing what I did to make my life easier with others.
These tools will not work for your i747 as they are but I will look into what I can modify to make it work for yours and you can tell me if it works.
If you are getting problems I will see what I can do to help if I have the time.
I will post something when I can.
F2FS-ALL Kernels
You can check http://forum.xda-developers.com/google-nexus-5/development/kernel-f2fs-modified-kernels-t2746951 for some kernels.
The CM kernel was modified by me for F2FS-ALL
You can get it here:
http://d-h.st/1rS
I have modified the ElementalX kernel (ElementalX-N5-1.02-cm.zip) to F2FS-ALL.
Original kernel is here:
http://forum.xda-developers.com/showpost.php?p=47286518&postcount=1
Note1: You need to install the CM kernel above first as the Elemental X uses the ramdisk of the current working kernel, which in this case has the fstab.hammerhead with the f2fs information.
Note2: I had to modify the mount command as well in the updater-script from this:
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
to this:
run_program("/sbin/busybox", "mount", "/system");
You can get the working ElementalX 1.02cm F2FS-ALL version here:
http://d-h.st/oEt
Chaos Kernel v13.0 July 08 (nightly) F2FS-ALL - http://d-h.st/h3H
nice! this collection of tools might have me finally trying f2fs on my Nexus5...
however, I've set my sights on this kernel http://forum.xda-developers.com/google-nexus-5/development/kernel-t2697951
there seems to be no interest to include f2fs support by default, could I perhaps ask for you to add it and compile? :angel:
I'm currently on stock 4.4.4 and faux kernel. but from what I read faux causes issues on f2fs-all, right? and other kernels I've looked at don't seem attractive enough to me... is there pure 4.4.4 stock with f2fs-all added? ^^ I found only 4.4.2 stock kernel.
Also... if I backup my /data can I restore it later onto f2fs partition? so I don't have to start from scratch and install/update apps?
no biggie, just wondering on this one.
thanks alot! :silly:
GizmoTheGreen said:
nice! this collection of tools might have me finally trying f2fs on my Nexus5...
however, I've set my sights on this kernel http://forum.xda-developers.com/google-nexus-5/development/kernel-t2697951
there seems to be no interest to include f2fs support by default, could I perhaps ask for you to add it and compile? :angel:
I'm currently on stock 4.4.4 and faux kernel. but from what I read faux causes issues on f2fs-all, right? and other kernels I've looked at don't seem attractive enough to me... is there pure 4.4.4 stock with f2fs-all added? ^^ I found only 4.4.2 stock kernel.
Also... if I backup my /data can I restore it later onto f2fs partition? so I don't have to start from scratch and install/update apps?
no biggie, just wondering on this one.
thanks alot! :silly:
Click to expand...
Click to collapse
I will look at that kernel later.
If you backup it up using an adb pull, that's what I did not sure about the custom recovery backups as they usually name the backups according to the format, at least for Philz Touch Recovery.
In regards to the stock 4.4.4 with f2fs-all, I just had up a post about that.
Here it is: http://forum.xda-developers.com/showthread.php?t=2791580
GizmoTheGreen said:
nice! this collection of tools might have me finally trying f2fs on my Nexus5...
however, I've set my sights on this kernel http://forum.xda-developers.com/google-nexus-5/development/kernel-t2697951
there seems to be no interest to include f2fs support by default, could I perhaps ask for you to add it and compile? :angel:
I'm currently on stock 4.4.4 and faux kernel. but from what I read faux causes issues on f2fs-all, right? and other kernels I've looked at don't seem attractive enough to me... is there pure 4.4.4 stock with f2fs-all added? ^^ I found only 4.4.2 stock kernel.
Also... if I backup my /data can I restore it later onto f2fs partition? so I don't have to start from scratch and install/update apps?
no biggie, just wondering on this one.
thanks alot! :silly:
Click to expand...
Click to collapse
Sorry about the kernel but I only change the ramdisk to set which partitions are to boot with F2FS. So if it doesn't already support F2FS I don't know how to add it. I am relatively new to linux and android. I will like to setup a build environment and learn how to build the kernels and ROMs myself but I have been procrastinating as I need to free up some space on a drive.
Some kernels have the support but are not set up to boot the partitions. I am skimming the forums looking for different kernels to try.
At the moment I am using a CM (CAF based) kernel although there are a lot more ASOP kernels. I will try going to stock to try out some of them.
Huge time reduction!
Thank you for your mod.
Thanks for the great tools!
Could you please provide the modified f2fs-all Elemental X kernel you mentioned earlier? You seemed to have forgotten to post it.
mzheng086 said:
Thanks for the great tools!
Could you please provide the modified f2fs-all Elemental X kernel you mentioned earlier? You seemed to have forgotten to post it.
Click to expand...
Click to collapse
It is in post #7 but it is the caf version. Or did you want the AOSP version?
dechronic said:
It is in post #7 but it is the caf version. Or did you want the AOSP version?
Click to expand...
Click to collapse
I might have missed something obvious. In that case, please point it out to me. In post #7, I only see a link to the original thread of Elemental X kernel, and two links to the modified CM11 kernel. But there is no link to modified Elemental X kernel.
mzheng086 said:
I might have missed something obvious. In that case, please point it out to me. In post #7, I only see a link to the original thread of Elemental X kernel, and two links to the modified CM11 kernel. But there is no link to modified Elemental X kernel.
Click to expand...
Click to collapse
Oh shoot you are right. I don't how come I posted the same kernel twice. Uploading it now. I will edit that post and copy the link into the next post once I am done and I also have a link for Chaos-Kernel_v13.0-[07-08]-[11-16]-f2fs-all.zip (nightly) which I will post shortly too.
---Copied from Post #7--
You can get the working ElementalX 1.02cm F2FS-ALL version here:
http://d-h.st/oEt
Chaos Kernel v13.0 July 08 (nightly) - http://d-h.st/h3H
I tried your version of the tools on CharizardX (AOSP) kernel and this 4.4.4 stock rom. http://forum.xda-developers.com/goo...-android-4-4-3-ktu84m-rooted-busybox-t2557523
it failed to mount my data partition and I got a 128mb temp ramdrive at each boot... not sure what went wrong.
temp booted cwm recovery to reformat back to 4ext and then philz to restore my backup from usb drive, so I'm back at a working system...
edit:working now with your kernelupload in the other thread, but I can't seem to get superuser working, flashing koush's superuser via .zip. also I et a bootloop running antutu... probably kernel. what AOSP kernel do you recommend? I'd love to use faux's but last I heard there was trouble with wifi for some reason...
GizmoTheGreen said:
I tried your version of the tools on CharizardX (AOSP) kernel and this 4.4.4 stock rom. http://forum.xda-developers.com/goo...-android-4-4-3-ktu84m-rooted-busybox-t2557523
it failed to mount my data partition and I got a 128mb temp ramdrive at each boot... not sure what went wrong.
temp booted cwm recovery to reformat back to 4ext and then philz to restore my backup from usb drive, so I'm back at a working system...
edit:working now with your kernelupload in the other thread, but I can't seem to get superuser working, flashing koush's superuser via .zip. also I et a bootloop running antutu... probably kernel. what AOSP kernel do you recommend? I'd love to use faux's but last I heard there was trouble with wifi for some reason...
Click to expand...
Click to collapse
Honestly, I only just started using F2FS in the last week or so. I haven't tried an AOSP Roms yet to try out the AOSP kernels.
I just downloaded Slimkat as the script mounts the /data partition as well, so I have modify my script to account for that. I will try out some AOSP kernels that I will mod for F2FS-ALL and let you know what I got to work.
dechronic said:
I just downloaded Slimkat as the script mounts the /data partition as well, so I have modify my script to account for that. I will try out some AOSP kernels that I will mod for F2FS-ALL and let you know what I got to work.
Click to expand...
Click to collapse
You should be able to remove that mount if the user already has /data on f2fs, since data isn't normally formatted, and hence fully wiped and unmounted. If the user is migrating to f2fs, then, yes that would need to be changed. Also, ROM scripts format /system to ext4, which has to be removed or changed to the f2fs command.
Sent from my Nexus 5 using XDA Premium 4 mobile app
Волк said:
You should be able to remove that mount if the user already has /data on f2fs, since data isn't normally formatted, and hence fully wiped and unmounted. If the user is migrating to f2fs, then, yes that would need to be changed. Also, ROM scripts format /system to ext4, which has to be removed or changed to the f2fs command.
Sent from my Nexus 5 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
The script searches for the mount /data command because as was pointed out to me, some ROM scripts mount it. Particularly Slimkat. It only changes it if it finds it. Otherwise it is ignored. If the the ROM is selected to be reconfigured as F2FS-ALL then it looks for any format /system, mount /system and mount /data commands. If is set to reconfigured as F2FS-DATA then only the /data is mounted as F2FS if required by the ROM's updater script
Sent from my Nexus 5 using XDA Free mobile app

Categories

Resources