[MOD][Share] Best AD2SDX Script (A2SD/EXT) - AMARULLZ DATA TO SD-EXT

Search This thread

Androidity3000

Senior Member
Aug 11, 2010
258
48
31
What's up guys. So I've been doing some searching on A2SD/EXT scripts and I cam across this thread. So I decided to try it out on our N1. My results: Amazing. This has to be one of the best A2SD - SD-EXT scripts out there and I noticed that many N1 users know little about it. I am deciding to share it. Please note: I take no credit for creating this script, I just wanted to share it directly with N1 users.

What is it?
This is a flash-able zip file that installs an A2SD-EXT script. This is similar to DTAPPS2SD or any other script but much better. It stores apps and data on your SD-EXT partition and mounts the partition as /data. There are no downfalls to this script, such as the "running out of space" error when only half way used and no audio glitches that can be found with Darktremor's script. (More info on OP linked below.)

How to get it running?
Simple; just flash the zip in recovery. You must have an EXT partition already created on your SD card, obviously. No need to enter any commands in Terminal as it already runs by itself upon boot. I tested and it works with CM7, MIUI, and ICS roms. Been using it for a while with NO problems.

Why choose this script?
Again, simple. It allows for more memory to install apps and mounts all data as internal. There will be no "low mem." issues or low volume issues as found in DTAPPS2SD. Even though this mounts data, there is NO performance issues what so ever. You do not even need a fast card as mine is only class 4. I have been using it for over a month with no random reboots or freezes. Games and apps run just as fast with no lag/blackscreen for a couple seconds when launching apps. There is also no decrease in battery life, just in case anyone was questioning, as I am at 71% being off charger for 8hours medium/low use. Again, I am just sharing it because I see NO N1 users mention it. It is much better than any other ****: DTAPPS2SD Miui stock, iA2SD, S2E...

Download? Original Thread?!
Glad you asked. Here is both: http://xdaforums.com/showthread.php?t=1310309

Introducing....
AD2SDX - AMARULLZ DATA TO SD-EXT

by amarullz [at] yahoo [dot] com
* Oct 20 2011 (ALPHA02) - Update Compatibility
* Oct 19 2011 (ALPHA01)



WHAT IS IT??
This mod will move all Internal Memory (data) into sd-ext, "but not like data2ext", this mod will maintain the performance, because it still place dalvik-cache and system application data in Internal Memory.


HOW IT WORK??
The script will do this in the first boot:
  • Move Mounting Internal Memory (/data) Into /sd-ext
  • Mount SDCard-Ext (mmcblk0p2) partition into /data
  • Create dalvik-cache directory in Internal Memory data (/sd-ext), and symlink it to mmcblk0p2 (/data)
  • Create data directory in mmcblk0p2 (/data) And symlink it into Internal Memory data (/sd-ext)
  • Create symlink of app, app-private, app_s and lib_s from mmcblk0p2 (/data) to Internal memory data (/sd-ext)
  • Create symlink for all non-symllink of Internal Memory data (/sd-ext) into mmcblk0p2 (/data)

