[Galaxy Note 10.1 Android Development] TweakerL:
UPDATES:

09-26-2012: Major Update, Overhauled most of previous code.

09-27-2012: Found badass typo in one of the files, fixed and uploaded correction.

09-27-2012: Added install Script.

10-02-2012: Corrected install script so that things now run properly. Don't forget to double check USER_OPTIONS and set ENABLED=true

10-02-2012: Added MMCBLKXPX variable to user options so now devices that mount SD-EXT to different block can use script easily.

10-03-2012: More fixes to the install script, also added check for storage location as well as user input. Started working on compatibility for devices where /sdcard/Android is in different partition from /data

10-03-2012: Updated this post with more organized information.

10-04-2012: Modified script so that debugging output works properly in JB

10-05-2012: Finished working on compatibility for devices with /sdcard and /data in different partitions (PENDING TESTING)

10-05-2012: Added automatic detection for such devices ^ (New variable is automatically created in USER_OPTIONS, called fukedupFS)

10-05-2012: Added extra security for $deletepostmove (Will not take effect until stage 3 is detected)

10-05-2012: Added switch on install script to do a clean install, (using sh ./install-a2sd -clean) which will erase all current options/vars and reset stage to 0.

WARNINGS:

1 - PROCEED WITH THE FOLLOWING STEPS AT YOUR OWN RISK. IF ANYTHING BREAKS I'LL GLADLY TRY TO HELP (IF I CAN), BUT YOU DO WHAT YOU DO AT YOUR OWN RESPONSIBILITY.

2 - THE INSTALLATION SCRIPT REQUIRES USER INPUT, WHICH MEANS THAT IT CANNOT BE MADE INTO A RECOVERY ZIP. DO NOT BOTHER TO ASK FOR ONE. IF YOU CAN'T LEARN HOW TO USE THE TERMINAL, THEN JUST STICK TO OTHER SUCKY APP2SD SOLUTIONS.

3 - THIS SCRIPT IMPLEMENTS INIT.D BY DEFAULT, IF YOU ALREADY HAVE INIT.D FUNCTIONALITY MAKE SURE TO CHANGE:

/system/bin/logwrapper busybox run-parts /system/etc/init.d

TO

# /system/bin/logwrapper busybox run-parts /system/etc/init.d

IN THE B]sysinit[/B] FILE.

4 - THIS SCRIPT IMPLEMENTS INIT.A, WHICH IS ESSENTIALLY LIKE INIT.D, BUT HAPPENS EXTREMELY EARLY AT BOOT TIME, IT IS SUGGESTED THAT REGULAR USERS DO NOT PUT ANY SCRIPTS IN INIT.A UNLESS THEY KNOW WHAT THEY'RE DOING, JUST USE INIT.D FOR OTHER SCRIPTS.

5 - UPDATE YOUR BUSYBOX TO THE LATEST VERSION (1.20.2 AT THE WRITING OF THIS). SOME EARLIER VERSIONS OF BUSYBOX ARE KNOWN TO NOT HAVE SOME OF THE REQUIRED SWITCHES FOR THE COMMANDS USED IN THE SCRIPT.

6 - AT THIS POINT THE SCRIPT REQUIRES THAT YOU HAVE A SECOND PARTITION IN YOUR MICROSD FORMATTED TO EXT4, ANYTHING ELSE WILL NOT WORK. THIS MAY CHANGE IN THE FUTURE, BUT AT THIS POINT IT'S A REQUIREMENT.

7 - FULLY READ THE INSTALLATION INSTRUCTIONS, MORE THAN ONCE IF POSSIBLE, BEFORE RUNNING THE SCRIPT. FAILING TO COMPREHEND WHAT'S GOING ON CAN POSSIBLY LEAVE YOUR DEVICE SEMI-BRICKED/CAUSE MAJOR HAVOC AND FORCE-CLOSES AND YOU'LL HAVE TO RESTORE A BACKUP. MORE THAN ANYTHING MAKE SURE TO BACKUP YOUR APPS.

INSTALLATION:

1 - Download the attached file on your device or PC.

2 - Extract the files and move it to an easy to access location in your device, such as /sdcard. Open USER_OPTIONS and ensure that all variables correctly apply to your device, LEAVE deletepostmove='false' until later. Set ENABLED='true' once you're reviewed everything.

3 - Open a terminal app (Rom Toolbox and such probably won't work because the script requires user input)

4 - Assuming that you moved all 6 files to /sdcard, execute the following commands in the terminal:

su
cd /sdcard
sh ./install-a2sd

You can also perform a clean install by using the command:

sh ./install-a2sd -clean

5 - The script will ask a couple of questions, answer them (ask someone for help if you're not sure).

6 - If all went well (The script will tell you that folders were created, files were copied and permissions were set) you'll be told that upon pressing enter your device will be rebooted. Press ENTER when ready or reboot manually if it fails to reboot on its own.

7 - STAGE 1 - NOTHING WILL HAVE NOTICIABLY CHANGED UPON THE FIRST REBOOT. This is normal. The first reboot will only garther many variables needed for the script to run properly, it will also give the opportunity to review the variables and ensure that everything is ok, so that you can disable the script in case the gathered variables are not correct, so that things don't get broken unecessarily. Please take a look at:

/sdcard/Tweaked.Scripts/A2SD/options/vars

If all looks good in there (even if you don't understand what the variables are for, ensure that the paths make sense, don't worry if you don't have /mnt/sd-ext and /mnt/temp, or /storage/sd-ext and /storage/temp as these will be created).

Reboot again after reviewing the variables.

8 - STAGE 2 - ONCE AGAIN, WHEN YOU REBOOT, NOTHING WILL APPEAR TO HAVE HAPPENED. In fact, this is not the case this time. If all variables were correct in STAGE 1, every app along with their data and files will have started to be copied over to the external storage as soon as the device finished booting. You should be able to see the process for this by opening the terminal and running the command:

logcat | busybox grep "01a2sd"

You can also run the following command in the terminal to ensure that there are extra mounts that did not exist prior:

mount

***THIS IS THE MOST IMPORTANT STEP IN THE PROCESS. MAKE SURE THAT YOU DO NOT REBOOT YOUR DEVICE UNTILL THE FOLLOWING FILE IS CREATED:

/sdcard/Tweaked.Scripts/A2SD/DEVICE_IS_READY

Failing to do so is the single worst mistake that you can do. Rebooting the device before the copying is done might cause all your apps to look like they're not installed, as well as major FCs, to the point where stuff is unusable and you have to restore a backup.

Just be patient during this step, specially if you already have a lot of apps installed, even more so if you have games that use a large amount of space.

9 - STAGE 3 - After rebooting from STAGE 2, the device will mount the external storage in every location where apps would reside in the internal storage. This is why it's extremely important that STAGE 2 is completed properly, because unless everything has been moved properly, files that were not copied will seem like they don't exist, possibly causing FCs and major havoc.

If everything went ok, it will actually look like nothing happened, but in fact, everything should be running from the external storage. You can confirm this by running the following command in the terminal:

mount

You should see three mounts that weren't there before that look like

/dev/block/mmcblk1p2 on /data/media/Android type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/app type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/dev/block/mmcblk1p2 on /data/data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)

At this point, it should be safe to open USER_OPTIONS in /sdcard/Tweaked.Scripts/A2SD/options and change deletepostmove='true'. Just remember that with this variable set on, all your apps will be wiped from external storage. This means that if you reboot without your MicroSD or if you lose the stuff in the MicroSD your alls will be gone. Becase of this, ensure that you have your apps backed up somewhere.