[Guide] Ext-SD ext4 (rw - short - 4.4) - General Topics

I saw a few guides to make an ext4 formated MicroSD mount able, but most of them
look a bit complicated and playstore apps often didn't work for me. Specially under 4.4.
So what I did is this:
1) Format the MicroSD to ext4, using a linux system (ubuntu)
2) Mount the sdcard and change the permissions for sdcard and subfolders:
3) Running in Terminal: “sudo chown -R root:root /media/<user>/<sdcard_name>”
(Somehow sometimes i need to run this command twice)
After step 3) your perms should look like this:
Now my MicroSD works flawless on various devices in read and write mode.
To copy files on your card you must use a tablet/phone as a cardreader.
If anyone knows the necessary terminal commands for android to do this, please tell me.
For anyone who wants to optimize the MicroSD a bit (for me max +10%) you should look here.

Related

How to swap SD cards w/ Apps2SD

All props go to Jonnythan who gave the steps in another post. Mods may want to sticky this....
1. As always: Nandroid backup
2. reboot phone
3. adb shell into the phone
4. mkdir /sdcard/backup/
mkdir /sdcard/backup/app
mkdir /sdcard/backup/app-private
cp -r /data/app/* /sdcard/backup/app/
cp -r /data/app-private/* /sdcard/backup/app-private/
5. copy sd card to pc
6. Shut off phone and remove old sdcard and insert new sdcard
7. Start in recovery mode and partition new sdcard (fat32, ext2, swap)
8. Enable usb mode, copy data from old sdcard to newly partitioned sdcard
9. reboot and ignore force closings
10. Plug in USB and enable USB mode
From PC ADB shell into phone and type the following (enter after each line):
rm -r /data/app/*
rm -r /data/app-private/*
[chances are those directories are empty already, but you never know]
cp -r /sdcard/backup/app/* /data/app/
cp -r /sdcard/backup/app-private/* /data/app-private
reboot recovery
11. Restore most recent nandroid
12. reboot and enjoy
All thanks again to Jonnythan
Tweaks:
Between 5 and 6, shut off phone. Then start step 7 by specifying to start into recovery mode to partition the card. Then specify that you need to plug in the usb and adb shell for step 10. End step 10 by typing in "reboot recovery" which will reboot you right into the recovery partition.
Thanks for writing it up! Now I don't have to
Ok, I must be doing something wrong here... Does this require a custom ROM or anything? Im on the sprint Hero, stock ROM and I do have root. Everytime I get to step 4, at the cp -r /data/app/* /sdcard/backup/app/ command i get an error. It cant find the directory. Also, if i check the folder properties through Astro or linda file manager, it says 0 files, 0 folders, and also shows that it is not taking up any space. Just as a test to see if I was somehow blocked, I made a nandroid backup and deleted the /data folder, and upon reboot nothing had changed. Still have all of my apps on the phone...
I think the stock ROM doesn't include the cp command.
jonnythan said:
I think the stock ROM doesn't include the cp command.
Click to expand...
Click to collapse
Wait, when i get my sd card I have to do all this? I can't just reformat using the utility and drag and drop everything back into the sd card?
runsoverfrogs said:
Wait, when i get my sd card I have to do all this? I can't just reformat using the utility and drag and drop everything back into the sd card?
Click to expand...
Click to collapse
Not if you're using AppsToSD.
If you're not using A2SD then just make a backup of the old card, unmount it, put the new one in, and copy everything back. If you are using A2SD, the process is more complex.
Cp = Copy. Works on any rom. Like he said since you're on the stock rom, I doubt you're using Apps2SD so no you don't have to do all this.
If only people would actually read the thread title....
"How to swap SD cards w/ Apps2SD."
Don't have Apps2SD? Then this isn't the thread for you.
Exactly what I was thinking.
jonnythan said:
If only people would actually read the thread title....
"How to swap SD cards w/ Apps2SD."
Don't have Apps2SD? Then this isn't the thread for you.
Click to expand...
Click to collapse
I'm using the modaco 1.1, i should've mentioned that. Doesnt that come with Apps2SD built in?
Only if you partitioned your sd card before you flashed.
After step 6, how do you boot into recovery mode to partition the new card if you dont have the recovery image on the new card? Did I miss a step where I added the recovery image to the new card?
chalan30 said:
After step 6, how do you boot into recovery mode to partition the new card if you dont have the recovery image on the new card? Did I miss a step where I added the recovery image to the new card?
Click to expand...
Click to collapse
The recovery partition is installed on the phone itself, not the card.
thanks I dont know why the first time I tried i didn't get back into the recovery screen but the second time I booted into it just fine... oh well thanks for all your hard work!!!
Partitioning links
To partition the new card, you might want to include links to sdparted and this page for people who want to do it manually.
I have a question about how to make the swap. I have moved /data/dalvik-cache/ to my sd card and freed up about 25 meg of space on internal memory. Is there anything I need to do in addition to your instructions or would it be better to just do a wipe and start from scratch. I am using MoCaDo 1.2 Rom using apps2sd and ext3 partition. I have a 16 gig card coming. By moving the cache I now have 143 meg of internal memory with about 65 apps installed counting some of the stock apps. I have removed several of those as well. 34 apps from the market or handmark.
esoteric1311 said:
All props go to Jonnythan who gave the steps in another post. Mods may want to sticky this....
1. As always: Nandroid backup
2. reboot phone
3. adb shell into the phone
4. mkdir /sdcard/backup/
mkdir /sdcard/backup/app
mkdir /sdcard/backup/app-private
cp -r /data/app/* /sdcard/backup/app/
cp -r /data/app-private/* /sdcard/backup/app-private/
5. copy sd card to pc
6. Shut off phone and remove old sdcard and insert new sdcard
7. Start in recovery mode and partition new sdcard (fat32, ext2, swap)
8. Enable usb mode, copy data from old sdcard to newly partitioned sdcard
9. reboot and ignore force closings
10. Plug in USB and enable USB mode
From PC ADB shell into phone and type the following (enter after each line):
rm -r /data/app/*
rm -r /data/app-private/*
[chances are those directories are empty already, but you never know]
cp -r /sdcard/backup/app/* /data/app/
cp -r /sdcard/backup/app-private/* /data/app-private
reboot recovery
11. Restore most recent nandroid
12. reboot and enjoy
All thanks again to Jonnythan
Click to expand...
Click to collapse
I see some possible problems with this method... what happens if you're copying the sdcard onto a windows machine to backup? You'll lose symlinks, uid, and the like.
Also, what if /app and /app-private don't get put back onto the new sdcard? You'll end up with symlinks that point to nothing.
How 'bout this method? (just a little tweak).
Boot into recover (adb shell reboot recovery)
when recovery comes up, go to the shell (adb shell)
Then, issue these commands (this assumes your ext partition is ext3, and that you're using Amon-Ra's recovery so you have BusyBox 1.13.2 or later):
mkdir /sdcard/extback
mount -o ro -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /system/sd/. /sdcard/extback/
Now, back up the sdcard to a linux machine... keeping uid's and everything the same.
Turn the phone off, swap the cards, reboot into recovery (manually), format, partition, and convert ext2->ext3 the sdcard, put all the stuff back onto the card... and in the shell (within recovery
mount -o rw -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /sdcard/extback/. /system/sd/
reboot
Now, it should all come up with the same attributes, no force close, and everything...
Basically, this method would swap sd cards outside of the normal OS (in recovery), but would keep all the attributes, symlinks, and uids the same for the main OS.
I think if you're using a windows box to backup the card, then we may want to look into making a tarball of the ext partition. I'm not sure if Amon-Ra's recovery supports this or not.
jmanley69 said:
I see some possible problems with this method... what happens if you're copying the sdcard onto a windows machine to backup? You'll lose symlinks, uid, and the like.
Also, what if /app and /app-private don't get put back onto the new sdcard? You'll end up with symlinks that point to nothing.
How 'bout this method? (just a little tweak).
Boot into recover (adb shell reboot recovery)
when recovery comes up, go to the shell (adb shell)
Then, issue these commands (this assumes your ext partition is ext3, and that you're using Amon-Ra's recovery so you have BusyBox 1.13.2 or later):
mkdir /sdcard/extback
mount -o ro -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /system/sd/. /sdcard/extback/
Now, back up the sdcard to a linux machine... keeping uid's and everything the same.
Turn the phone off, swap the cards, reboot into recovery (manually), format, partition, and convert ext2->ext3 the sdcard, put all the stuff back onto the card... and in the shell (within recovery
mount -o rw -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /sdcard/extback/. /system/sd/
reboot
Now, it should all come up with the same attributes, no force close, and everything...
Basically, this method would swap sd cards outside of the normal OS (in recovery), but would keep all the attributes, symlinks, and uids the same for the main OS.
I think if you're using a windows box to backup the card, then we may want to look into making a tarball of the ext partition. I'm not sure if Amon-Ra's recovery supports this or not.
Click to expand...
Click to collapse
Now I'm confused don't take much.
I tried reading the ext2 partition using ubuntu and loading it temp on my windows 7 PC. It would not let me open that partition so I could not copy anything to it.
I guess the easiest way is to just wipe the phone back to factory, booting to recovery with the new card in and create the fat32-ext2-swap partition, re-flash the MoDaCo or any Rom that uses Apps2Sd and install all my apps again. I am assuming this would work as well.
jmanley69 said:
I see some possible problems with this method... what happens if you're copying the sdcard onto a windows machine to backup? You'll lose symlinks, uid, and the like.
Also, what if /app and /app-private don't get put back onto the new sdcard? You'll end up with symlinks that point to nothing.
How 'bout this method? (just a little tweak).
Boot into recover (adb shell reboot recovery)
when recovery comes up, go to the shell (adb shell)
Then, issue these commands (this assumes your ext partition is ext3, and that you're using Amon-Ra's recovery so you have BusyBox 1.13.2 or later):
mkdir /sdcard/extback
mount -o ro -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /system/sd/. /sdcard/extback/
Now, back up the sdcard to a linux machine... keeping uid's and everything the same.
Turn the phone off, swap the cards, reboot into recovery (manually), format, partition, and convert ext2->ext3 the sdcard, put all the stuff back onto the card... and in the shell (within recovery
mount -o rw -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /sdcard/extback/. /system/sd/
reboot
Now, it should all come up with the same attributes, no force close, and everything...
Basically, this method would swap sd cards outside of the normal OS (in recovery), but would keep all the attributes, symlinks, and uids the same for the main OS.
I think if you're using a windows box to backup the card, then we may want to look into making a tarball of the ext partition. I'm not sure if Amon-Ra's recovery supports this or not.
Click to expand...
Click to collapse
Well, for one thing your method requires a linux machine
But what would you even have symlinks on the SD card for? Symlinks, uids, and attributes on SD card files simply aren't an issue at all for most people.
And truthfully if you are already doing that kind of stuff, you don't need this guide.
jonnythan said:
Well, for one thing your method requires a linux machine
But what would you even have symlinks on the SD card for? Symlinks, uids, and attributes on SD card files simply aren't an issue at all for most people.
And truthfully if you are already doing that kind of stuff, you don't need this guide.
Click to expand...
Click to collapse
As far as Linux... get VMWare player for free and download ubuntu and you're set real fast. Also if you notice what I said about doing a tar instead id using Linux.
As far as symlinks. You're right there "shouldn't" be any... but if you're backing up something why not do it right just in case? We have no idea what future versions of apps2ad sill do. It may happen that a file MUST reside on internal memory and therefore you'd need a symlink.
As far as the rest...
Actualy... each app gets its own user id and mismatches in those can cause problems with some apps. And each file in Linux gets attributes to tell the OS who is allowed ti read/write/execute it. If those get messed up it can cause problems.
So... we have a responsibility aa educators to give the best instructions possible. And not give instructions that ultimately would result in a backup that is missing vital information and would lead to a complete reload to fix the problems.
There are many reasons why Google decided to restrict apps to internal memory and we will never know all of them... this may very well be one of the problems they saw happening.

Debian installer for archos5 how to

Please note this is my 1st how to so be kind
Machine Archos5 (0e79)
firmware on archos5: 1.7.99
step 1. if you havent rooted your device you will need to do that.
this is how i rooted my archos ( ONLY DO THIS IF YOU DONT CARE ABOUT DRM!!!)
step 2: you will need a SDcard for your device. this is essental. it needs to formatted in ext3.
step 3: download debian image (google debian installer android) onto a linux computer.
step 4. insert your sdcard into your computer. you might want to have a SDcard reader around.
from here we are going to mount the debian image we just downloaded and copy all folders to our ext3 formatted sdcard.
YOU WILL GET SOME ERRORS FROM /DEV. just skip all. the rest will copy over.
btw the mount command used here is mount -o loop debian.img /mnt
step 5. before you unmount your sdcard, grab a chroot and sysctl enabled version of busybox. you can get it here linux.junsun.net android-dream you will need the install-busybox script too.
follow his instructions for installing busybox. you need the chroot and sysctl in that version for debian to load.
I have busybox and all the new commands installed in /data/bin (which is also where su will be when you root the archos you can get in with /data/bin/su btw)
step 6 unmount your sdcard, insert it into your archos and gain root access. you need a peice of information.
once you have root access type in mount. and figure out where your sdcard is mounted to and its /dev device. WRITE THIS INFORMATION DOWN.
note: in my case my sdcard mounts at /sdcard/sdcard and aliases at /storage/sdcard.
step 7: download and modify bootdeb. your probaly going to want
the one ill post. open it and make sure the /dev path is the same as what your sdcard mounts in on android device. the mount point was /sdcard/sd in the original. i made it /sdcard/sdcard. you need to make sure both the /dev block and mount path match where your device is mounted. check the command paths point all busybox commands to /data/bin/busybox instead.
make the ext2 in the mount command ext3 or it wont work
in the busybox commands it will try to launch chroot and sysctl. it will not launch unless you point to the correct busybox with /data/bin/busybox /data/bin/chroot for example.
you need to do the same for the sysctl command .
step 9. copy the bootdeb onto the sdcard
step 10. cd to the sdcard and type in sh bootdeb
you should be in a debian root shell now.
enjoy!

Clone an SD card (including EXT3) to another?

Like ghosting a HDD to another, I wanted to know if there's an app that can do this?
I think my 8GB LG branded MicroSD is failing as Windows keeps reporting that the drive needs to be scanned when I mount it via USB from my Desire so I'd like to just get a new Sandisk 8GB card and clone the old to new one to avoid having to go through restoring backups and so on.
If anyone has any ideas that would be grand!
check winimage.
That app can make image and recover it to drives!
Doesnt matter if disk is bigger than previous ( NB! may need to resize to get total space if its bigger, cannot remember)
I've always used it for vmware ESXi embedded sticks, made a million of them and the app works!
also linux routers.
Hope this helps.
vmware ESXi runs linux so it supports EXT!
No need for a program, copy data from fat partitions vis pc and use this ( from cyanogen wiki page) Used it three times now and no problems
Upgrading SD / Moving data to new SD
If you are using RA recovery, this is all done for you by making a BART backup. The following is if you're wanting to do it from the command line.
1. First, backup your ext partition on to your fat32 partition. Note, you will need enough free space to hold all of your apps.
* In Terminal Emulator or recovery console:
mount -a [enter]
tar cvf /sdcard/ext.tar /system/sd [enter]
Note that you must have root access for Terminal Emulator. If you get "permission denied" after entering the above command, then try entering the command "su". "sudo" will not work. After entering "su" try the above command again.
* Or, Using ADB shell from your PC:
adb shell
mount -a [enter]
tar cvf /sdcard/ext.tar /system/sd [enter]
2. Next, mount your SD card and download/backup everything on your fat32 partition. Make sure to get the ext.tar file that you just created in the previous step.
3. Change cards/repartion, or do whatever it is you planned to do here. For instructions on creating new partitions see the installation instructions above.
4. If you're not already, reboot into your recovery. Restore your backup files to your fat32 partition. Don't boot into CM yet!
5. Either go to console or ADB shell and type:
*
mount -a [enter]
*
tar xvf /sdcard/ext.tar [enter]
6. Double check that your directories are moved with:
ls /system/sd [enter]
7. Now you can reboot into CM!
8. Run fix permissions to fix any corrupted permissions.
9. Enjoy your new card!
If you have Amon Ra's recovery on your android phone you can do a bart backup with your old sd card, partition the new sd card as required, copy the bart backup to new sd card and then do a bart restore. It is what i did when i upgraded from my 2gb to 8gb, worked a treat.
Since I created this thread a few great things have happened, EXT4 support in unrevoked permanent flashed AmonRA recovery being the main one so now I am sorted thanks!
I use Gparted just copy paste

[DEV][DATA2SD] More space (and more I/O) for your Desire (Updated/EXT4/Flashable ZIP)

HI all.
I know it has been already done but I didn't find any detailed tutorial for the hTc Desire so I wrote one for you
Howto for a HTC desire with clockworkmod recovery:
I did this with a stock HTC sense 2.2 froyo rooted rom with init.d support and my own kernel, forked from richardtrip sense kernel v5e. I don't know for other ROMs or Kernels. Your ROM must support init.d boot scripts.
What you need is:
* Fast µSD card (Class 4 or 6 recommended. Lots of issues reported with class 10 on the Desire)
* busybox (http://www.busybox.net/downloads/binaries/) on c:\
* Kernel with EXT4 support. The kernel in original ROM does not provide ext4 support!!
* Rom with init.d script support (StarBurst (Froyo) or Supernova (Gingerbread) have a native DATA2SD support)
* If you already have app2sd+ or a similar script, don't do the following hack (or at your own risks) !!
* If you still want to try it, backup your A2SD scripts and roll-back to a pre-A2SD state. Don't ask me why it's not working, I never used APPs2SD so I can't help.
* To help you with ADB, you can use the GUI
If you feel a bit lazy or you're scared to make any mistake and want to skip all the manual installation, then go straight to the bottom of this post and download the flashable script made by droidzone. Many thanks to him!! You can also flash Supernova (Stock HTC gingerbread release) and you'll be good to go within no time.
If you already have this running but you flashed another rom, have a look here. droidzone posted another script to just update the rom you just flashed to get DATA2SD work properly
[size=+1]1/Get yourself prepared[/size]
A/ backup everything (nandroid).
B/ Make sure everything is backed-up
C/ Copy the content of you SD to your computer and keep it handy for a roll-back.
D/ make a copy !!!! (I think know that you've been warned )
[size=+1]2/ Make 2 primary Mb aligned partitions on your SD[/size]
Primary partition 1 will be your usual storage, must be FAT32.
To optimize it, I really recommend to have a look here
Primary partition 2 will be your new storage (/data).
You can use gparted or fdisk (I do prefer fdisk and wrote a guide here ) to partition your SD; but it's up to you and Gparted is working great too.
Use the MB align option of gparted to align your partitions. This helps big time to get a better R/W speed.
With the latest busybox, you can do that on your phone in recovery mode.
You will need also e2fs progs. They're all attached at the bottom of this howto.
[size=+1]3/ Boot your phone in recovery and get it prepared[/size]
Connect to your phone with "adb shell"
You should get a ~# prompt now.
mount /system
mount /data
mount /sdcard
exit
if mount /sdcard fails, try mount /dev/block/mmcblk0p1 /sdcard
You should get this as a result of a "mount" command:
Code:
~ # mount
mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nodev,noatime,nodiratime)
/dev/block/mmcblk0p1 on /sdcard type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,s
hortname=mixed,errors=remount-ro)
/dev/block/mtdblock3 on /system type yaffs2 (rw,relatime)
/dev/block/mtdblock5 on /data type yaffs2 (rw,relatime)
Replace you old busybox exec with the new one. It's located in /system/xbin/
adb push c:\busybox-armv6l /system/xbin/busybox
Add the script to init.d folder:
adb push c:\01data.txt /system/etc/init.d/01data
Add the fstab to /system/etc/
adb push c:\fstab.txt /system/etc/fstab
Extract e2fsprogs-arm.zip to c:\
Push all e2fs progs you've extracted from the zip to /system/bin/ the same way:
adb push c:\e2fsprogs\system\bin\e2fsck /system/bin/
adb push c:\e2fsprogs\system\bin\mke2fs /system/bin/
(etc.... for all apps)
Push all e2fs libs you've extracted from the zip to /system/lib/ the same way:
adb push c:\e2fsprogs\system\lib\libext2_blkid.so /system/lib/
adb push c:\e2fsprogs\system\lib\libext2_com_err.so /system/lib/
(etc... for all libs)
adb shell
cd /system/bin
chmod 755 e2fsck
chown 0.2000 e2fsck
(Do the same for all pushed apps.)
cd /system/lib
chmod 644 libext2*
chmod 755 /system/xbin/busybox
chown 0.0 /system/xbin/busybox
chmod 755 /system/etc/init.d/01data
chown 0.0 /system/etc/init.d/01data
Finally type this:
:> /system/etc/mtab
[size=+1]4/ Instant of creation[/size]
cd /
For a non-journaled version:
/system/bin/mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64 -O ^has_journal,extent,^huge_file -m 0 -L userdata /dev/block/mmcblk0p2
For a journaled version (safety/AOSP ROMs):
/system/bin/mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64 -O extent,^huge_file -m 0 -L userdata /dev/block/mmcblk0p2
stride and stripe-width are RAID options but they are used here to align the filesystem to the max erase block size of an SD card. In conjunction with EXT4 extents feature (not present in ext3), it gives a bit of extra performance thanks to block allocation. It's used and recommended for SSDs, so it should help our poor little cheap (SSDs) SD cards
I use 64 because 64x4 (4kb block size)=256Kb. 256Kb is the max erase block size per the SD standards.
Your card may have a smaller erase block size but 256K is at least compatible with every card.
If you want to change the block allocation size, change the "64" parameter.
Just change it to - say - 32 (32x4=128kb) etc ...
Tune this to your actual erase block size if you know it.
If you want journaling (better data integrity) at the cost of performance and probably sd card wear, use the journaled option when you format the ext4 partition. Journal will also use some space on your EXT partition.
Read this article or my tutorial for more details on aligning partition and file system on linux.
I'd like to mention at this stage that fortunately, HTC has implemented a nice and clean unmount of /data at shutdown. Unless you remove your phone battery while it is running or android completely crashes and the cache hasn't been flushed to the sd card, you shouldn't suffer from data loss. In that case though, I've implemented a forced check of the data partition to try to recover any errors on the ext4 partition before booting the phone. You can expect to have a fair amount of safety without journal as long as you turn off your phone with standard HTC menu on sense ROMs
Anyway, if you want to try DATA2SD on a AOSP ROM, you *must* use a journal!
[size=+1]5/ verbatim[/size]
type this:
mkdir /sd
/system/xbin/busybox mount -t ext4 /dev/block/mmcblk0p2 /sd
cd /data
cp -a * /sd
cd /
sync
All you data should copied now.
check with a "ls -l /sd" that you have a least the directory structure.
"df" should report the space used on the new filesystem and should be close to your /data.
/system/xbin/busybox umount /sd
[size=+1]6/ Reboot[/size]
Reboot.
Move all you apps (if you have used the Froyo AP2SD) back to the phone, which is now the SD.
Reboot to get a clean and stable phone
Make sure that you don't install any app in the future to the SD. Some apps are installed automatically to SD, move them back to the phone if it is so.
[size=+1]7/ Comments[/size]
IMHO, a readahead of 128kb could be a bit excessive and can penalise read speed when reading small amounts of data. I've reduced it on my phone to 64kb and noticed a slight improvement when for instance the phone reads data to show apps, icons and size when you open the application list in the settings/applications/manage applications menu. Some kernels have a default value of 4K. This is really bad for performance and it must be changed to get good read performance.
To change it, type this while android is running:
echo 64 > /sys/block/mmcblk0/queue/read_ahead_kb
This setting will be lost on reboot. Just add this line to the script if you want to keep it on reboot.
ownhere did a fantastic job at hacking the libsqlite.so library. I patched the original sense lib and I strongly recommend to replace it with the one attached below.
To do so, just boot into recovery mode, mount /system and backup your /system/lib/libsqlite.so file to your sdcard. Then push the patched lib to /system/lib/ and do a chmod 644 on the pushed file.
Reboot and VOILA!
Updates of the flashable ZIP are available here
If you're coming from previous version (2 FAT32 partitions, ext2 file and loop mount) and want to move to this new one, have a look at this post. You don't have to do everything from start and loose your data. You should get there all the needed info to backup your data and restore it to the new EXT4 partition.
ownhere posted a very interesting option to play with in this post. Apparently nodelalloc mount option is giving better score than delalloc on flash memories. I recently tested it and I had better Quadrant and TAP scores so check-it out!
If you want to impress your friends with Quadrant score, just add "noauto_da_alloc" in the mount option of the script or do this manually with adb shell : busybox mount -o remount,noauto_da_alloc /data
The effect is pretty similar on the final score than nodelalloc (at least on my phone/sdcard )
To get back to normal: busybox mount -o remount,auto_da_alloc /data
(Got this setting from here).
It is simply making the system (thus Quadrant) working in cache (RAM) instead of the SD card.
I'm not sure that this settings improves that much real life usage, but at least you'll get what you're looking for: A super (fake) Quadrand I/O score
I may add this setting in future release of DATA2SD. I'm testing it ATM on my phone.
Many thanks to ownhere and melethron for all their thinkings at bringing issues, help and updates to get to this new version.
Many thanks to too droidzone for his great work on a flashable ZIP and integrating DATA2SD in his ROM to make your life easier you flash maniacs
I hope that I didn't forget something. It's working for me so it should work for you.
Read the thread before asking a question !
This sounds really great ... 2 things :
1. your links are broken
2. Can't we generate the file for /data on the first fat32 partition ... would be a lot easier to format the sdcard with only one partition ...
thank you very much for this great information ...
fogbav said:
This sounds really great ... 2 things :
1. your links are broken
2. Can't we generate the file for /data on the first fat32 partition ... would be a lot easier to format the sdcard with only one partition ...
thank you very much for this great information ...
Click to expand...
Click to collapse
No because you won't be able to use your SD as an external drive when connected to USB.
Just checked the links and they're OK
i vouch for sibere's script... i'm one of first "live testers" for his script and it works great and very, very stable
and from what have been tested by several testers , it can work in these roms :
without a2sd+ :
- rooted stock
- leedroid no-a2sd
with a2sd+ :
- auraxtsense
- defrost
- leedroid
- alex-v
Sibere, allow me to add notes from AndroHero on using the script with a2sd+ rom :
- remove the data2sd (or in auraxt, stuff2sd) from system/etc/init.d in the rom zipfile, or if you have install the rom, just remove from system/etc/init.d
- do the sibere script
Regards
BL
I have follow this easyest tutorial and i'm ok.
All credits to AndroHero for tutorial and to sibere for the hack! I'm only copy and paste from the previous thread!
This tutorial is for all app2sd sense rom so you can follow this tutorial not onfly for lee droid.
As attachment the file that tutorial need.
I have made a 2gb partition for data and is an awesome to see 1.80gb internal memory at first boot!!!!
WOOOOW
Now let's start with tutorial!
------TUTORIAL BEGIN-------
WHAT YOU NEED:
1)Root
2)Android SDK
3)15minutes of time
ALWAYS MAKE A NANDROID BACKUP AND SD BACKUP!!!
LET'S START NOW!
1) download leedroid 2.2f (apps2sd version)
2) unzip the .zip file, open the folder, open the system folder, and then inside that open the folder called etc, you will see a folder called init.d, open that and delete the file called 40a2sd, now just navigate back to the root of the rom and re-zip it.
3) now you need to partition your sd card, use gparted to make 2 fat partitions, a large primary partition and a secondary one about 1gb in size.
4) once you have done that copy the leedroid.zip to the sd card, boot into recovery, do all your wipes and flash the rom, one fashed boot it up and set it up as normal.
5) once set up, hold the power button and choose the option to reboot into recovery.
6) once in recovery connect your phone to your pc, open a command prompt and navigate to the tools folder inside the android SDK.
7) now in the command prompt type the following one at a time:
adb shell
mount /system
mount /data
mount /sdcard
exit
8) now leave the command prompt open and download the file at the bottom of the screen, (i have had to zip it, just open the .zip and the 01data file is inside) and copy it to the root of the c:\ drive on your pc.
9) in the command prompt type (one at a time and always wait for the # to appear again before entering a new command)
adb push c:\01data /system/etc/init.d
adb shell
chmod 755 /system/etc/init.d/01data
cd /
mount /dev/block/mmcblk0p2 /sd-ext
dd if=/dev/zero of=/sd-ext/ext2 bs=1048576
/system/xbin/busybox mke2fs -F -L userdata /sd-ext/ext2
mkdir /sd
/system/xbin/busybox mount -o loop /sd-ext/ext2 /sd
cd /data
cp -a * /sd
cd /
/system/xbin/busybox umount /sd
exit
adb reboot
10) your phone will now reboot with a much bigger /data/ partition.
------TUTORIAL END-------
I suggest to activate the boost!
type in adb shell window with android running:
busybox mount -o remount,noatime,nodiratime /mnt/asec/ext/ext2 /data
sibere said:
No because you won't be able to use your SD as an external drive when connected to USB.
Just checked the links and they're OK
Click to expand...
Click to collapse
Sounds real logical ...8) ... Ups ... shortcut in brain ...8)
bluelavender said:
i vouch for sibere's script... i'm one of first "live testers" for his script and it works great and very, very stable
and from what have been tested by several testers , it can work in these roms :
without a2sd+ :
- rooted stock
- leedroid no-a2sd
with a2sd+ :
- auraxtsense
- defrost
- leedroid
- alex-v
Sibere, allow me to add notes from AndroHero on using the script with a2sd+ rom :
- remove the data2sd (or in auraxt, stuff2sd) from system/etc/init.d in the rom zipfile, or if you have install the rom, just remove from system/etc/init.d
- do the sibere script
Regards
BL
Click to expand...
Click to collapse
Year sure, you're free to add notes mate
will this increase the battery usage?
kakit526 said:
will this increase the battery usage?
Click to expand...
Click to collapse
No effect at all on the battery usage. the usage is around the same .
BL
only one question:
is it better than using a2sd+?
what is the difference?
i had a lot of memory issues with a2sd+ (internal memory decrease very quickly compared to a2sd storage until i get the 'low memory' error message), does this solve my problem?
thanks
bye
Alessandro
Does this really increase IO speed? Can anyone who managed to set this up please post ur Quadrant benchmark.
alessandro_xda said:
only one question:
is it better than using a2sd+?
what is the difference?
i had a lot of memory issues with a2sd+ (internal memory decrease very quickly compared to a2sd storage until i get the 'low memory' error message), does this solve my problem?
thanks
bye
Alessandro
Click to expand...
Click to collapse
Yes, it will solve the problem
The reason why internal memory still decreases with a2sd+ is because not every part of the apps are moved to sd-card . Some of the data parts are still in the internal memory.
This script moves entire data folder to sd card, so nothing in internal memory get decreased
It can be any size you want. So far, the maximum tested size is 2 gb i think was tested by mattiadj & androhero.
BL
I tried once, i got 1956 score (CPU at 998Mhz)
Does this preserve the data on the card? Or do you have to copy everything back on?
Of course I'll have backups, but just asking
coutts99 said:
Does this preserve the data on the card? Or do you have to copy everything back on?
Of course I'll have backups, but just asking
Click to expand...
Click to collapse
it will survive the boot... of course, if you wipe factory data, everything will be gone...but it is safe and survive normal reboot or recovery reboot
BL
This is what is on clean flash of leedroid and after this hack!
I have made a 2gb partition....
Image talks alone....one word: THANKS!
Great job!
Now I expect seeing this bundled into all ROMs around here...
Any improvements are welcome but beside the space can you feel the I/O at some points or is it just a number?
Dude you are legen........ wait for it........... DeRY =D
hope to find a little time to test this awesome tutorial =]
what would happen if the SD card failed? does this render the phone unuseable until a new rom is flashed?

[Guide] Format in ext4 internal memory and keep data

Hi all,
Here another method to format to ext4 your internal sdcard (usb storage) of any Android device. This trick work also with external sdcard. Since Galaxy S3, many devices have already the internal sdcard in ext4, so check your sdcard file system type with Diskinfo from Play Store. This guide is great for Galaxy S1 or S2 for exemple.
Required :
- Your computer
- Android with recovery (cwm, Philz...)
- Live CD of Parted Magic 2013 : link
- USB cable
- Android 4.x
In brief :
- Copy all data of your internal sdcard to your computer.
- Format to ext4 your internal sdcard with Parted Magic AND NOT WINDOWS.
- Restore your data to your internal sdcard.
- Fix permissions* (very important).
- Check.
"Thanks chrhei, laotzy"
Why ext4 ?
- Ext4 is native file system for Android, while exfat is not.
- The system internal partitions (/efs /data /system /cache /preload) use ext4, natively.
- The famous music bug on Android 4.4 AOSP will be gone.
- CM has poor exfat support, while fat32 is not recommended for big files (over 2 GB) because it doesn't work well with them.
- Ext4 has better stability and performance, especially on Android devices, compared to exfat and fat.
"Thanks JustARchi"
Steps by steps :
- Download iso of Parted Magic 2013 freeware (Mac, Linux, Windows) : here.
- Burn the live cd on a real CD or make a live usb stick.
- On your computer, reboot on Parted Magic (live cd or usb stick) :
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
- On your Android device, reboot in recovery :
- Plug Android to computer with usb cable.
- In recovery, first select mount and storage. Then, select mount USB storage. Then, don't touch recovery upto the end of process. If you go back, then recovery unmount sdcard and break the process :
- On computer, with Parted Magic, open file manager and check if you can browse files of your internal sdcard :
- If browsing ok, then copy all data of internal sdcard to computer.
- Please note carefully the name of your internal storage in parted magic, like sde1 or sdb2…
- On computer, open Partition editor (Gparted).
- On partition editor, select your internal sdcard from its name.
- Be carefull to select your internal sdcard and not your hard drive of your computer !
- On partition editor, format your internal sdcard to ext4 from a right click on its partition. :
- Wait the end of process :
- When the format is over, reboot the recovery NOT Android, do it from the advanced options.
- In recovery, go to storage and select USB mount storage.
- On computer with Parted Magic, open file manager and go to your internal sdcard now ext4.
- Restore all data saved to your internal sdcard.
- Reboot android.
- With a terminal in Android, execute the command: su
- Before you start fixing permissions don't forget to type su in your phone's Terminal
- Then, check permissions and type :
ls -la /mnt/media_rw/
The return will be like :
drwxrwxr-x media_rw media_rw 2014-08-20 21:56 sdcard0
drwxrwxr-x media_rw media_rw 2014-08-21 18:32 sdcard1
- To fix permissions, you have to copy everything below, line by line, into the Terminal. Use Android with a web browser as firefox to navigate upto here and copy past to the terminal this lines :
cd /mnt/media_rw/
find sdcard0 -type d -exec chmod 0775 {} \;
find sdcard0 -type d -exec chown media_rw:media_rw {} \;
find sdcard0 -type f -exec chmod 0775 {} \;
find sdcard0 -type f -exec chown media_rw:media_rw {} \;
- Check permissions to see the differences :
ls -la /mnt/media_rw/
- If it is an external sdcard, do the same but replace sdcard0 by sdcard1
- Reboot Android normally (not into terminal).
- Voilà !
- Now, you need to check 2 things : the permissions and the ext4 file system of the sdcard formated :
Please, verify this :
Check permissions : To check if permissions is done, go to browsing files under Android, with an app to browsing files as es file explorer. Then, create a directory at the root of your sdcard ext4 (as /storage/sdcard0/), then delete it. If you will able to delete the folder, then permissions is fine. If not, then go back to follow again steps about fix permissions.
Check your ext4 sdcard: Use Diskinfo from Play Store to check the file system of your sdcard before and after formated : here. There will several partitions, please select the sdcard formated and check its file system.
Video of this guide, but please, read the guide before :
Part 1, backup and format under Parted Magic : here
Part 2, fix permissions with a terminal under Android : here
Why ext4 and another methods here : http://bit.ly/1oYzi3A
Windows users : After formated to ext4, to access to your internal sdcard, you must connect your device in USB in MTP and not USB mass storage (UMS). Because with UMS, no way to access to your internal sdcard from windows. You can set MTP in the parameters of Android :
Anyway, with UMS, to read the new ext4 volumes in Windows, use ext2Fsd.
* Fix Permissions : after formated the sdcard to ext4, there is a very annoying issue. No way to create or delete directory or file at root of this storage. So, there will be big troubles, like unable to backup, no way to install new apps which have to write on this storage, unable to update CM... Without fix permissions, the sdcard will be a kind of read protected storage at root directory.
Before formated, the internal sdcard on my Galaxy S2 was vfat. Here my Galaxy S2 running CM11, after format's process, the internal sdcard is now ext4 :
philippe734 said:
Hi all,
Here another method to format in ext4 your internal sdcard (internal memory) of any Android device.
Required :
- Your computer
- Android with cwm recovery (or other like Philz)
- Live CD of Parted Magic 2013 : link
- USB cable
In brief :
- Copy all data of your internal sdcard to your computer.
- Format in ext4 your internal sdcard with Parted Magic.
- Restore your data to your internal sdcard.
Steps by steps :
- Download iso of Parted Magic 2013 freeware (Mac, Linux, Windows) : link
- Burn the live cd on a real CD or make a live usb stick.
- On your computer, reboot on Parted Magic (live cd or usb stick)
- On your Android device, reboot in recovery.
- Plug Android to computer with usb cable.
- In recovery, go to mount storage and select something like mount USB storage.
- On computer, under Parted Magic, open file manager and check if you can browse files of the internal memory.
- If browse ok, then copy all data of internal sdcard to computer.
- Please note carefully the name of your internal memory in parted magic, like sde1 or sdb2…
- On computer, open Partition editor.
- On partition editor, select your internal memory from its name.
- Be carefully to select your internal sdcard and not your hard drive of your computer !
- On partition editor, format your internal sdcard to ext4 from a right click on its partition.
- Wait the end of process.
- When the format is over, reboot the recovery (not Android) from the advanced options.
- In recovery, go to storage and select USB mount storage.
- On computer, open file manager and go to the internal memory now in ext4.
- Restore all data saved to your internal memory
- Reboot android
- Voilà !
Why format in ext4 and another methods here : http://bit.ly/1oYzi3A
Click to expand...
Click to collapse
My question is - can't I use the option of formatting the Internal memory to ext4 from my Recovery? There is such an option there. My tlf is Galaxy S2, by Samsung + CM11
laotzy said:
My question is - can't I use the option of formatting the Internal memory to ext4 from my Recovery? There is such an option there. My tlf is Galaxy S2, by Samsung + CM11
Click to expand...
Click to collapse
Format in ext4 the internal sdcard from recovery don't work, even if option is available. Use parted magic can avoid unexpected issues [emoji106] I did it with success on my Galaxy S2 running CM11.
philippe734 said:
Hi all,
Here another method to format in ext4 your internal sdcard (internal memory) of any Android device.
Required :
- Your computer
- Android with cwm recovery (or other like Philz)
- Live CD of Parted Magic 2013 : link
- USB cable
In brief :
- Copy all data of your internal sdcard to your computer.
- Format in ext4 your internal sdcard with Parted Magic.
- Restore your data to your internal sdcard.
Steps by steps :
- Download iso of Parted Magic 2013 freeware (Mac, Linux, Windows) : link
- Burn the live cd on a real CD or make a live usb stick.
- On your computer, reboot on Parted Magic (live cd or usb stick)
- On your Android device, reboot in recovery.
- Plug Android to computer with usb cable.
- In recovery, go to mount storage and select something like mount USB storage.
- On computer, under Parted Magic, open file manager and check if you can browse files of the internal memory.
- If browse ok, then copy all data of internal sdcard to computer.
- Please note carefully the name of your internal memory in parted magic, like sde1 or sdb2…
- On computer, open Partition editor.
- On partition editor, select your internal memory from its name.
- Be carefully to select your internal sdcard and not your hard drive of your computer !
- On partition editor, format your internal sdcard to ext4 from a right click on its partition.
- Wait the end of process.
- When the format is over, reboot the recovery (not Android) from the advanced options.
- In recovery, go to storage and select USB mount storage.
- On computer, open file manager and go to the internal memory now in ext4.
- Restore all data saved to your internal memory
- Reboot android
- Voilà !
Why format in ext4 and another methods here : http://bit.ly/1oYzi3A
Click to expand...
Click to collapse
I have formatted Internal memory into ext4 and now my PC doesn't recognize it so I cannot copy all tha Data back to the internal memory. What I did wrong?
I think I know... I did use the option of the phone So I am going back to default and then I will try again using Magic CD
laotzy said:
What I did wrong?
Click to expand...
Click to collapse
Nothing : windows can not access to your internal sdcard in ext4. To access to your internal memory in ext4 from windows, you need to set MTP before connected in USB your device. Read the end of my guide. And to format in ext4, don't do it under windows but linux as live cd of parted magic.
EXT4 on SGS2
My ext4 experience with stock CM11, always latest nightly:
- Backup up your phone data (sdcard0 and sdcard1) first, make the data available on your computer
- Boot your favorite Linux (e.g. from Live CD)
- CWM into my SGS2, connect phone via USB to your Linux computer
- Mount your SD cards to USB
- sdcard0 and sdcard1 should be accessible on your Linux Box
- Convert both partitions to ext4 (do not use CWM!, doesn't work for me) and make them available to the Linux computer
- Copy your backed-up data back to your phone (restore) using your Linux computer
- Reboot your phone again into recovery
- ADB to your phone as root
- Check permissions
ls -la /mnt/media_rw/
drwxrwxr-x media_rw media_rw 2014-08-20 21:56 sdcard0
drwxrwxr-x media_rw media_rw 2014-08-21 18:32 sdcard1
- Fix permissions (user media_rw, uid=1023, group media_rw, gid=1023):
cd /mnt/media_rw/
find sdcard0 -type d -exec chmod 0775 {} \;
find sdcard0 -type d -exec chown media_rw:media_rw {} \;
find sdcard0 -type f -exec chmod 0775 {} \;
find sdcard0 -type f -exec chown media_rw:media_rw {} \;
find sdcard1 -type d -exec chmod 0775 {} \;
find sdcard1 -type d -exec chown media_rw:media_rw {} \;
find sdcard1 -type f -exec chmod 0775 {} \;
find sdcard1 -type f -exec chown media_rw:media_rw {} \;
- FINISHED
To access (r/w) both sdcards (0/1) from a Linux computer your >Linux user< needs to be a member of a created GROUP called "media_rw" with the GID "1023". For "normal" data transfers use the MTP mode of your phone, so you will not run into permission issues.
Regards,
chrhei said:
- ADB to your phone as root
[...]
- Fix permissions [...]
Click to expand...
Click to collapse
True. Because without this fix, no way to write or create new folder on the internal sdcard ext4.
philippe734 said:
Please, could you edit to specify that is not needed to Android + Windows users.
Click to expand...
Click to collapse
I would like to keep this because it will prevent permission issues for everybody caused by wrong GIDs.
Thankyou chrhei. Please can you also say more about what options to choose when formatting sdcard0 and sdcard1 to ext4. Or do you simply let mkfs.ext4 decide based on its defaults?
HippyTed said:
Thankyou chrhei. Please can you also say more about what options to choose when formatting sdcard0 and sdcard1 to ext4. Or do you simply let mkfs.ext4 decide based on its defaults?
Click to expand...
Click to collapse
Yes, no extra options, just created the ext4 file system. I guess you ask because of the journal, no problems so far.
Could you tell me if the telefone, after formatting both memories into ext4, consumes more battery? Or, there is no difference? And also, if you format to ext4 only your internal memory and the external one is left with FAT32 could there be a conflict between the two memories? When you update the CM firmware, do you have to format the memories again? I am speaking about Galaxy S2...
laotzy said:
Could you tell me if the telefone, after formatting both memories into ext4, consumes more battery? Or, there is no difference? And also, if you format to ext4 only your internal memory and the external one is left with FAT32 could there be a conflict between the two memories? When you update the CM firmware, do you have to format the memories again? I am speaking about Galaxy S2...
Click to expand...
Click to collapse
Doesn't matter if you only convert internal or external SD card. But ext4 is very reliable and the overall performance is slightly better. Battery consumption is the same.
philippe734 said:
- Format in ext4 your internal sdcard with Parted Magic AND NOT WINDOWS
Click to expand...
Click to collapse
I am curious, why can't you use a partition manager running under MS Windows, so long as you correctly specify the Ext4 format for the Linux partition? I know Parted Magic isn't an MS Windows program -- I don't mean you should use that with Windows, but aren't there are other partitioning utilities that do run with the MS operating system?
Or not??
Belamigo said:
I am curious, why can't you use a partition manager running under MS Windows, so long as you correctly specify the Ext4 format for the Linux partition? I know Parted Magic isn't an MS Windows program -- I don't mean you should use that with Windows, but aren't there are other partitioning utilities that do run with the MS operating system?
Or not??
Click to expand...
Click to collapse
If you don't know how to use Linux Ext4 is nothing for you. Don't use it.
Belamigo said:
I am curious, why can't you use a partition manager running under MS Windows
Click to expand...
Click to collapse
Because after formated, windows will not recognize the partition. Ext4 is not for window, that's the point is. You can do this format using virtualbox with linux, inside windows. But why do hard, when it's easy with live cd ?
OK, now I see the reason.
philippe734 said:
Because after formated, windows will not recognize the partition. ...
Click to expand...
Click to collapse
Ah, OK, I see your point. I read your thread again, and you're changing the entire card to Ext4, and not making a card with two partitions and two filesystems.
I was curious because I'm about to prepare an two-partition SD card to be hardlinked to /data, and I was following instructions for this, where the thread's author suggests a Windows-based partitioning/formatting utility.
So when I saw you saying not to do it, I was getting concerned that the other directions may be wrong.
philippe734, something went wrong with my ext4...:crying: I did everything in accordance with the Manual, Internal memory was formatted into ext4 and then I copied back all the files to the internal memory. While in PartedMagic the content of the Internal memory is seen, no problem. But when I reboot the device it works but it says, not the computer but the telefone, that there is no memory... The external card and its content, still in fat32 are seen in any file manager. I think I might have done something wrong but I can't figure out, what exectlyUsing CWM I connected the phone to the computer and formatted the system back to fat32, so the telefone works as before but I would like to understand what goes wrong when I try to format it to ext4... Any idea?
laotzy said:
philippe734, something went wrong with my ext4...:crying:..... formatted into ext4 and then I copied back all the files to the before but I would like to understand what goes wrong when I try to format it to ext4... Any idea?
Click to expand...
Click to collapse
Stop crying, read post #6 and get used to learn a little about Linux. Or fallback to VFAT.
chrhei said:
Stop crying, read post #6 and get used to learn a little about Linux. Or fallback to VFAT.
Click to expand...
Click to collapse
Dear chrchei, thank you for pointing me to where I could find detailed info about the S2. My problem is that I am not of Linux, so many things are not clear to me. I did read a lot about Linux recently, I did even manage to install Virtual Machine and thus I am able to play with Ubuntu but still, it's rather difficult for me to use all those terminal commands. I am an amateur, not a professional
P.S. OK, I am on the last Nightly on my Galaxy S2. After having been fighting with my Linux trying to format Internal memory into ext4 and receiving errors constantly, I tried to use the CWM's resources on board and, oh wonder(!!!), the memory was formatted into ext4 without any problem! Tomorrow will do the same with the external memory. (SD card)
chrhei said:
- Fix permissions (user media_rw, uid=1023, group media_rw, gid=1023):
cd /mnt/media_rw/
find sdcard0 -type d -exec chmod 0775 {} \;
...
find sdcard0 -type f -exec chown media_rw:media_rw {} \;
- FINISHED
Click to expand...
Click to collapse
Sorry, you are right. I didn't not understood. Please, could you tell me how to do the same modif using linux (as parted magic) ? Thanks in advance.

Categories

Resources