After Initializing Setup (First Boot), reboot the system (Just reboot, don't go into recovery), the mod will automatically do this following:
  • Create data_s in Internal Memory data (/sd-ext)
  • Move All mmcblk0p2(/data)/data/com.htc* and com.android* into Internal Memory data(/sd-ext)/data_s
  • Create symlink all files/directory from Internal Memory data (/sd-ext)/data_s/* into mmcblk0p2(/data)/data/ So the System Application Data still read into Internal memory, but rest Application Data will read Into SDCard.

ILLUSTRATION
attachment.php


INSTALLATION
For now, use adb shell and Install it manually, I am android newbie :D, still unfamiliar with recovery zip installer.
  • Delete Any A2SD Script in /system/etc/init.d ( common name was 40a2sd )
  • Copy 40ad2sdx into /system/etc/init.d Don't forget to chmod 755/777 it
  • Reboot ( 2x optional )

INSTALLATION WITH ADB IN RECOVERY MODE
Code:
C:\>adb shell
# mount /system
# exit

C:\>adb push 40ad2sdx /system/etc/init.d/

C:\>adb shell
# cd /system/etc/init.d
# rm 40a2sd
# chmod 755 40ad2sdx
# cd /
# umount /system
# exit

C:\>
NOTE: the "rm 40a2sd" should be the name of app2sd init.d file.

NOTE
If you install it after clean flash you need to reboot your phone at the 1st boot to activate System App Data on Internal Memory.


CAUTION!!!
YOU SHOULD UNZIP AND MANUALY COPY THE FILE INTO /system/etc/init.d/ - THE ZIP FILE WASN'T AUTO INSTALLER THAT CAN BE RUN IN RECOVERY!!!!



WARNING!!!
THIS MOD ONLY IN TEST STAGE, ONLY ADVANCE USER I SUGGEST TO TRY THIS SCRIPT.
I DON'T TAKE ANY RESPONSIBILITY IF YOU BROKE/BOOTLOOPS YOUR SYSTEM/ROM/PHONE.


TESTED-DEVICE / ROM
  • HTC Desire (Bravo)
    - Cool3D RunnyMede Sense 3.5 v2, v3
    - Cool3D AceS Sense 3.0 v3, v4

If You Already Test it and works,.. Please send me a feedback in your comment...

LOGS
Code:
VERSION 1.0 ALPHA02
===================
* Add framework_s into strict mmcblk0p2
* Add Create symlink for rest non-symlink files from mmcblk0p2 to mtdblock5 ( Hope will fix bootloop )
* Change loop method from `ls -d *` to `ls -a` ( may fix error on .systemapp and all file with dot name at first char )

VERSION 1.0 ALPHA01
===================
* Initial Release
* Support for clean flash or already running system
* com.android* and com.htc* set as System App Category
* dalvik-cache on Internal Memory
* add umount /sd-ext in first command

SCRIPT: ALPHA01
Code:
#!/system/bin/sh
#
# AMARULLZ DATA TO SD-EXT MOD FOR ANDROID ( AD2SDX )
# ==================================================
#
#  by amarullz [at] yahoo [dot] com
#  xda-developers : amarullz
#  (c) 2011
#  * Oct 19 (ALPHA01)
#
#  Info: ~ For Changing Log
##

###
# Initializing
###

#-- SDCard Speed Fix
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]
then
  /system/xbin/echo "8192" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
fi;

#-- Unmount /sd-ext if it already mounted
busybox umount /sd-ext;

#-- Mount /data and move it to /sd-ext
busybox mount /data;
busybox mount --move /data /sd-ext;

#-- Mount sd-ext to /data ( You Will Get 1GB/2GB Internal Memory :D )
busybox mount -t ext4 -o noauto_da_alloc,data=ordered,commit=15,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/block/mmcblk0p2 /data;
busybox chown 1000:1000 /data;
busybox chmod 771 /data;

###[ SDEXT mmcblk0p2 STRICT ]###
# app, app_s, lib_s, app-private, data : should in /data (mmcblk0p2)
#
# ~ ALPHA02 - Add framework_s into (mmcblk0p2) strict 
###
for i in framework_s app app_s lib_s app-private data;
do
  #-- If Symlink in /data, delete it
  if [ -h /data/$i ]
  then
    busybox rm /data/$i;
  fi;
    
  #-- If Directory Exists in /sd-ext, move it to /data
  if [ -d /sd-ext/$i ]
  then
    busybox mv /sd-ext/$i /data/;
  fi;
  
  #-- If Directory Not Extst in /data, create it
  if [ ! -d /data/$i ]
  then
    busybox mkdir /data/$i;
    #-- Just Open All Permissions ;)
    busybox chmod 0777 /data/$i;
  fi;
  
  #-- Now Create Symlink From /sd-ext to /data
  if [ ! -h /sd-ext/$i ]
  then
    busybox ln -s /data/$i /sd-ext/$i;
  fi;
done;

###[ INTERNAL mtdblock5 STRICT ]###
# For performance, dalvik-cache should be on /sd-ext
###
for i in dalvik-cache;
do
  #-- If Symlink in /data, delete it
  if [ -h /sd-ext/$i ]
  then
    busybox rm /sd-ext/$i;
  fi;
    
  #-- If Directory Exists in /sd-ext, move it to /data
  if [ -d /data/$i ]
  then
    busybox mv /data/$i /sd-ext/;
  fi;
  
  #-- If Directory Not Extst in /data, create it
  if [ ! -d /sd-ext/$i ]
  then
    busybox mkdir /sd-ext/$i;
    #-- Just Open All Permissions ;)
    busybox chmod 0777 /sd-ext/$i;
  fi;
  
  #-- Now Create Symlink From /sd-ext to /data
  if [ ! -h /data/$i ]
  then
    busybox ln -s /sd-ext/$i /data/$i;
  fi;
done;

###
# Now create symlink of the rest non Symlink Directories and Files on /sd-ext to /data
#
# ~ ALPHA02 - Fix ls to ls -a, it's ok, because we test -h for symlink
###
cd /sd-ext;
for i in `ls -a`;
do
  if [ $i != ".." -a $i != "." ]
  then
    if [ ! -h /sd-ext/$i ]
    then
      if [ ! -h /data/$i ]
      then
        busybox ln -s /sd-ext/$i /data/$i;
      fi;
    fi;
  fi;
done;
cd /;

###
# It should also need to create the rest non Symlink Directories and Files on /data to /sd-ext
# ~ ALPHA02 - Some Directory may be missing if we don't use it
###
cd /data;
for i in `ls -a`;
do
  if [ $i != ".." -a $i != "." ]
  then
    if [ ! -h /data/$i ]
    then
      if [ ! -h /sd-ext/$i ]
      then
        busybox ln -s /data/$i /sd-ext/$i;
      fi;
    fi;
  fi;
done;
cd /;

###
# Now Important Thing, is to move the com.htc* and com.android* data to /sd-ext (internal) 
# For Good performance. So the system applications will run smooth.
#
# System application will read/write in Internal memory, and 3rd apps will run on sdcard
#
# Notice: Will be affected in 2nd boot :D, so Reboot the system after 1st boot...
###

#-- Prepare data_s in /sd-ext ( For system data )
if [ ! -d /sd-ext/data_s ]
then
  busybox mkdir /sd-ext/data_s;
  #-- Just Open All Permissions ;)
  busybox chmod 0777 /sd-ext/data_s;
fi;

#-- Now Move All com.htc* and com.android* to Internal Memory
cd /data/data/;
for i in `ls -d com.htc* com.android*`;
do
  #-- Only Non Symlink
  if [ ! -h /data/data/$i ]
  then
	  busybox mv /data/data/$i /sd-ext/data_s/;
	fi;
done;

#-- Create Symlink of /data/data_s/* to /data/data/ (mmcblk0p2)
cd /sd-ext/data_s/
for i in `ls -d *`;
do
  #-- Only If Symlink Not Exists
  if [ ! -h /data/data/$i ]
  then
	  busybox ln -s /sd-ext/data_s/$i /data/data/$i
	fi;
done;

#-- Of Finished.... :D


INSTALL ZIP FROM RECOVERY?
Thanks to tezgomet ;) -- Download Attachment by tezgomet >>


KNOW BUG
  • Titanium Backup - Restore the Application Data ( com.android*/com.htc* data )
 
Last edited:

MoeNeXus

Senior Member
Feb 28, 2011
164
37
If you install Sebastian Runnymede, it's already built-in, as well as amarulz's touch installer.

Sent from my Nexus One
 

Theshawty

Senior Member
Feb 13, 2011
16,644
4,750
So I entered that thread and then entered another thread where I could download a flashable zip of it. I downloaded the right script, I assume?

Oh, and thanks for sharing.

EDIT: If it mounts my sd-ext as /data, I'd have to wipe my original data partition before flashing this script, right?

Sent from my Nexus One using Tapatalk
 
Last edited:

Aiuspaktyn

Senior Member
Mar 11, 2006
231
38
Naples
Thanks a lot, I was using Link2SD (from market) but I had out of space soon...

Sent from my Galaxy Nexus using xda premium
 

Androidity3000

Senior Member
Aug 11, 2010
258
48
31
So I entered that thread and then entered another thread where I could download a flashable zip of it. I downloaded the right script, I assume?

Oh, and thanks for sharing.

EDIT: If it mounts my sd-ext as /data, I'd have to wipe my original data partition before flashing this script, right?

Sent from my Nexus One using Tapatalk

The download ZIP link is all the way at the bottom of the post. Yes just flash it. As for wiping, no. I flashed this over a ROM that I was previously using and it worked just fine. I was using S2E for CM7, then flashed script, disabled/uninstalled S2E, and worked fine. I also flashed this over another ROM that had no previous A2sd script, just stock internal, and it worked fine as well.
 

heinz gruber

Senior Member
Jan 3, 2010
129
4
script sounds great. i've a few questions:

1:
will all apps after flashing automatically will be installed on sd-ext? or do i have to flash the script several times when i installed news apps?

2:
is it possible to move the apps back to internal memory? or to uninstall the script?

thanks :)
 

Androidity3000

Senior Member
Aug 11, 2010
258
48
31
script sounds great. i've a few questions:

1:
will all apps after flashing automatically will be installed on sd-ext? or do i have to flash the script several times when i installed news apps?

2:
is it possible to move the apps back to internal memory? or to uninstall the script?

thanks :)

1 - After installing the script, apps will automatically be installed to the EXT partition. I would only recommend flashing the script again if you install an update to your ROM, but I am mostly sure that this is not necessary.

2 - The script itself does not have the ability to let the user choose which apps are installed on internal and which are installed on the EXT. This is because the script mounts the EXT to /data making your device think that /data internal is much larger.
 
  • Like
Reactions: heinz gruber

heinz gruber

Senior Member
Jan 3, 2010
129
4
1 - After installing the script, apps will automatically be installed to the EXT partition. I would only recommend flashing the script again if you install an update to your ROM, but I am mostly sure that this is not necessary.

2 - The script itself does not have the ability to let the user choose which apps are installed on internal and which are installed on the EXT. This is because the script mounts the EXT to /data making your device think that /data internal is much larger.

thanks for your answers.

already post some other in the main-thread of the script:

i'm using a nexus one with cm 7.2 and kgp700s kernel.
now i've created a ext part 4 with amon ra. but when i start titanium backup it only shows me the memory of my sd card and not oft the ext sd. is this because the partition isn't mounted correctly?
can i flash it when i already use the rom for a few days? read somewhere that it would be better to flash it right after flashing the rom.
 

Androidity3000

Senior Member
Aug 11, 2010
258
48
31
thanks for your answers.

already post some other in the main-thread of the script:

i'm using a nexus one with cm 7.2 and kgp700s kernel.
now i've created a ext part 4 with amon ra. but when i start titanium backup it only shows me the memory of my sd card and not oft the ext sd. is this because the partition isn't mounted correctly?
can i flash it when i already use the rom for a few days? read somewhere that it would be better to flash it right after flashing the rom.

It would be better to flash it with a fresh ROM but is NOT necessary. Your issue is not an issue but part of the script, if I understand you correctly. In Titaniumbackup, check how much internal says is available, not A2SD(EXT). It should be increased and should show the size of your ext partition.
 
  • Like
Reactions: heinz gruber

heinz gruber

Senior Member
Jan 3, 2010
129
4
It would be better to flash it with a fresh ROM but is NOT necessary. Your issue is not an issue but part of the script, if I understand you correctly. In Titaniumbackup, check how much internal says is available, not A2SD(EXT). It should be increased and should show the size of your ext partition.

thanks. will try it and give feedback.
 
  • Like
Reactions: cnpsx

sarshadd

Senior Member
Dec 29, 2010
203
13
I was just about to flash darktremor on my CM7.2 n1.

Then I saw the new featured page on "Mounts2SD - An All-in-one to sd-ext script"

Then I saw this thread.

Which option is the best? I am in urgent need of more /data space!

Darktremor is obviously classic. But I have no experience with it. Does it, or any others, have a UI? Can I view and edit the status of the partition easily from my phone?
 
Last edited:

Androidity3000

Senior Member
Aug 11, 2010
258
48
31
I was just about to flash darktremor on my CM7.2 n1.

Then I saw the new featured page on "Mounts2SD - An All-in-one to sd-ext script"

Then I saw this thread.

Which option is the best? I am in urgent need of more /data space!

Darktremor is obviously classic. But I have no experience with it. Does it, or any others, have a UI? Can I view and edit the status of the partition easily from my phone?

I do not know greatly about M2SD, but I understand that the new ICS rom has incorporated it; so cannot give great feedback with that. DarkTremor does have a GUI (sort of) which is an app on the market (free - a2sd gui) which gives options to move either apps, data, dalvik, etc.. on the EXT. This script does not have a gui as far as I am concerned. I think that this script is easier because all you have to do is flash it once (not after install all ROM updates like DTA2SD). There are many problems with DTA2SD (which is why I said this is the best...) like low volume issues and low memory errors when device is only half way filled.

Bottom line: if you want simple, easy, reliable a2sd install this once and you're good. No questions. That's why my title is what it is...
 
  • Like
Reactions: xyrovice

kiari62

Member
Jan 20, 2011
12
0
Barcelona
How is it better than IA2SD in MeDroid 1.4.3 rom? IA2SD does a fairly good job with a nice GUI and just has to be run once when installing the rom for the first time.

Sent from my ASUS Transformer TF101
 

sarshadd

Senior Member
Dec 29, 2010
203
13
How is it better than IA2SD in MeDroid 1.4.3 rom? IA2SD does a fairly good job with a nice GUI and just has to be run once when installing the rom for the first time.

Sent from my ASUS Transformer TF101
I've used IA2SD and I liked it.

How does this compare? Screen shots? Is there a thread for this already with more information that you can point me to?
 
Last edited:

kiari62

Member
Jan 20, 2011
12
0
Barcelona
I've only used the version that comes with MeDroid. I attach a couple screenshots taken from my setup as today.

I don't know any other way to install it, sorry.
 

Attachments

  • Screenshot_2012-03-25-18-24-28.jpg
    Screenshot_2012-03-25-18-24-28.jpg
    17.8 KB · Views: 468
  • Screenshot_2012-03-25-18-24-40.jpg
    Screenshot_2012-03-25-18-24-40.jpg
    40.1 KB · Views: 485

xyrovice

Senior Member
Dec 21, 2009
365
54
Manhattan
I just want to vocalize my thanks to the OP for bringing all this to light.

Simply EXACTLY what I have been looking for!

THANK YOU OP!!
 

cbhawsar

Member
Aug 7, 2011
40
4
What about stock ROM?

