Not been happy with this, so I am reworking things
First off, make a nandroid backup
I have worked on this on my own phone but that's about it. I am using a Xionia kernel (010) (boot.img) on a Stock ROM. Customized with a Rodimus theme but otherwise a stock LG Optimus V. Your kernel needs to provide /etc/init.d support and also support for the filesystem you're wanting to use, e.g. ext3. The Xionia kernel with which I have tested this, provides those.
Attached is a flashable .zip that will install a script to do the following:
- mount the ext partition (as ext3 .. so edit the file if you need something else)
- move the directories app, data, local, misc and system from the /data partition to those named directories on the ext partition
- migrate and link dalvik cache entries for the /data/app programs to the ext partition. (IMPORTANT: You need to erase Dalvik cache after install)
- all directories linked are moved to a 'bak' directory so you can undo it. (See below for how to reclaim space after installation)
- any application and its data are then on your ext partition on the sd card, so no more storage space worries and nothing for you to do to maintain it!
CAVEATS:
- If there's no sd card, the phone will likely not boot. I hope to change this in an upcoming release.
TODO:
- get an e2fsck binary so the filesystem can be checked and fixed before mounting
- contingency plan for no sd card and/or failed mount so the phone boots, albeit with a 'blank slate', but it's better than not booting at all.
- separate preferences file, so customizations can be kept across updates
KNOWN BUGS:
- None?
- This works for me, that's all my testing I can do... if you find a bug, tell me
INSTALLATION
Boot to recovery (home, vol down, power) and make a nandroid backup
If you do not have an ext partition already:
Reboot the phone again, and back up the contents of your SD card (the FAT32 part) which will preserve your nandroid backups. Do this by connecting via USB and copying contents to your computer.
Boot to recovery again and partition/format the SD card to provide an ext3 partition - That will erase ALL your SD card contents!
You may wish to boot the phone to make sure it still comes up right. Recommended that you restore your SD card contents to the FAT32 part now.
In recovery, install the flashable zip file. This will also remove the Link2SD mount script automatically if it exists.
Your phone should boot and things are linked now. Wait, you're not done yet!
Restore your SD card contents if you have not done so already. That will keep your nandroid backups available.
Remove the Link2SD application if you had that installed before you do anything further, else you risk losing your applications
Shut down the phone, boot to recovery and make another nandroid backup.
In recovery, go to advanced menu and 'Wipe Dalvik Cache'. This is important that you do this before booting the phone again or it will likely not come up.
Once done, reboot the phone. It should start up correctly.
Now you're done and can install any applications with no decrease of storage size.
To reclaim storage, you will need to erase the '/data/bak' folder, either via Terminal Emulator or by Root Explorer.
Steps in Terminal Emulator:
$ su
# cd /data
# rm -r bak
Now you're done. Enjoy being able to install anything you like without worrying about storage space!
STORAGE SPACE
Please be aware that since we are LINKING from your original /data partition to directories on the ext partition you will not see the storage space of the ext partition when yo go to 'SD Card Storage' in the main settings menu. That's because the phone does not know about this extra storage space we've made available. Your original /data partition (that's part of the phone) is still there and mounted, we are just redirecting reads and writes to the SD card's ext partition. If you are really curious, go to Terminal Emulator and type 'df'. You will see your ext partition as '/data/sdext2' and can see how much is in use.
WHY?
I hope it helps someone manage their storage space better. For myself I wrote this because I was tired of using (albeit the very easy-to-use) Link2SD to link every program I installed. I was also thinking how every time I install an app to try it out it wears on the internal memory of the phone (that I cannot replace) where I would rather have it use the sd card (which can be replaced cheaply). I could not get the data2ext script working, so I wrote this as a way to get the best of both worlds. The /data partition is mounted as part of the init.rc script which is contained in the ramdisk inside boot.img, so it is very hard to edit to change it to a different location. That, I think, is why the original data2ext did not work for me. This method does, so I thought I'd share it.
The script can be invoked as 'migrate_dalvik_cache' provided you have root access and Terminal Emulator or SSH access to your phone. It will provide the same clean-up operations for the dalvik-cache without needing to reboot your phone. For the most part, it's unlikely you'll need to run it. The command name is important, don't re-run the script in /etc/init.d once the phone is booted.
So, please be careful with it, I hope it works
Please report successes or failures.
VERSION HISTORY
0.1 - Initial release
0.2 - Mount options for better usage on flash storage, helps with responsiveness too
0.3 - Moved to ext3, bugfixes for setup of command line invocation
0.4 - Bugfixes for moving app directory
First off, make a nandroid backup
I have worked on this on my own phone but that's about it. I am using a Xionia kernel (010) (boot.img) on a Stock ROM. Customized with a Rodimus theme but otherwise a stock LG Optimus V. Your kernel needs to provide /etc/init.d support and also support for the filesystem you're wanting to use, e.g. ext3. The Xionia kernel with which I have tested this, provides those.
Attached is a flashable .zip that will install a script to do the following:
- mount the ext partition (as ext3 .. so edit the file if you need something else)
- move the directories app, data, local, misc and system from the /data partition to those named directories on the ext partition
- migrate and link dalvik cache entries for the /data/app programs to the ext partition. (IMPORTANT: You need to erase Dalvik cache after install)
- all directories linked are moved to a 'bak' directory so you can undo it. (See below for how to reclaim space after installation)
- any application and its data are then on your ext partition on the sd card, so no more storage space worries and nothing for you to do to maintain it!
CAVEATS:
- If there's no sd card, the phone will likely not boot. I hope to change this in an upcoming release.
TODO:
- get an e2fsck binary so the filesystem can be checked and fixed before mounting
- contingency plan for no sd card and/or failed mount so the phone boots, albeit with a 'blank slate', but it's better than not booting at all.
- separate preferences file, so customizations can be kept across updates
KNOWN BUGS:
- None?

- This works for me, that's all my testing I can do... if you find a bug, tell me

INSTALLATION
Boot to recovery (home, vol down, power) and make a nandroid backup
If you do not have an ext partition already:
Reboot the phone again, and back up the contents of your SD card (the FAT32 part) which will preserve your nandroid backups. Do this by connecting via USB and copying contents to your computer.
Boot to recovery again and partition/format the SD card to provide an ext3 partition - That will erase ALL your SD card contents!
You may wish to boot the phone to make sure it still comes up right. Recommended that you restore your SD card contents to the FAT32 part now.
In recovery, install the flashable zip file. This will also remove the Link2SD mount script automatically if it exists.
Your phone should boot and things are linked now. Wait, you're not done yet!
Restore your SD card contents if you have not done so already. That will keep your nandroid backups available.
Remove the Link2SD application if you had that installed before you do anything further, else you risk losing your applications
Shut down the phone, boot to recovery and make another nandroid backup.
In recovery, go to advanced menu and 'Wipe Dalvik Cache'. This is important that you do this before booting the phone again or it will likely not come up.
Once done, reboot the phone. It should start up correctly.
Now you're done and can install any applications with no decrease of storage size.
To reclaim storage, you will need to erase the '/data/bak' folder, either via Terminal Emulator or by Root Explorer.
Steps in Terminal Emulator:
$ su
# cd /data
# rm -r bak
Now you're done. Enjoy being able to install anything you like without worrying about storage space!
STORAGE SPACE
Please be aware that since we are LINKING from your original /data partition to directories on the ext partition you will not see the storage space of the ext partition when yo go to 'SD Card Storage' in the main settings menu. That's because the phone does not know about this extra storage space we've made available. Your original /data partition (that's part of the phone) is still there and mounted, we are just redirecting reads and writes to the SD card's ext partition. If you are really curious, go to Terminal Emulator and type 'df'. You will see your ext partition as '/data/sdext2' and can see how much is in use.
WHY?
I hope it helps someone manage their storage space better. For myself I wrote this because I was tired of using (albeit the very easy-to-use) Link2SD to link every program I installed. I was also thinking how every time I install an app to try it out it wears on the internal memory of the phone (that I cannot replace) where I would rather have it use the sd card (which can be replaced cheaply). I could not get the data2ext script working, so I wrote this as a way to get the best of both worlds. The /data partition is mounted as part of the init.rc script which is contained in the ramdisk inside boot.img, so it is very hard to edit to change it to a different location. That, I think, is why the original data2ext did not work for me. This method does, so I thought I'd share it.
The script can be invoked as 'migrate_dalvik_cache' provided you have root access and Terminal Emulator or SSH access to your phone. It will provide the same clean-up operations for the dalvik-cache without needing to reboot your phone. For the most part, it's unlikely you'll need to run it. The command name is important, don't re-run the script in /etc/init.d once the phone is booted.
So, please be careful with it, I hope it works

VERSION HISTORY
0.1 - Initial release
0.2 - Mount options for better usage on flash storage, helps with responsiveness too
0.3 - Moved to ext3, bugfixes for setup of command line invocation
0.4 - Bugfixes for moving app directory
Last edited: