[Nexus One Android Development] jayfallen:
Updated April 7th, 2011

All credit to sibere and droidzone and other devs who've developed the Data2SD codes.

Before you do anything with your phone, Pls nanodroid fisrt!!! And flash your phone at YOUR OWN RISK

It's been a while since this post last updated.

In fact, developers of HTC Desire have already create a stable method to implement Data2sd or whatever you call it, which gives you full use of EXT space to install APPs while improving I/O speed at the same time.

The theory is explained here, in case you want to take a further look at it

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

And thanks to sibere and droidzone 's great work, now we could make any ROM we like run with Data2sd. here they provide us Flashable ZIP files to make it done

[DATA2SD] Flashable zips for converting any Rom to Data2SD

Download Link:

http://hotfile.com/dl/110226722/85a18a8/Data2SDv11.zip.html

http://www.easy-share.com/1914241904/Data2SDv11.zip

Important Notes from droidzone

Following droidzone's instruction, I tried these flashable ZIPs with MIUI 1.4.1(Gingerbread 2.3.3)

A2SDKillerV11_GB.zip

Data2SDInstallerv1.3_GB.zip

And it's working just fine. No random reboots, no data or APP lost or system crash after reboot. It's stable and fast!

One more note, you can ignore the previous information below...

————————————————————————————————————————————————————————————————————

updata from

melethron's post, and his update package data2whatever.zip included.

you can buy melethron a beer if you want. All credits to melethron!

I test the script with new install MIUI N1 12.24,

so far no reboot issues, or data corruption.

[DATA2whatever] Flashable All-in-one-Solution for Data2sd (HUGE update (dec 23th))

data2whatever v0.2

Features:

- Supports: Ext2, Ext3, Ext4 (and if kernel supports it: ) btrfs, ReiserFS

- Supports loop device as optional addon (as siberes data2sd)

- Flashable zip for many app2sd ROMs (no long setup required)

- It does a e2fsck (disk check) on every boot and creates a logfile on the sdcard (/sdcard/e2fscklog.txt)

- looks nice if you do a logcat on boot

- no "settings lost on reboot" bug like in my old or siberes script

- changes the scheduler for the sd-card and internal to noop for better performance on sd.

- Nandroid Backup of EXT2/3/4 external with AmonRa 2.0.0.1 or any clockwork recovery.

- Removes the common app2sd scripts on its own

Requirements

- A second partition (same as app2sd - Min 512 mb - 1024mb is highly recommended - max 2048 MB or there will be issues with market) in any format (as long as the kernel supports - ext2/3/4 support is default in most kernels - Ext4 or ReiserFS is recommended).

- An app2sd or non app2sd ROM (data2sd versions wont work) (this SHOULD work with most or at least many ROMs . Roms that are confirmed to work can be found in the post below. Please report to me it it works or not so i can update this thread. If it doesn't work i try to make it compatible asap. )

Installation

1.) Full wipe (at least needed on first installation)

2.) Flash the app2sd Version of the ROM of your choice

3.) DONT REBOOT

4.) If you rebooted then start over at 1.)

5.) flash the attached "data2whatever.zip"

6.) now reboot

ADDITIONAL INFO: Even without "life on the edge" you should watch the first 4 "don't"s of "life on the edge". The normal script use the same disk safety methods as NTFS on Windows or EXT4 on linux. But as you know you shouldnt just switch off the computer because there can still be issues in very rare cases. Reboots with tools like "snqs power menu" is the same as a batterypull (or pulling the ac plug on PC) and this isn't good in general (and this also applies for using it with app2sd). If you want to go to recovery just make a normal shutdown and switch the phone on with "volume down" button pressed.

Optional life-on-the-edge add on

you can find this add on in melethron's original post, and try it on your own risk

This patch has the same effect as sibere's and ownhere's script (loop device - the way ownhere does in v4 doesnt work though). Other than those scripts it this addon doesnt need any repartitioning or other setup (like FAT or a third partition) and can simply be installed or removed with a flashable zip. All you need for this is a normal ext 2/3/4 partition (as above ^^). Ext4 is recommended for this (as above) since it is the fastest of those 3. This patch is more risky than normal ext3/4 considering the possibility of data loss. If you want to use this add-on you should watch the following (this also applys to ownheres and sibere script and is NOT more risky than their scripts):

- DON'T use the reboot of snq's powermenu (or any other reboot app)

- DON'T use anything in the "ROM Manager" that makes it reboot.

- DON'T do adb reboot / abd reboot recovery / adb reboot bootloader

- DON'T pull the battery while the phone is on (this should be obvious)

- DON'T remove the "sync" mount options for the Quadrant "boost" (this is a fake boost anyway)

All of this is like a powerloss for the sd-card and has a high change of data corruption.

From my test with this i give you an estimate what can happen if a powerloss occurs or any of the 5 points above happen:

- 50% general chance of corruption that will be autofixed on boot (not a problem)

- 10% chance of forcecloses after reboot of some apps (this can be fixed by deleting the app data or restoring it with titanium (or other) backup)

- REALLY tiny chance (didnt happen for me in over 40 "simulated" powerlosses) that partition gets corrupted (needs complete repartitioning of the microSD so all data on it will be gone then)

As long as you watch the 5 points above and as long as you don't drop the phone and the battery jumps out this will be safe.

Installation of the addon:

- Flash the "life-on-the-edge.zip" any time after you installed "data2whatever".

Installation of the addon:

- Flash the "life-on-the-edge-UNPATCH.zip" any time after you installed "data2whatever" and the addon. (this will revert back to the normal script)

Personal remark: While this is a improvement over normal ext4 it is not the "holy-grale" of a data2sd lag fix. I'm not using this myself and use a ReiserFS as second partition instead which is more safe and completly feels the same as a "loop" device considering performance.

--------------------------------------------------------------------------------

__________________________________________________________________________________

Dec14 info update:

I uploaded A mod script for CM6.1 stable by Carrol

Carrol changes the script to create a ext4 loop device on EXT4 partition.

$BUSYBOX mkdir /mnt/asec/extdata
if [ ! -e /data/data2sd.ext.finish ];
then
echo "+++Need create ext4 loopback device for data, please wait... this is 1/5 size of your ext partition"
extsize=`$BUSYBOX df /dev/block/mmcblk0p2|$BUSYBOX grep mmcblk0p2|$BUSYBOX awk '{print $2}'`
datasize=`$BUSYBOX expr $extsize / 5 / 1024`
$BUSYBOX dd if=/dev/zero of=/data/ext4 bs=1048576 count=$datasize
/system/xbin/mkfs.ext4 -b 4096 -m 0 -F -L userdata /data/ext4
/system/bin/tune2fs -o journal_data_writeback /data/ext4
/system/bin/e2fsck /data/ext4
#/system/bin/tune2fs -O ^has_journal /data/ext4

#$BUSYBOX mount -o loop,errors=continue,noatime,nodiratime,nosuid,nodev /data/ext4 /mnt/asec/extdata
$BUSYBOX mount -o loop,barrier=0,nobh,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /data/ext4 /mnt/asec/extdata
$BUSYBOX chown 1000.1000 /mnt/asec/extdata
$BUSYBOX chmod 771 /mnt/asec/extdata
$BUSYBOX cp -a /data/data /mnt/asec/extdata/
sleep 1
$BUSYBOX umount /mnt/asec/extdata
sleep 1
$BUSYBOX touch /data/data2sd.ext.finish
fi

/system/bin/e2fsck -y -v -f /data/ext4
#$BUSYBOX mount -o loop,sync,errors=continue,noatime,nodiratime,nosuid,nodev /data/ext4 /mnt/asec/extdata
#$BUSYBOX mount -o loop,errors=continue,noatime,nodiratime,nosuid,nodev /data/ext4 /mnt/asec/extdata
$BUSYBOX mount -o loop,barrier=0,nobh,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /data/ext4 /mnt/asec/extdata
$BUSYBOX chown 1000.1000 /mnt/asec/extdata
$BUSYBOX chmod 771 /mnt/asec/extdata

Note that this script is for CM6.1 stable only, only ONE EXT partition needed on your SDCard, and it will be formated into EXT4, do nanodroid before you try

Also a CM6.1 ROM with Data2Ext by Carrol can be found here

CM6.1 ROM with Data2Ext by Carrol

download: http://rom.anshouji.com/htc/N1/bbs.anshouji.com-N1-data2sd-20101213.zip

________________________________________________________

ownhere Data2Ext script V4

Data2ExtV4

There's a version for Desire, which is here [DATA2EXT] [11/Dec] FULL BENCHMARK, V4, Improve the efficiency of IO

While improving IO efficiency, it moves all userdata to EXT so to avoid insufficient ROM space, cos the whole EXT is recognized as the internal ROM.

with ownhere's v4 script, I got my miui rom working, no data lost or crash after reboot/battery-removed:

1. miui rom 12.03 clean installation（a2sd+ script removed）, then flash update.zip of v4 script. working. applying 12.03 to 12.10 and 12.10 to 12.11 ota packages, working.

2. miui rom 12.11 clean installation, flash v4 update.zip, working.

3. miui rom 12.11 with a2sd+ running, 38 apps installed and /data/data moved to ext. The v4 update.zip can still do the job.

However, one problem is that Root explorer couldnot display Chinese filenames of APK , showing only ？？？. and if install those apks via root explorer, it just reports errors...

Another thing i am not sure of is not knowing how much v4 script could improve when there is only 1 ext partition. According to ownhere, 2 ext partitions are needed to make the best out of his v4 script...

I attached the v4 updtae.zip - Data2ext_update.zip ，in case you might wanna try:

1. BEFORE you try this package, you need to remove the app2ext script(file like 04apps2sd or 01 apps2sd) from /system/etc/init.d, or you would only get bootloop going on and on

2. And of course, Nanodroid...

3. disable signature checking in recovery...

______________________________________________________________________________________________

I tried merging those files into MIUI N1 ROM.

When N1 boots for the 1st time, everything's working just fine.

Now we know the previous script is faking the Quadrant score...

Quadrant bechmark really rocks with I/O scoring 8000+ and a total score @ 3000+

But after reboot, there came some issues:

System config could not be saved;

Home button wouldn't work;

Flight mode and Quiet mode missing in the reboot menu...

Could someone pls help to rewrite the script to fit in N1 ROM?

I think people using N1 would interested in such a script or rom that brings N1 more I/O performance and more space for Apps.

But I have no knowledge of coding, don't know how to fix the issues above.

So I add download link of the script CREATED by ownhere, not by me, hoping someone could make a N1 MOD...

data2ext.zip

data2ext.zip is not a flashable package

Thanks!