I am running nexus1 2.3 stock ROM (rooted). Is there any guide or instructions using which I can set up a working sd-ext partition on this stock ROM?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 22
    What's up guys. So I've been doing some searching on A2SD/EXT scripts and I cam across this thread. So I decided to try it out on our N1. My results: Amazing. This has to be one of the best A2SD - SD-EXT scripts out there and I noticed that many N1 users know little about it. I am deciding to share it. Please note: I take no credit for creating this script, I just wanted to share it directly with N1 users.

    What is it?
    This is a flash-able zip file that installs an A2SD-EXT script. This is similar to DTAPPS2SD or any other script but much better. It stores apps and data on your SD-EXT partition and mounts the partition as /data. There are no downfalls to this script, such as the "running out of space" error when only half way used and no audio glitches that can be found with Darktremor's script. (More info on OP linked below.)

    How to get it running?
    Simple; just flash the zip in recovery. You must have an EXT partition already created on your SD card, obviously. No need to enter any commands in Terminal as it already runs by itself upon boot. I tested and it works with CM7, MIUI, and ICS roms. Been using it for a while with NO problems.

    Why choose this script?
    Again, simple. It allows for more memory to install apps and mounts all data as internal. There will be no "low mem." issues or low volume issues as found in DTAPPS2SD. Even though this mounts data, there is NO performance issues what so ever. You do not even need a fast card as mine is only class 4. I have been using it for over a month with no random reboots or freezes. Games and apps run just as fast with no lag/blackscreen for a couple seconds when launching apps. There is also no decrease in battery life, just in case anyone was questioning, as I am at 71% being off charger for 8hours medium/low use. Again, I am just sharing it because I see NO N1 users mention it. It is much better than any other ****: DTAPPS2SD Miui stock, iA2SD, S2E...

    Download? Original Thread?!
    Glad you asked. Here is both: http://xdaforums.com/showthread.php?t=1310309

    Introducing....
    AD2SDX - AMARULLZ DATA TO SD-EXT

    by amarullz [at] yahoo [dot] com
    * Oct 20 2011 (ALPHA02) - Update Compatibility
    * Oct 19 2011 (ALPHA01)



    WHAT IS IT??
    This mod will move all Internal Memory (data) into sd-ext, "but not like data2ext", this mod will maintain the performance, because it still place dalvik-cache and system application data in Internal Memory.


    HOW IT WORK??
    The script will do this in the first boot:
    • Move Mounting Internal Memory (/data) Into /sd-ext
    • Mount SDCard-Ext (mmcblk0p2) partition into /data
    • Create dalvik-cache directory in Internal Memory data (/sd-ext), and symlink it to mmcblk0p2 (/data)
    • Create data directory in mmcblk0p2 (/data) And symlink it into Internal Memory data (/sd-ext)
    • Create symlink of app, app-private, app_s and lib_s from mmcblk0p2 (/data) to Internal memory data (/sd-ext)
    • Create symlink for all non-symllink of Internal Memory data (/sd-ext) into mmcblk0p2 (/data)

    After Initializing Setup (First Boot), reboot the system (Just reboot, don't go into recovery), the mod will automatically do this following:
    • Create data_s in Internal Memory data (/sd-ext)
    • Move All mmcblk0p2(/data)/data/com.htc* and com.android* into Internal Memory data(/sd-ext)/data_s
    • Create symlink all files/directory from Internal Memory data (/sd-ext)/data_s/* into mmcblk0p2(/data)/data/ So the System Application Data still read into Internal memory, but rest Application Data will read Into SDCard.

    ILLUSTRATION
    attachment.php


    INSTALLATION
    For now, use adb shell and Install it manually, I am android newbie :D, still unfamiliar with recovery zip installer.
    • Delete Any A2SD Script in /system/etc/init.d ( common name was 40a2sd )
    • Copy 40ad2sdx into /system/etc/init.d Don't forget to chmod 755/777 it
    • Reboot ( 2x optional )

    INSTALLATION WITH ADB IN RECOVERY MODE
    Code:
    C:\>adb shell
    # mount /system
    # exit
    
    C:\>adb push 40ad2sdx /system/etc/init.d/
    
    C:\>adb shell
    # cd /system/etc/init.d
    # rm 40a2sd
    # chmod 755 40ad2sdx
    # cd /
    # umount /system
    # exit
    
    C:\>
    NOTE: the "rm 40a2sd" should be the name of app2sd init.d file.

    NOTE
    If you install it after clean flash you need to reboot your phone at the 1st boot to activate System App Data on Internal Memory.


    CAUTION!!!
    YOU SHOULD UNZIP AND MANUALY COPY THE FILE INTO /system/etc/init.d/ - THE ZIP FILE WASN'T AUTO INSTALLER THAT CAN BE RUN IN RECOVERY!!!!



    WARNING!!!
    THIS MOD ONLY IN TEST STAGE, ONLY ADVANCE USER I SUGGEST TO TRY THIS SCRIPT.
    I DON'T TAKE ANY RESPONSIBILITY IF YOU BROKE/BOOTLOOPS YOUR SYSTEM/ROM/PHONE.


    TESTED-DEVICE / ROM
    • HTC Desire (Bravo)
      - Cool3D RunnyMede Sense 3.5 v2, v3
      - Cool3D AceS Sense 3.0 v3, v4

    If You Already Test it and works,.. Please send me a feedback in your comment...

    LOGS
    Code:
    VERSION 1.0 ALPHA02
    ===================
    * Add framework_s into strict mmcblk0p2
    * Add Create symlink for rest non-symlink files from mmcblk0p2 to mtdblock5 ( Hope will fix bootloop )
    * Change loop method from `ls -d *` to `ls -a` ( may fix error on .systemapp and all file with dot name at first char )
    
    VERSION 1.0 ALPHA01
    ===================
    * Initial Release
    * Support for clean flash or already running system
    * com.android* and com.htc* set as System App Category
    * dalvik-cache on Internal Memory
    * add umount /sd-ext in first command

    SCRIPT: ALPHA01
    Code:
    #!/system/bin/sh
    #
    # AMARULLZ DATA TO SD-EXT MOD FOR ANDROID ( AD2SDX )
    # ==================================================
    #
    #  by amarullz [at] yahoo [dot] com
    #  xda-developers : amarullz
    #  (c) 2011
    #  * Oct 19 (ALPHA01)
    #
    #  Info: ~ For Changing Log
    ##
    
    ###
    # Initializing
    ###
    
    #-- SDCard Speed Fix
    if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]
    then
      /system/xbin/echo "8192" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
    fi;
    
    #-- Unmount /sd-ext if it already mounted
    busybox umount /sd-ext;
    
    #-- Mount /data and move it to /sd-ext
    busybox mount /data;
    busybox mount --move /data /sd-ext;
    
    #-- Mount sd-ext to /data ( You Will Get 1GB/2GB Internal Memory :D )
    busybox mount -t ext4 -o noauto_da_alloc,data=ordered,commit=15,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/block/mmcblk0p2 /data;
    busybox chown 1000:1000 /data;
    busybox chmod 771 /data;
    
    ###[ SDEXT mmcblk0p2 STRICT ]###
    # app, app_s, lib_s, app-private, data : should in /data (mmcblk0p2)
    #
    # ~ ALPHA02 - Add framework_s into (mmcblk0p2) strict 
    ###
    for i in framework_s app app_s lib_s app-private data;
    do
      #-- If Symlink in /data, delete it
      if [ -h /data/$i ]
      then
        busybox rm /data/$i;
      fi;
        
      #-- If Directory Exists in /sd-ext, move it to /data
      if [ -d /sd-ext/$i ]
      then
        busybox mv /sd-ext/$i /data/;
      fi;
      
      #-- If Directory Not Extst in /data, create it
      if [ ! -d /data/$i ]
      then
        busybox mkdir /data/$i;
        #-- Just Open All Permissions ;)
        busybox chmod 0777 /data/$i;
      fi;
      
      #-- Now Create Symlink From /sd-ext to /data
      if [ ! -h /sd-ext/$i ]
      then
        busybox ln -s /data/$i /sd-ext/$i;
      fi;
    done;
    
    ###[ INTERNAL mtdblock5 STRICT ]###
    # For performance, dalvik-cache should be on /sd-ext
    ###
    for i in dalvik-cache;
    do
      #-- If Symlink in /data, delete it
      if [ -h /sd-ext/$i ]
      then
        busybox rm /sd-ext/$i;
      fi;
        
      #-- If Directory Exists in /sd-ext, move it to /data
      if [ -d /data/$i ]
      then
        busybox mv /data/$i /sd-ext/;
      fi;
      
      #-- If Directory Not Extst in /data, create it
      if [ ! -d /sd-ext/$i ]
      then
        busybox mkdir /sd-ext/$i;
        #-- Just Open All Permissions ;)
        busybox chmod 0777 /sd-ext/$i;
      fi;
      
      #-- Now Create Symlink From /sd-ext to /data
      if [ ! -h /data/$i ]
      then
        busybox ln -s /sd-ext/$i /data/$i;
      fi;
    done;
    
    ###
    # Now create symlink of the rest non Symlink Directories and Files on /sd-ext to /data
    #
    # ~ ALPHA02 - Fix ls to ls -a, it's ok, because we test -h for symlink
    ###
    cd /sd-ext;
    for i in `ls -a`;
    do
      if [ $i != ".." -a $i != "." ]
      then
        if [ ! -h /sd-ext/$i ]
        then
          if [ ! -h /data/$i ]
          then
            busybox ln -s /sd-ext/$i /data/$i;
          fi;
        fi;
      fi;
    done;
    cd /;
    
    ###
    # It should also need to create the rest non Symlink Directories and Files on /data to /sd-ext
    # ~ ALPHA02 - Some Directory may be missing if we don't use it
    ###
    cd /data;
    for i in `ls -a`;
    do
      if [ $i != ".." -a $i != "." ]
      then
        if [ ! -h /data/$i ]
        then
          if [ ! -h /sd-ext/$i ]
          then
            busybox ln -s /data/$i /sd-ext/$i;
          fi;
        fi;
      fi;
    done;
    cd /;
    
    ###
    # Now Important Thing, is to move the com.htc* and com.android* data to /sd-ext (internal) 
    # For Good performance. So the system applications will run smooth.
    #
    # System application will read/write in Internal memory, and 3rd apps will run on sdcard
    #
    # Notice: Will be affected in 2nd boot :D, so Reboot the system after 1st boot...
    ###
    
    #-- Prepare data_s in /sd-ext ( For system data )
    if [ ! -d /sd-ext/data_s ]
    then
      busybox mkdir /sd-ext/data_s;
      #-- Just Open All Permissions ;)
      busybox chmod 0777 /sd-ext/data_s;
    fi;
    
    #-- Now Move All com.htc* and com.android* to Internal Memory
    cd /data/data/;
    for i in `ls -d com.htc* com.android*`;
    do
      #-- Only Non Symlink
      if [ ! -h /data/data/$i ]
      then
    	  busybox mv /data/data/$i /sd-ext/data_s/;
    	fi;
    done;
    
    #-- Create Symlink of /data/data_s/* to /data/data/ (mmcblk0p2)
    cd /sd-ext/data_s/
    for i in `ls -d *`;
    do
      #-- Only If Symlink Not Exists
      if [ ! -h /data/data/$i ]
      then
    	  busybox ln -s /sd-ext/data_s/$i /data/data/$i
    	fi;
    done;
    
    #-- Of Finished.... :D


    INSTALL ZIP FROM RECOVERY?
    Thanks to tezgomet ;) -- Download Attachment by tezgomet >>


    KNOW BUG
    • Titanium Backup - Restore the Application Data ( com.android*/com.htc* data )
    2
    ext4 is best if it is supported by the ROM.
    1
    script sounds great. i've a few questions:

    1:
    will all apps after flashing automatically will be installed on sd-ext? or do i have to flash the script several times when i installed news apps?

    2:
    is it possible to move the apps back to internal memory? or to uninstall the script?

    thanks :)

    1 - After installing the script, apps will automatically be installed to the EXT partition. I would only recommend flashing the script again if you install an update to your ROM, but I am mostly sure that this is not necessary.

    2 - The script itself does not have the ability to let the user choose which apps are installed on internal and which are installed on the EXT. This is because the script mounts the EXT to /data making your device think that /data internal is much larger.
    1
    thanks for your answers.

    already post some other in the main-thread of the script:

    i'm using a nexus one with cm 7.2 and kgp700s kernel.
    now i've created a ext part 4 with amon ra. but when i start titanium backup it only shows me the memory of my sd card and not oft the ext sd. is this because the partition isn't mounted correctly?
    can i flash it when i already use the rom for a few days? read somewhere that it would be better to flash it right after flashing the rom.

    It would be better to flash it with a fresh ROM but is NOT necessary. Your issue is not an issue but part of the script, if I understand you correctly. In Titaniumbackup, check how much internal says is available, not A2SD(EXT). It should be increased and should show the size of your ext partition.
    1
    It would be better to flash it with a fresh ROM but is NOT necessary. Your issue is not an issue but part of the script, if I understand you correctly. In Titaniumbackup, check how much internal says is available, not A2SD(EXT). It should be increased and should show the size of your ext partition.

    thanks. will try it and give feedback.