[HOW-TO] Convert to F2FS on Nexus 6 (Any Rom) - Nexus 6 General

I didn't see anything about how to convert to f2fs for the nexus 6 so I thought i'd write something up as somebody requested me to do this.
What are the benefits of using f2fs over ext4?
I could list pros and cons, but I strongly encourage you to do your own research on the matter.
Should I do this
If you want to at your own risk
Pre-requisites
You need a recovery that supports f2fs in kernel and has the f2fs tools. Dhacker20 has provided one (TWRP 2.8.5.0) here: https://twitter.com/dhacker29/status/568070387306766336
You will need a kernel that supports f2fs for /cache and /data (Obviously I recommend Zen Kernel, but there are some others. Zen has the newest f2fs from upstream, while others may not)
ONLY YOU ARE RESPONSIBLE FOR YOUR DATA. IT IS YOUR RESPONSIBILITY TO UNDERSTAND THE RISKS AND YOUR RESPONSIBILITY TO BACKUP YOUR DATA
How-To
1.) Back up everything you care about to your PC (everything will be erased, including sdcard)
2.) Install a kernel that supports f2fs. Get the boot.img and do "fastboot flash boot boot.img" in bootloader (Like Zen)
3.) Install the recovery with f2fs support (fastboot flash recovery twrp-recvery-f2fs.img)
4.) In TWRP, go to Wipe
5.) Do a full wipe by swiping right
6.) Go to Wipe -> Advanced Wipe
7.) Choose /cache
8.) Choose "Change Filesystem"
9.) Pick f2fs, proceed
10.) Do the same thing for /data
11.) While still in recovery, plug phone into PC and do this:
Code:
# adb shell
# mount -o rw /system
# cp /sbin/fsck.f2fs /system/bin/
# cp /sbin/mkfs.f2fs /system/bin/
# chmod a+x /system/bin/*f2fs*
12.) Reboot and you are done.

Reserved

Is adb shell in terminal app

jiv101 said:
Is adb shell in terminal app
Click to expand...
Click to collapse
No adb is part of the android SDK platform-tools

I did this a while ago (except for step 12), and I remember something happening, which caused my data partition to become corrupted. I tried to format the partition again using ext3 or whatever the default is and that ended up giving me a soft brick. I had to restore the factory software. I have read things of where it does improve R/W speeds but I don't know if it's worth the hassle of possibly losing everything at the drop of a hat if you flash ROMs often.

RSVP..
Thanks for the information on F2FS well needed..!

brando56894 said:
I did this a while ago (except for step 12), and I remember something happening, which caused my data partition to become corrupted. I tried to format the partition again using ext3 or whatever the default is and that ended up giving me a soft brick. I had to restore the factory software. I have read things of where it does improve R/W speeds but I don't know if it's worth the hassle of possibly losing everything at the drop of a hat if you flash ROMs often.
Click to expand...
Click to collapse
The last step is a huge component of the whole process. If the rom doesn't have f2fs-tools in by default (most don't have fsck.f2fs/mkfs.f2fs) you will not have standard integrity checking every time you boot like you do on ext4. If you do the last step you will get integrity checking every time you bootup.
Also, since f2fs is a relatively young file system it can do harm to revert to older versions of the file system. For example, zen kernel has the newest f2fs which was updated last about 2 days ago. If you go on stock kernel you will find an f2fs that is 1+ year old. There may be a compatibility issue between these two where if you flash different roms (which almost always bundle a kernel)/kernels you will almost certainly have an issue.
But that's all part of the risk with using a relatively young file system. I do not understate the risks of data corruption in doing something like this - but anybody who is doing this and has significant worry should take precautions is backing up all their important files.

bbedward said:
The last step is a huge component of the whole process. If the rom doesn't have f2fs-tools in by default (most don't have fsck.f2fs/mkfs.f2fs) you will not have standard integrity checking every time you boot like you do on ext4. If you do the last step you will get integrity checking every time you bootup.
Also, since f2fs is a relatively young file system it can do harm to revert to older versions of the file system. For example, zen kernel has the newest f2fs which was updated last about 2 days ago. If you go on stock kernel you will find an f2fs that is 1+ year old. There may be a compatibility issue between these two where if you flash different roms (which almost always bundle a kernel)/kernels you will almost certainly have an issue.
But that's all part of the risk with using a relatively young file system. I do not understate the risks of data corruption in doing something like this - but anybody who is doing this and has significant worry should take precautions is backing up all their important files.
Click to expand...
Click to collapse
Is there any sort of confirmations when you are doing the last steps? I see this when I do them and I'm not sure if it has actually done the last steps.
C:\Development\platform-tools>adb shell
~ # ←[6nmount -o rw /system
mount -o rw /system
~ # ←[6ncp /sbin/fsck.f2fs /system/bin/
cp /sbin/fsck.f2fs /system/bin/
~ # ←[6ncp /sbin/mkfs.f2fs /system/bin/
cp /sbin/mkfs.f2fs /system/bin/
~ # ←[6nchmod a+x /system/bin/*f2fs*
chmod a+x /system/bin/*f2fs*
~ # ←[6n
C:\Development\platform-tools>

lobrau said:
Is there any sort of confirmations when you are doing the last steps? I see this when I do them and I'm not sure if it has actually done the last steps.
C:\Development\platform-tools>adb shell
~ # ←[6nmount -o rw /system
mount -o rw /system
~ # ←[6ncp /sbin/fsck.f2fs /system/bin/
cp /sbin/fsck.f2fs /system/bin/
~ # ←[6ncp /sbin/mkfs.f2fs /system/bin/
cp /sbin/mkfs.f2fs /system/bin/
~ # ←[6nchmod a+x /system/bin/*f2fs*
chmod a+x /system/bin/*f2fs*
~ # ←[6n
C:\Development\platform-tools>
Click to expand...
Click to collapse
That's about it, you can type exit to get out of adb shell or just close it.
On your device you can make sure f2fs took by simply typing "mount" in terminal emulator. You should see you data and cache reads f2fs now.

lobrau said:
Is there any sort of confirmations when you are doing the last steps? I see this when I do them and I'm not sure if it has actually done the last steps.
C:\Development\platform-tools>adb shell
~ # ←[6nmount -o rw /system
mount -o rw /system
~ # ←[6ncp /sbin/fsck.f2fs /system/bin/
cp /sbin/fsck.f2fs /system/bin/
~ # ←[6ncp /sbin/mkfs.f2fs /system/bin/
cp /sbin/mkfs.f2fs /system/bin/
~ # ←[6nchmod a+x /system/bin/*f2fs*
chmod a+x /system/bin/*f2fs*
~ # ←[6n
C:\Development\platform-tools>
Click to expand...
Click to collapse
Nope, it will only inform you if something went wrong (like file not found) of it all went through with no error it worked.
After you bootup you can verify it worked by typing "mount" in adb shell or terminal emulator. It should say f2fs on /data and /cache. Also in something like root Explorer if you navigate to /system/bin you should see the files you copied (fsck.f2fs and mkfs.f2fs)

bbedward said:
Nope, it will only inform you if something went wrong (like file not found) of it all went through with no error it worked.
After you bootup you can verify it worked by typing "mount" in adb shell or terminal emulator. It should say f2fs on /data and /cache. Also in something like root Explorer if you navigate to /system/bin you should see the files you copied (fsck.f2fs and mkfs.f2fs)
Click to expand...
Click to collapse
Perfect thanks for the quick response looked like it worked. Just out of curiosity is there any reason to format system to f2fs or does it end up causing issues, or just no changes in use?

lobrau said:
Perfect thanks for the quick response looked like it worked. Just out of curiosity is there any reason to format system to f2fs or does it end up causing issues, or just no changes in use?
Click to expand...
Click to collapse
I've tested it partly in testing the newest f2fs Zen merges as well as just general f2fs testing before.
It seems like writes are a bit faster, especially sql stuff. I've seen some grossly huge benchmark differences on other devices - on the n6 I've seen improvements but nothing astronomical like those benchmarks portrayed (I presume the 200% increase in write performance they showed is not accurate regardless) .

Recovery
So currently I'm on a 5.1 stock based rom (sinless) and TWRP 2.8.6
HAve Downloaded the latest Zen Kernel, and am downloading the latest 5.1 Benzo Rom.
Am I going to have issues rolling back to a 2.8.5 recovery - does 2.8.5 support 5.1 based roms?

shaitan667 said:
So currently I'm on a 5.1 stock based rom (sinless) and TWRP 2.8.6
HAve Downloaded the latest Zen Kernel, and am downloading the latest 5.1 Benzo Rom.
Am I going to have issues rolling back to a 2.8.5 recovery - does 2.8.5 support 5.1 based roms?
Click to expand...
Click to collapse
Yea it's compatible. There isn't a 2.8.6 with f2fs support yet that I know if and I haven't had the time to make one myself, but the 2.8.5 one works just fine.

@bbedward
I didn’t know any about the part 11 (I mean I convert mine to F2FS before I read this) so I’m wondering I’m gonna face any problem or not?
And also if have to do it, can I do it now or I have to wipe everything and then do it (cause changing partition to F2FS will clean everything)
Also I’m on your kernel.

dany20mh said:
@bbedward
I didn’t know any about the part 11 (I mean I convert mine to F2FS before I read this) so I’m wondering I’m gonna face any problem or not?
And also if have to do it, can I do it now or I have to wipe everything and then do it (cause changing partition to F2FS will clean everything)
Also I’m on your kernel.
Click to expand...
Click to collapse
Every time you boot your phone, it automatically runs fsck (for ext4 on stock). Essentially it's an automatic integrity check and repair.
So if it finds issues at boot up in the file system, it will tend to fix them automatically. If you look at boot up logs currently you will probably see something like "/system/bin/fsck.f2fs not found skipping integrity check"
You don't have to wipe everything though, you can just install the tools now.
I'm almost happy I posted this now hopefully it saves a few filesystems for folks who didn't do it completely.
---
When you see a kernel say f2fs compatible it means:
- f2fs is built into the kernel or a module is provided
- It's ramdisk's fstab allows for mounting of partitions as f2fs. On zen - it supports /data and /cache
When you see a rom say f2fs compatible it means:
- They have an f2fs-compatible kernel included
- They have the f2fs tools in the rom (As step 11 does)
This is why I say in the title this is "Any Rom" compatible as it will work on any rom, while on other devices you may see "Rom x, rom y, and rom z are the only known roms to be fully compatible." If you just do it this way it doesn't matter because it'll make any rom compatible with f2fs.

@bbedward this worked perfectly! But I just want to confirm that it switches back to ext4 after flashing a new ROM? After wiping and doing a clean flash it seems I'm not booting in f2fs anymore.
Am I doing something wrong or will I have to do this every time I clean flash?
Thanks again for the tutorial!

philsfan said:
@bbedward this worked perfectly! But I just want to confirm that it switches back to ext4 after flashing a new ROM? After wiping and doing a clean flash it seems I'm not booting in f2fs anymore.
Am I doing something wrong or will I have to do this every time I clean flash?
Thanks again for the tutorial!
Click to expand...
Click to collapse
I think most likely when you flashed a rom it overwrote your f2fs kernel, which caused it to reformat to ext4 when you booted it up.
Whenever you flash a rom you will need to flash f2fs-kernel right afterwards, and re-copy the tools (step 11) if the rom doesnt have them already in order to keep f2fs.

bbedward said:
I think most likely when you flashed a rom it overwrote your f2fs kernel, which caused it to reformat to ext4 when you booted it up.
Whenever you flash a rom you will need to flash f2fs-kernel right afterwards, and re-copy the tools (step 11) if the rom doesnt have them already in order to keep f2fs.
Click to expand...
Click to collapse
Thanks for responding so soon!
So I did flash zen9 (so good BTW) immediately after but I didn't repeat step 11 again. So that means Chroma doesn't have the necessary files for f2fs, good to know!
Edit: @bbedward does that mean I don't have to reformat again? Just do step 11?
Edit 2: entered step 11 in recovery and now i'm back to f2fs thanks again!

bbedward said:
The last step is a huge component of the whole process. If the rom doesn't have f2fs-tools in by default (most don't have fsck.f2fs/mkfs.f2fs) you will not have standard integrity checking every time you boot like you do on ext4. If you do the last step you will get integrity checking every time you bootup.
Also, since f2fs is a relatively young file system it can do harm to revert to older versions of the file system. For example, zen kernel has the newest f2fs which was updated last about 2 days ago. If you go on stock kernel you will find an f2fs that is 1+ year old. There may be a compatibility issue between these two where if you flash different roms (which almost always bundle a kernel)/kernels you will almost certainly have an issue.
But that's all part of the risk with using a relatively young file system. I do not understate the risks of data corruption in doing something like this - but anybody who is doing this and has significant worry should take precautions is backing up all their important files.
Click to expand...
Click to collapse
That was probably it! It was just a pain because this is the first phone that I've had in a while that doesn't have an SD card, I had a nandroid, but it doesn't do any good if you can't access your data partition Hahaha I have now taken to uploading my nandroids to Google Drive or putting them on my pc just in case that happens.

Related

Minimal UI for LUKS encryption on the Wildfire

This is a basic gui I wrote to unlock my encrypted partitions during boot.
I'm running my /data and /sdcard partitions encrypted, and the "luksunlock" binary is launched from init.rc to read the password and unlock the encrypted partitions.
I have included my somewhat modified init.rc for those interested.
For more information about LUKS on Android see this blogpost, written by shawn (Seems I'm not allowed to have urls in the post, but Google for 'android luks' , first hit)
This works good on Wildfire, altough it should work fine on other phones as well. Just remember that you need to set up your partitions as in the luksunlock.c (or change the defines).
Dont forget to backup before you start playing around!
Good luck!
Thanks! i'll give a try!
Hi,
I tried to use your cryptsetup binary from your blog, but I have some issues that you'll sure have an answer:
I run ./cryptsetup luksFormat -c aes-plain /dev/block/loop2 and after i put the luks password it says 'Command failed', no logs, no other output, even using the -v flag...
Any clue?
Thanks in advance!
PS: the module dm-crypt is necessary for cryptsetup? could be this the error? I don't have it installed on the system because I can't find it for 2.6.35.9-cyanogenmod
tusabe said:
Hi,
I tried to use your cryptsetup binary from your blog, but I have some issues that you'll sure have an answer:
I run ./cryptsetup luksFormat -c aes-plain /dev/block/loop2 and after i put the luks password it says 'Command failed', no logs, no other output, even using the -v flag...
Any clue?
Thanks in advance!
PS: the module dm-crypt is necessary for cryptsetup? could be this the error? I don't have it installed on the system because I can't find it for 2.6.35.9-cyanogenmod
Click to expand...
Click to collapse
CM6.1 for wildfire uses a 2.6.32 kernel (see HCDR.jacob's post about his custom kernel for more info)
tusabe said:
PS: the module dm-crypt is necessary for cryptsetup? could be this the error? I don't have it installed on the system because I can't find it for 2.6.35.9-cyanogenmod
Click to expand...
Click to collapse
Yeah you really need dm-crypt support, either compiled into the kernel or as a module. You also need the AES ciphers support.
sigkill1337 said:
Yeah you really need dm-crypt support, either compiled into the kernel or as a module. You also need the AES ciphers support.
Click to expand...
Click to collapse
Hi! Yeah, that's what I was afraid of.... ok, but the problem is that i'm running CM6.1 with 2.6.35.9 which has no dm-crypt module neither compiled in kernel... where can i find some kernel with this modules included? Is for an HTC Desire (@Sympnotic )
Thanks in advance!
Great work and thanks for sharing @Sigkill. Working on building it here for my NexusOne with CM6.1.
BTW, I’m the lead on a project working on general secure Android distro – we’ve ported Tor, have an OTR IM app, and have supported other projects along those lines. Would love to talk more about supporting anyone working on this specific capability.
wow! awesome work!!! Very exciting news. Gonna give this a go on my MyTouch Slide
NathanFreitas said:
Great work and thanks for sharing @Sigkill. Working on building it here for my NexusOne with CM6.1.
BTW, I’m the lead on a project working on general secure Android distro – we’ve ported Tor, have an OTR IM app, and have supported other projects along those lines. Would love to talk more about supporting anyone working on this specific capability.
Click to expand...
Click to collapse
Seems really nice. I like the secure phone concept.
New Makefile and wiki info up
_hc from the @guardianproject has a new build process up for Crypsetup/LUKS which includes a Makefile compatible with Android NDK r5.
We have new instructions up on our wiki, as well.
I cannot post links under this account, but you can find the info on github if you search "LUKS" or just under our guardianproject account.
How did you create the encrypted partitions? Could you give some pointers for that. I am familiar with using dmcrypt/cryptsetup on desktop linux, I guess this works similar. What are the relevant device names? Did you run into any problems?
Calavera1 said:
How did you create the encrypted partitions? Could you give some pointers for that. I am familiar with using dmcrypt/cryptsetup on desktop linux, I guess this works similar. What are the relevant device names? Did you run into any problems?
Click to expand...
Click to collapse
Hi, sorry for the late answer,
/dev/block/mtdblock5 is the "userdata" partition. I formatted it and mount it to /encrypted-data during init:
mount yaffs2 [email protected] /encrypted-data nosuid nodev
The only file on this partition is "data.encrypted" file, which gets created in init.rc as a loopback device:
exec /system/bin/losetup /dev/block/loop0 /encrypted-data/data.encrypted
I created the "data.encrypted" file on my computer with cryptsetup and losetup, and copied all files from my old unencrypted userdata partition to it and then copied it back as a file to the formated userdata partition.
The sdcard "/dev/block/mmcblk0p2" partition is formated with "cryptsetup luksFormat", I did this also on my computer, saves some time. And then copy everything from the old unencrypted sdcard.
I did run in to one problem recently, my phone hung during boot, about 4 months after I started encrypting my phone.
Had to copy my data.encrypted file to my computer, mount it as a loopback device and do a fsck, and then copy it back to my phone.
I suspect this has to do with the filesystem not being umounted properly. (I have had this on my to do list for a while hehe)
Probably should make a script run during shutdown to cleanly "luksClose" the encrypted partition and then umount them. Not doing this is probably very crazy
I also want to fix it so my "/dev/block/mmcblk0p2" partition gets presented to my computer when i attach my usb cable (as it should do), so i can unlock it in ubuntu and copy images and files. Right now i have to take my memorycard out and put it into the computer.
I hope this post makes sense, it was written in haste =) Good luck!
sigkill1337 said:
Hi, sorry for the late answer,
/dev/block/mtdblock5 is the "userdata" partition. I formatted it and mount it to /encrypted-data during init:
mount yaffs2 [email protected] /encrypted-data nosuid nodev
The only file on this partition is "data.encrypted" file, which gets created in init.rc as a loopback device:
exec /system/bin/losetup /dev/block/loop0 /encrypted-data/data.encrypted
I created the "data.encrypted" file on my computer with cryptsetup and losetup, and copied all files from my old unencrypted userdata partition to it and then copied it back as a file to the formated userdata partition.
The sdcard "/dev/block/mmcblk0p2" partition is formated with "cryptsetup luksFormat", I did this also on my computer, saves some time. And then copy everything from the old unencrypted sdcard.
I did run in to one problem recently, my phone hung during boot, about 4 months after I started encrypting my phone.
Had to copy my data.encrypted file to my computer, mount it as a loopback device and do a fsck, and then copy it back to my phone.
I suspect this has to do with the filesystem not being umounted properly. (I have had this on my to do list for a while hehe)
Probably should make a script run during shutdown to cleanly "luksClose" the encrypted partition and then umount them. Not doing this is probably very crazy
I also want to fix it so my "/dev/block/mmcblk0p2" partition gets presented to my computer when i attach my usb cable (as it should do), so i can unlock it in ubuntu and copy images and files. Right now i have to take my memorycard out and put it into the computer.
I hope this post makes sense, it was written in haste =) Good luck!
Click to expand...
Click to collapse
I figured most of that out without your post and tried it on my desire (I created the luks partitions with adb on the phone though, worked anyway ). Then I couldn't figure out where my regular init.rc is stored (I could only find the one used by Clockwork Recovery), and then I figured I already spent enough time, tried a reboot (which of course didn't work). Then I couldn't even get into recovery (probably because its init.rc tries to mount /data which doesn't work? I didn't investigate any further). Flashed my backup with fastboot and was stuck again with my un-encrypted pre-experiment state
Oddly enough, it was no problem to unlock my encrypted SD-card from my computer (running ubuntu) while in recovery (clockword has an option to present the sd card to a computer connected via usb). Maybe the booted system handles this differently than recovery though? I didn't get a chance to try, as I couldn't boot after my encryption attempt.
I will try again after my algorithm and data structure exam this friday and report back
Is anybody using the UI on another device than the Wildfire? Does it work?
How much is the performance drain when using an encrypted /data partition?
Amazing work!
Did anyone manage to make sigkill1337's luksunlock build from source ?
I would like to change the path of the data/sdcard partitions to match my device but I tried many ways using the NDK and I can't get it to compile properly.
Is there any way to do this ?
I have been trying for days, I am getting literaly insane !
@sigkill1337 : could you give me some pointers ? I would appreciate a lot.
mount manpage said:
The bind mounts.
Since Linux 2.4.0 it is possible to remount part of the file hierarchy somewhere else. The call is
mount --bind olddir newdir
or shortoption
mount -B olddir newdir
or fstab entry is:
/olddir /newdir none bind
After this call the same contents is accessible in two places. One can also remount a single file (on a single file).
This call attaches only (part of) a single filesystem, not possible submounts. The entire file hierarchy including submounts is attached a second place using
mount --rbind olddir newdir
or shortoption
mount -R olddir newdir
Note that the filesystem mount options will remain the same as those on the original mount point, and cannot be changed by passing the -o option along with --bind/--rbind. The mount options can be changed by a separate remount command, for example:
mount --bind olddir newdir
mount -o remount,ro newdir
Click to expand...
Click to collapse
If nothing helps, you should always be able to bindmount it
I'd rather get sigkill1337's UI to compile...
Lots of nice security tweaks and settings could be done with a pre-boot GUI
Anyway, concerning encryption, I'll use the bind option for now, thanks for the tip.
But if anyone here could give me some pointers about compiling this stuff it would be great.
I managed to compile it by integrating luksunlock in Android source externals and main.mk but when I push it to my phone and modify init.rc to call it, it just does not work...
Other modifications are working (mount, mkdir, etc.) but the GUI won't show up
Sorry for the late reply.. But you could try running it from a shell when the phone is booted, just to verify that the binary starts (thats how I tested it without having to reboot my phone all the time)
My environment for building the source was setup using one of the tutorials online, nothing out of the ordinary
Im still running this on my phone, for almost 8 months now, I havent noticed that much in performance problems, the Wildfire was slow before i started using luks.
When i get a new phone (maybe SE Arc) i will be easier to see if performance is affected
There is an Issue for getting CM support for encrypted filesystems during boot:
Issue 2736: support encrypted filesystem from boot
If you want to get that feature, just "star" it, so it may get more attention.

Thread closed.

Thread closed.
Thread closed.
Yank555 said:
Hi,
REMEMBER
FIRST OF ALL, do a Nandroid backup, as well as a backup of your sd-card content !
You're doing this at your very own risk, I'm not to be held responsible if something goes wrong
Now that said, let's get going
In case somebody wants to check it out, here is the swap activation script I wrote (attached) as well as explanations on how to make it all work :
1) Partition your sd-card (Minitool Partition Wizard, 4ext, CWM...)
2) Boot your system with the partitionned sd-card
3) If necessary customize the 99swap script (attached to this post) and then put it onto your sd-card's root folder, you'll need it while executing the commands in step 4.
4) Open a terminal and type the following
NB: Change "mkswap /dev/block/mmcblk0p3" accordingly to point to the swap partition you've created in step 1.
5) Reboot your phone, start a terminal again and type free, you'll need to see something different than 0 in your swap line, look at the attached print-screen
Swappiness will be set to 50 by the script, which is a rather conservative swap use, made sense to me since SD-swap is slower than ram, better not to use it too agressively. Feel free to experiment with the swappiness variable in the script (values between 0 and 100, 0 meaning "try not to swap", 100 meaning "try to swap all the time")
If you want to try and have a question, just let me know !
JP.
PS: You can find the thread for hard swap for the htc Sensation / XE here.
Click to expand...
Click to collapse
Hi JP,
This is a gem of a post! Thanks alot for the script and the detailed breakdown. Before I get into it though, I must warn you that I am more of a beginner with no coding/scripting experience (I don't know how to use adb or anything)...
Here's what I'm trying to do: I'm trying to activate hard-swap on my hd2 (currently) running the ParanoidAndroid by Xylograph. I've created 3 partitions on my 16gb class 6 sd card: first, fat32 (32k cluster), next, 1GB ext2 (default), 500MB swap.
Procedure:
1. I extracted the script and copied it directly to system/etc/init.d folder of the Rom (I looked at the terminal commands you posted and the first few lines looked like copying the file from the sd root to the init.d folder (it was just a guess though), so I figured might as well put it into the rom before I flash it)
2. Flashed the rom
3. To activate it, I typed the following into the terminal:
su
mount -o remount,rw /system
mkswap /dev/block/mmcblk0p3
mount -o remount,ro /system
exit
after the mkswap command, I did get an activation notification that a certain amount was assigned to swap. But my celebrations were cut short after I rebooted and used the free command to check. The entire swap row still read 0.
I was wondering if you can point me in the right direction... thanks!
Also, is there a way to create a cwm flashable version?
bullcrapr said:
Hi JP,
This is a gem of a post! Thanks alot for the script and the detailed breakdown. Before I get into it though, I must warn you that I am more of a beginner with no coding/scripting experience (I don't know how to use adb or anything)...
Here's what I'm trying to do: I'm trying to activate hard-swap on my hd2 (currently) running the ParanoidAndroid by Xylograph. I've created 3 partitions on my 16gb class 6 sd card: first, fat32 (32k cluster), next, 1GB ext2 (default), 500MB swap.
Procedure:
1. I extracted the script and copied it directly to system/etc/init.d folder of the Rom (I looked at the terminal commands you posted and the first few lines looked like copying the file from the sd root to the init.d folder (it was just a guess though), so I figured might as well put it into the rom before I flash it)
2. Flashed the rom
3. To activate it, I typed the following into the terminal:
su
mount -o remount,rw /system
mkswap /dev/block/mmcblk0p3
mount -o remount,ro /system
exit
after the mkswap command, I did get an activation notification that a certain amount was assigned to swap. But my celebrations were cut short after I rebooted and used the free command to check. The entire swap row still read 0.
I was wondering if you can point me in the right direction... thanks!
Also, is there a way to create a cwm flashable version?
Click to expand...
Click to collapse
Thanx
In fact you understood correctly that is was about copying the file to init.d.
By the way, these commands do the following :
mount -o remount,rw /system - Mount system partition in read-write
mount -o remount,ro /system - Mount system partition in read-only
So to format the swap partition "mkswap /dev/block/mmcblk0p3" there was no need for it, but it didn't harm in any way, so you're fine there
I guess what is missing is the "chmod 755 /system/etc/init.d/99swap" command which will set the correct file access to the script so it can get executed at boot.
You might do the following in a terminal :
su
mount -o remount,rw /system
chmod 755 /system/etc/init.d/99swap
mount -o remount,ro /system
exit
It should be fine then.
Alternatively you could set the rights with your file explorer (in root explorer mode), they must be "rwxr-xr-x" (which is Read-Write-Execute, Read-Execute, Read-Execute), most file-manager will allow you to do that as well.
I've been working on the script variant for htc Sensation, it is more advanced, dynamic so it can find the swap partition by itself.
I'll make a CWM flashable as soon as I get to it that will handle everything except partitioning the SD card, obviously, for both devices.
As soon as I'm done I'll post the HD2 version here as well (very little change, between both devices, just the access path to the sd-card partitons to change (=1 line in the script).
JP.
Edit ------------------------------------------------
I just reread your post, if in fact you put it into the ROM zipfile, then file access should be correct !?
Could you post the following file (if it exists) :
/data/swap.0.log ?
JP.
Yank555 said:
Thanx
In fact you understood correctly that is was about copying the file to init.d.
By the way, these commands do the following :
mount -o remount,rw /system - Mount system partition in read-write
mount -o remount,ro /system - Mount system partition in read-only
So to format the swap partition "mkswap /dev/block/mmcblk0p3" there was no need for it, but it didn't harm in any way, so you're fine there
I guess what is missing is the "chmod 755 /system/etc/init.d/99swap" command which will set the correct file access to the script so it can get executed at boot.
You might do the following in a terminal :
su
mount -o remount,rw /system
chmod 755 /system/etc/init.d/99swap
mount -o remount,ro /system
exit
It should be fine then.
Alternatively you could set the rights with your file explorer (in root explorer mode), they must be "rwxr-xr-x" (which is Read-Write-Execute, Read-Execute, Read-Execute), most file-manager will allow you to do that as well.
I've been working on the script variant for htc Sensation, it is more advanced, dynamic so it can find the swap partition by itself.
I'll make a CWM flashable as soon as I get to it that will handle everything except partitioning the SD card, obviously, for both devices.
As soon as I'm done I'll post the HD2 version here as well (very little change, between both devices, just the access path to the sd-card partitons to change (=1 line in the script).
JP.
Edit ------------------------------------------------
I just reread your post, if in fact you put it into the ROM zipfile, then file access should be correct !?
Could you post the following file (if it exists) :
/data/swap.0.log ?
JP.
Click to expand...
Click to collapse
Hi JP
You are incredibly helpful and I appreciate it!
I finally got some time off and tried out what you mentioned... but to no avail. I applied the necessary permissions through the terminal (chmod 755) as well as through the root browser, but it was still the same. After that I even retried the terminal commands, and included the "chown 0:2000...", but that didn't work either...
... and then I saw your post update...
About that, i just typed it into the terminal, and I got "not found".
Was that what I was supposed to do?
bullcrapr said:
Hi JP
You are incredibly helpful and I appreciate it!
I finally got some time off and tried out what you mentioned... but to no avail. I applied the necessary permissions through the terminal (chmod 755) as well as through the root browser, but it was still the same. After that I even retried the terminal commands, and included the "chown 0:2000...", but that didn't work either...
... and then I saw your post update...
About that, i just typed it into the terminal, and I got "not found".
Was that what I was supposed to do?
Click to expand...
Click to collapse
Hi,
You're welcome
The file '/data/swap.0.log' is a text-file containing info on the execution of the script...
If it's not there, then the script didn't run at all...
I should have a little time later today, will try to make the CWM flashable solution for you, should be a no fuss solution, as long as the sd-card has a swap partition
How did you partition the card ? CWM ?
JP.
Sent from my Android Revolution HD 6.6.5 XE / faux kernel 007b3 powered htc Sensation XE using xda premium
I created a 256Gb partition...
Click to expand...
Click to collapse
man thats a helluva sd card ya have there! hehe.
samsamuel said:
man thats a helluva sd card ya have there! hehe.
Click to expand...
Click to collapse
Haha I noticed that too :') I want one of those now
Nigeldg said:
Haha I noticed that too :') I want one of those now
Click to expand...
Click to collapse
Thanx for pointing that out Mb of course, but in a few years that might be possible
My first hdd had 60Mb, and that's not soooo long ago
JP.
Sent from my Android Revolution HD 6.6.5 XE / faux kernel 007b3 powered htc Sensation XE using xda premium
heh, my first was a 20mb HDD mounted on a pcb card and plugged into an ISA slot, took up the full length of the PC, weighed LOADS, could have beaten burglars to death with it.
bullcrapr said:
Hi JP
You are incredibly helpful and I appreciate it!
I finally got some time off and tried out what you mentioned... but to no avail. I applied the necessary permissions through the terminal (chmod 755) as well as through the root browser, but it was still the same. After that I even retried the terminal commands, and included the "chown 0:2000...", but that didn't work either...
... and then I saw your post update...
About that, i just typed it into the terminal, and I got "not found".
Was that what I was supposed to do?
Click to expand...
Click to collapse
+1 with this (also on Paranoid Rom 1.1a) but I think that it's something with the ROM coz on earlier build v1 this method worked verry good I hope that Yank will find a solution coz it reallly helps wit our 576 ram
samsamuel said:
heh, my first was a 20mb HDD mounted on a pcb card and plugged into an ISA slot, took up the full length of the PC, weighed LOADS, could have beaten burglars to death with it.
Click to expand...
Click to collapse
Mine was huge at the time, was on of the first to have such a big one, even partitioned it into 3 since it was just too big And it was an external device, the size of a pizza-box (it was en Atari Megafile 60, I still have it !!).
triggaz said:
+1 with this (also on Paranoid Rom 1.1a) but I think that it's something with the ROM coz on earlier build v1 this method worked verry good I hope that Yank will find a solution coz it reallly helps wit our 576 ram
Click to expand...
Click to collapse
I'm working on the CWM flashable right now, should be done within 1-2 hours at most
Yank555 said:
Hi,
You're welcome
The file '/data/swap.0.log' is a text-file containing info on the execution of the script...
If it's not there, then the script didn't run at all...
I should have a little time later today, will try to make the CWM flashable solution for you, should be a no fuss solution, as long as the sd-card has a swap partition
How did you partition the card ? CWM ?
JP.
Sent from my Android Revolution HD 6.6.5 XE / faux kernel 007b3 powered htc Sensation XE using xda premium
Click to expand...
Click to collapse
Hi JP, once you told me it was the address to the file, i just navigated there using my explorer and lo and behold!, there it was (attached). If you must know, in my earlier post, the idiot in me just typed it in the terminal and the terminal replied not found.
I made my partition using freeware called Minitool partition wizard. Is 500mb too big for swap in your opinion? I was thinking of compensating for zram, and hence the size... thanks for your speedy responses...
edit...
and hey! whadya know? in the meantime, this place is coming alive!!
bullcrapr said:
Hi JP, once you told me it was the address to the file, i just navigated there using my explorer and lo and behold!, there it was (attached). If you must know, in my earlier post, the idiot in me just typed it in the terminal and the terminal replied not found.
I made my partition using freeware called Minitool partition wizard. Is 500mb too big for swap in your opinion? I was thinking of compensating for zram, and hence the size... thanks for your speedy responses...
edit...
and hey! whadya know? in the meantime, this place is coming alive!!
Click to expand...
Click to collapse
Hmm ... strange, the content of the file looks like a logcat ?! Not what I was expecting to see
Give me a little hour, and I think I should be done with the flashable hard-swap and we'll go from there
Minitool is excellent, but did you pay attention to only create "primary" partition ? If it is a logical partition it won't work...
Can you insert your SD card into your card reader, start Minitool an post a print screen of it ?
JP.
EDIT :
About size ... I believe 256Mb is enough, even read somewhere t shouldn't be more than 256, but I think there was no specific reason given.
Yank555 said:
Hmm ... strange, the content of the file looks like a logcat ?! Not what I was expecting to see
Give me a little hour, and I think I should be done with the flashable hard-swap and we'll go from there
Minitool is excellent, but did you pay attention to only create "primary" partition ? If it is a logical partition it won't work...
Can you insert your SD card into your card reader, start Minitool an post a print screen of it ?
JP.
EDIT :
About size ... I believe 256Mb is enough, even read somewhere t shouldn't be more than 256, but I think there was no specific reason given.
Click to expand...
Click to collapse
Here we go...
Minitool image attached... I typically pay attention to the partition type and made sure both of them were primary
About the logcat, I suspect you're right... I was trying to do one from my pc for the first time using adb and tried the only few commands I know (mkswap...), I think that's what you saw then...
Incidentally, do you feel if I reduce the swap size, the script has a better chance at surviving the boot?
bullcrapr said:
Here we go...
Minitool image attached... I typically pay attention to the partition type and made sure both of them were primary
About the logcat, I suspect you're right... I was trying to do one from my pc for the first time using adb and tried the only few commands I know (mkswap...), I think that's what you saw then...
Incidentally, do you feel if I reduce the swap size, the script has a better chance at surviving the boot?
Click to expand...
Click to collapse
Don't bother, I will test 500Mb and let you know if that is the issue
JP.
I have 512mb partition and it worked without problems as I mentioned earlier so I think that opposite to the "size does matter" in this case it doesn't plus I used it with zram from marc1706.
triggaz said:
I have 512mb partition and it worked without problems as I mentioned earlier so I think that opposite to the "size does matter" in this case it doesn't plus I used it with zram from marc1706.
Click to expand...
Click to collapse
Hi triggaz, are you using the built in zram on Para1.1a? Or have you applied a script from elsewhere? I enabled the built-in zram, but get a "not found" reply when i try zram_stats in the terminal. Can you tell me how you got zram working? thanks...
bullcrapr said:
Hi triggaz, are you using the built in zram on Para1.1a? Or have you applied a script from elsewhere? I enabled the built-in zram, but get a "not found" reply when i try zram_stats in the terminal. Can you tell me how you got zram working? thanks...
Click to expand...
Click to collapse
https://www.dropbox.com/s/xr3z102gxiw2f62/marc1706_zram_100MB.zip
all credits to Dorimanx for ZRAM mod and mark1706 for modifications
I flashed this and then used the compcashe options in Paranoid (set to 26%)

[vision][fried emmc] Booting CM 7.2 from SD card

Hi there,
I just found catherall's thread on [how to boot CM 7.1 from the external SD card][0] on a Desire Z/G2 with the infamously fried eMMC.
I used his instructions to boot CM 7.2 (the last stable version for the Vision); since the above thread ends with a dangling question on how to update the system to be booted, I thought I'd document my efforts.
anonymousthing said:
anybody know what system.img format he is using?
Click to expand...
Click to collapse
It's just an ext4 file system:
Code:
$ file system.img
system.img: Linux rev 1.0 ext4 filesystem data, UUID=b4db3ed8-7d52-46a0-85fb-46fb67c5e837 (needs journal recovery) (extents) (huge files)
$ adb shell
~ # mount | grep system
/dev/block/loop0 on /tmp/boot.img-ramdisk/system type ext4 (rw,nodev,noatime,nodiratime,nouser_xattr,commit=19,barrier=0,data=ordered)
Disclaimer: On the original image, `file` actually identifies the FS as a `mounted or unclean` ext2; it's definitely an ext4 with journaling, though. Accordingly a `mount -t ext2` will fail with a `wrong fs type`.
You can create a new one with
Code:
$ dd if=/dev/zero of=system.img bs=4k count=64000
$ /sbin/mkfs.ext4 system.img
# mount -o loop -t ext4 system.img /media/new_sys
anonymousthing said:
I have tried making my own system.img from the rom but it does not work
Click to expand...
Click to collapse
This is potentially due to missing binaries:
Code:
$ diff -r /media/orig_sys update-cm-7.1.0-vision-signed/system | head -n 5
Only in /media/orig_sys/bin: cat
Only in /media/orig_sys/bin: cmp
Only in /media/orig_sys/bin: date
Only in /media/orig_sys/bin: dd
Only in /media/orig_sys/bin: dmesg
If you download a version of CM, at least the `toolbox` and the `busybox` binaries will be missing from the `system/bin` and `system/xbin` directories respectively. I couldn't be bothered to check for up-to-date versions but just copied the ones provided by catherall before copying over the new CM version:
Code:
# cp -r /media/orig_sys/bin /media/orig_sys/xbin /media/new_sys
# cp -r cm-7.2.0-vision/system/* /media/new_sys
This will obviously update all the files that come with CM 7.2 and just keep what's not included in the box.
While you're at it, you might want to add up-to-date gapps:
Code:
# cp -r gapps-gb-20131214-signed/system/* /media/new_sys
This gives you a booting CM 7.2. Just replace the `system.img` that comes with catherall's `.zip` with the one you just created and off you go
Unpleasant issue: Booting from SD seems to require a specifically prepared kernel, so the `boot.img` that comes with a different ROM/CM version won't work. So until someone finds out how to prepare a kernel for booting from SD, you will have to continue to boot the one provided by catherall. However, the WIFI driver has not been compiled into the kernel but lives in a separate kernel module in `/system/lib/modules/bcm4329.ko`. Which we (by copying over the `/system` dir from the CM 7.2 build) replaced with a version incompatible with the old kernel we have to boot. So if you intend to boot through `fastboot` and use WIFI (and why wouldn't you? ;P), we will have to put the old kernel module back:
Code:
# cp /media/orig_sys/lib/modules/bcm4329.ko /media/new_sys/lib/modules/
Weirdly enough, in the CM 7.2 version I downloaded, the permissions for the `dhcpd-run-hooks` script were broken, so I at least needed to fix those too:
Code:
# chmod 550 /media/new_sys/etc/dhcpd/dhcpd-run-hooks
So, `umount` your pristine new `system.img`, move it to your SD card and boot into CM 7.2.
HTH
D.
PS I naively tried to create a larger 1 GB `data.img`, copying over the content from the existing one, but the phone didn't boot with that one. I might have made a mistake (was rather late at that point -.- and I didn't investigate any further), but it seems like the size of the partitions may be hardcoded somewhere. If someone has any additional information, please let me know Thx!
PPS If anyone ([MENTION]@catherall[/MENTION]? ;P) knows anything about the kernel issue, I'd be highly interested
PPPS After creating this account (to be fair, I've been profiting from this community since the old Windows Mobile days), I was informed that as an account noob, I obviously didn't have anything to contribute to this community and was ordered to place my undoubtedly profane question (which certainly had been answered may times before, I was only too lazy/dumb to search) outside the elite developer forums [/rage]. Maybe one of the Mods can stitch the [original thread][0] and this st0pid workaround back together again? :/ Thanks!
[0]: http://forum.xda-developers.com/showthread.php?t=1572924

[MOD][SCRIPT] Get More Storage by Relocating Dalvik Cache!

DISCLAIMER: YOU AGREE TO TAKE FULL RESPONSIBILITY FOR YOUR DEVICE IF YOU PROCEED.
The original thread (http://forum.xda-developers.com/moto-g/general/mod-save-data-space-cache-partition-t2942765) was getting to cluttered up with development and testing so I decided to start a new thread with the "finished" product. The original thread will be renamed to Q&A/Development. We might even ask for the old thread to be closed down. (up to @Bert98, the thread's creator.)
Moto G's internal eMMC card has a ~600Mb partition called /cache, which is not used since the apps' cache is stored in /data, so the latter fills up and the first one stays empty.
Owning a 8Gb model, having 600Mb not available for storage really bugged me, because my phone's memory (/data partition) was always full because it's a 5.7Gb space shared between apps and microSD files.
Now, it may not work for you if:
a) you have A LOT of apps installed.
And by "a lot", I mean more than 90-100 apps, but if you have a 8Gb model, you probably don't
b) you're running ART (this is default in lollipop and newer)
Since ART uses a lot more space than dalvik, the space in the /cache partition probably won't be enough. When I was running ART, it used 1Gb more than dalvik.
Original post by @Bert98
Click to expand...
Click to collapse
This was tested on my moto g 16GB which is running RetailUS_4.4.4 kitkat with CWM recovery. The custom ROM procedure was tested on the same phone but with cm11 Nightly installed.
Prerequisites:
1. You must have "adb root" functioning. If you don't head to this thread: http://forum.xda-developers.com/showthread.php?t=1687590 and there is a free download link at the bottom of the post.
Download and install the apk on your phone. Open up adbd insecure (the new app) and grant it superuser rights PERMANENTLY. Check the box that says "enable insecure binary" and make sure to check the box
that says "enable at boot."
2. You must have a recovery that can accept adb shell commands.
3. Root Access Duh?!
4. A windows machine capable of running batch files.
5. A decent text editor, notepad will work but notepad++ is strongly recommended. (Only needed if you are using STOCK ROM procedure)
Please, please make a nandroid backup before you continue!!!!
Stock ROM procedure:
Read the directions very carefully and then read them again, before continuing.
1. Download the cachemover_v1.3.zip from: LINK REMOVED DUE TO SCRIPT ISSUES.
2. Extract the contents.
3. Connect device to PC and navigate to the extracted folder.
4. Double click/Run the cachemover_Stock.bat
5. Follow the onscreen instructions until you get to the part where it says to edit a file.
6. About halfway through the script it will pull a file called "init.qcom.post_boot.sh" to the folder.
7. Open it with a TEXT editor and navigate to about line 487 (Might be different for 8gb model). Look here for a better understanding: https://www.dropbox.com/s/jr5lyl5s5i2jtpg/where to paste code.PNG?dl=0
8. Start a new line and paste this code in the file: (Refer to the image above for help)
Code:
chmod 655 /cache
chmod 655 /cache/dalvik-cache
chmod 655 /cache/dalvik-cache/*
9. Make sure to save the file in the same folder as the cachemover_Stock.bat
10. Press any key to continue on the script and let it do its thing.
11. It will reboot several times and land you on the home screen/lock screen.
12. If the script hangs after a reboot, you need to unlock the device to reestablish a connection with your computer.
13. There might be one or two force closes but once you close the notifications they will not come back.
Custom ROM procedure:
USE THIS FOR ROMS THAT DO NOT REMOUNT OR CHANGE PERMISSIONS OF /CACHE ON BOOT
1. Download the cachemover_v1.3.zip from: https://www.dropbox.com/s/bzj34g4q1s61ojz/cachemover_v1.3.zip?dl=0
2. Extract the contents.
3. Connect device to PC and navigate to the extracted folder.
4. Double click/Run the cachemover.bat
5. Follow the onscreen instructions.
If anything goes wrong:
Go to recovery, wipe cache, then wipe dalvik-cache and reboot. This should get your device back to how it was.
(If you used STOCK ROM procedure)
The script made a backup of the "init.qcom.post_boot.sh" file to /sdcard/init_backup
You can restore the shell script to /system/etc/ via shell commands or by using a root browser. To restore permissions:
Code:
chmod 740 /system/etc/init.qcom.post_boot.sh
chown root:root /system/etc/init.qcom.post_boot.sh
Custom ROM procedure already has a restore script!
I am currently working on an auto restore script for stock and that will be relased soon, hopefully! :good:
Changelog:
v1.0 - First stable release. Does not work on STOCK ROM.
v1.1 - Added a restore script.
v1.3 - Added support for STOCK ROM. There are still a few bugs.
How it works?!?!
Coming soon...
Huge thanks to @Bert98 and @dd043
Hit the thanks button if it worked! I went through about 50 factory resets, and reflashed the ROM about 25 times, and put about 10 hours of work into this script! Really motivates me for future projects. :laugh:
Thanks for your help man and effort.
I encountered a problem, everything works up until my device boots in CWM to fix permissions, then just sits there doing not alot I don't even see the option in my CWM.
Any ideas? cheers
Sent from my XT1032 using XDA Free mobile app
When it reboots to cwm unplug the cable and replug it, if it hangs just type these commands manually from a command window.
chmod 655 /cache
chmod 655 /cache/dalvik-cache
chmod 655 /cache/dalvik-cache/*
reboot
If this does not work you may ned to go into mounts & storage in the cwm menu and click mount /cache. Then try the commands again.
I'm having some issues on stock.
I thought 0655 fixed everything but no, I can't install any app after moving the dalvik-cache to /cache. I tried chmoding 0777 on the new cache folder, on /cache itself, to no avail.
Code:
E/dexopt cannot open '/data/dalvik-cache/[email protected]' for output
Anyone can confirm it's not only my device? And/or can help find a fix?
Also does someone knows how to execute commands on a particular init step? Real init.rc scripts can do:
Code:
on post-fs-data
mount -o bind /cache/dalvik /data/dalvik-cache
It there was a way to achieve the same from post_boot/init.d we could mount -o bind /cache/dalvik /data/dalvik-cache and all permissions issues would disappear as well as the need for symlink.
You have a typo in the threads title. Just a heads up.
Vuciz said:
You have a typo in the threads title. Just a heads up.
Click to expand...
Click to collapse
Thanks for letting me know!
dd043 said:
I'm having some issues on stock.
I thought 0655 fixed everything but no, I can't install any app after moving the dalvik-cache to /cache. I tried chmoding 0777 on the new cache folder, on /cache itself, to no avail.
Code:
E/dexopt cannot open '/data/dalvik-cache/[email protected]' for output
Anyone can confirm it's not only my device? And/or can help find a fix?
Also does someone knows how to execute commands on a particular init step? Real init.rc scripts can do:
Code:
on post-fs-data
mount -o bind /cache/dalvik /data/dalvik-cache
It there was a way to achieve the same from post_boot/init.d we could mount -o bind /cache/dalvik /data/dalvik-cache and all permissions issues would disappear as well as the need for symlink.
Click to expand...
Click to collapse
Let me try and do that right now... Ill get back to you if it does!
My script works on stock btw... But the mount way seems a bit easier and might cause less errors than my way.
Try it please.
skyguy126 said:
Let me try and do that right now... Ill get back to you if it does!
My script works on stock btw... But the mount way seems a bit easier and might cause less errors than my way.
Try it please.
Click to expand...
Click to collapse
Yes I've tried your script, all went well but the result is the same. The script itself works nicely btw
Applications present before moving cache work perfectly, but I can't install anything new. I suspect it might be my device but before wiping everything I'd prefer feedback from others :fingers-crossed:.
I cannot install new apps as well. The mount command you showed me has the same effect too. I honestly don't know anymore, the sym link did not allow the install of new apps nor did the mount command you sent me. Correct me if I am wrong.
Edit: Going through all the init files on my phone to see which one remounts /cache at boot.
Why does the init.rc get overwritten at boot. Is it because the kernel (boot.img) is the one that copies it over? I have found by changing the perms/locations in this file and init.target.rc you can achieve what this mod is trying to acomplish.
I don't see the mount cache command in CWM strange
I've managed to get back to normal, thanks for everyone's help though, I will keep and eye on the thread
Sent from my XT1032 using XDA Free mobile app
non-windows version?
Thanks for this tool. It's a great idea and our Motos really need it.
However, I have a problem - I do not own a windows license (os x and ubuntu user) and I would prefer not to spend $120 just to use it for this script. Pirating is out of the question for me.
I was wondering if there is any chance of having this script written for linux and/or mac. If impossible, is there a LEGAL way of running windows in a virtual machine? Something like a trial or similar?
If you know how just convert it to shell script for osx and Linux. I give you permission to do this but you may not take credit or rehost your creation.
Ok so I have the kernel extracted and we could modify and flash that, but I believe that it's not really necessary. There are a lot of risks to flashing kernels and I am not willing to take it. So is there a way we can modify dalvik so it creates it's cache in /cache instead.
skyguy126 said:
Why does the init.rc get overwritten at boot. Is it because the kernel (boot.img) is the one that copies it over? I have found by changing the perms/locations in this file and init.target.rc you can achieve what this mod is trying to acomplish.
Click to expand...
Click to collapse
Yes the init.rc is in the boot ramdisk. I don't think it would be worth the trouble to rebuild a boot.img. The moto g is fairly unbrickable but it's quite a lot of work to setup an environment to rebuild an image :/.
Too bad for the mount command, I was sure it was working but maybe I had changed something else and don't quite remember the steps to reproduce
We could possibly implement a shell script toggler for when we need to install new apps, but I'm afraid it'd become annoying fairly quickly: I noticed the issue initially because google play services decided to update itself, failed, and broke all google apps. As far as I know this autoupate can't be disabled.
Thanks for trying!
dd043 said:
Yes the init.rc is in the boot ramdisk. I don't think it would be worth the trouble to rebuild a boot.img. The moto g is fairly unbrickable but it's quite a lot of work to setup an environment to rebuild an image :/.
Too bad for the mount command, I was sure it was working but maybe I had changed something else and don't quite remember the steps to reproduce
We could possibly implement a shell script toggler for when we need to install new apps, but I'm afraid it'd become annoying fairly quickly: I noticed the issue initially because google play services decided to update itself, failed, and broke all google apps. As far as I know this autoupate can't be disabled.
Thanks for trying!
Click to expand...
Click to collapse
How about making a simple apk that toggles this feature. Something like when you click the icon it doesn't even open but gives a little notification of success. Something like that. I myself am not experienced with apks but I can put together a shell script for the apk.
skyguy126 said:
Ok so I have the kernel extracted and we could modify and flash that, but I believe that it's not really necessary. There are a lot of risks to flashing kernels and I am not willing to take it. So is there a way we can modify dalvik so it creates it's cache in /cache instead.
Click to expand...
Click to collapse
Patching dalvik itself sounds promising. It can probably be done with in a batch script with a command line hex editor.
The path is defined in frameworks/base/cmds/installd/installd.h
Code:
#define DALVIK_CACHE_PREFIX "/data/dalvik-cache/"
Not sure if there is another mention in the source tree.
But there's nothing to say we wouldn't face the same issue, the error message in the logcat is pretty generic
dd043 said:
Patching dalvik itself sounds promising. It can probably be done with in a batch script with a command line hex editor.
The path is defined in frameworks/base/cmds/installd/installd.h
Code:
#define DALVIK_CACHE_PREFIX "/data/dalvik-cache/"
Not sure if there is another mention in the source tree.
But there's nothing to say we wouldn't face the same issue, the error message in the logcat is pretty generic
Click to expand...
Click to collapse
Ill try it. I don't mind doing a bunch of resets because I am using my moto g as a test bench anyway. My daily driver is the OnePlus One
dd043 said:
Patching dalvik itself sounds promising. It can probably be done with in a batch script with a command line hex editor.
The path is defined in frameworks/base/cmds/installd/installd.h
Code:
#define DALVIK_CACHE_PREFIX "/data/dalvik-cache/"
Not sure if there is another mention in the source tree.
But there's nothing to say we wouldn't face the same issue, the error message in the logcat is pretty generic
Click to expand...
Click to collapse
EDIT: Unfortunately it didn't work. I don't know if I modified the installd file correctly. The program I used is HxD.
Is there a way we can force dalvik to start after the directories are created. And change dalvik to create it in /cache.

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

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). ​
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) & 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:
Code:
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. :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):
Code:
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.
cool but i thought there would be no backup involved like windows where i changed from mbr to gpt without damaging data
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
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?
dwaipayanray95 said:
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?
Click to expand...
Click to collapse
lol and apparently some people needs a 3 click guide and some full blown guide . hey, i respect the author for helping someone
#sychrome# said:
lol and apparently some people needs a 3 click guide and some full blown guide . hey, i respect the author for helping someone
Click to expand...
Click to collapse
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
Might make sense to make a list of Roms and kernels that support F2FS, since people will come here out curiousity, and it would be the next logical step to find and flash a rom that support it.
Sent from my A0001 using XDA-Developers mobile app
the caf sultan 04/04/2016 suports system as f2fs? with Lightning Kernel v38?
hi. thanks for guide.
cd c:\adb
adb pull -p \sdcard c:\bacon_full_backup
Click to expand...
Click to collapse
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
Click to expand...
Click to collapse
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.
If i only convert to f2fs CACHE, so it lose internal storage & data?
Anzd said:
If i only convert to f2fs CACHE, so it lose internal storage & data?
Click to expand...
Click to collapse
Nope
so, can i do this tutorial on lastest stock cm13? or need custom rom?
Is F2FS stable yet? Last I heard it caused all sort of data corruption, freezing, etc.
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?
dwaipayanray95 said:
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?
Click to expand...
Click to collapse
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)
dogroll said:
Is F2FS stable yet? Last I heard it caused all sort of data corruption, freezing, etc.
Click to expand...
Click to collapse
Yes bro its totally stable! I am usng it in my OPO since I made this guide, and never experienced any issues so far.
monyozt said:
so, can i do this tutorial on lastest stock cm13? or need custom rom?
Click to expand...
Click to collapse
Stock COS13 doesnt support f2fs.
Anzd said:
If i only convert to f2fs CACHE, so it lose internal storage & data?
Click to expand...
Click to collapse
No
lapapunk said:
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.
Click to expand...
Click to collapse
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.
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

Categories

Resources