[Galaxy 3 Android Development] mizch:
If you are always low on program memory, this data2sd might be for you. It works with any Froyo for the G3.

Note: This won't wipe your data, but you should have a backup, just in case. First backup the phone to the SD card, then the SD card to your computer. Be cautious. I give no guarantee whatsoever. If your phone behaves funny, even eats your cat afterwards, I take no responsibility.

Note: starting with version 3, the new storage size will NOT be reflected in the Task Manager or in Titanium Backup. I'll see what I can do about it.

You need a rooted phone and an SD card, preferably 2 GB or more and class 6 or better (higher). data2sd doesn't make your phone faster. Much to the contrary: it extends your memory at the cost of speed. That said, if your SD card is of a class smaller than 6, this will work too. The slowdown, however, will be noticeable in some situations.

Three steps are needed. First, we need a kernel with built-in ext4 if you don't have one. Second, we bring the data2sd into its place. And third, we create an ext 4 partition with the desired size. Now follows a detailed description of these steps.

Step 1: Check your kernel

You need a kernel with built-in ext4 capability. The custom ROMs mostly have one. If you are running a stock kernel, you must install one, e.g. from http://xdaforums.com/showthread.php?t=978823 . Follow the installation steps detailed there. (Changing the kernel does not wipe your phone).

Step 2: Install data2sd

You now must install data2sd onto your phone. As long as you didn't modify your SD card (as long as partition #2 is not ext4), this will have no further impact on your phone.

Download data2sd.zip from below and unzip it. There's a single file in there: data2sd.sh. Use the tool that suits you best to transfer it to the SD card of your phone. With adb, you would do

adb push data2sd.sh /mnt/sdcard

Now either start a terminal emulator with a root shell or use adb again. With adb, you would execute

adb shell

Make sure you are root (the prompt reads '#'), else run "su". Now type in:

# sh /mnt/sdcard/data2sd.sh

You will see some lines about what is happening and a final confirmation.

That's it. Again, your phone will continue to behave as usual.

Step 3: Prepare your SD card

You can use any amount of program memory up to the size of your SD card, but be sure to leave some room for application data on the normal (#1, vfat) partition. As a rule of thumb, 0.5 GB of program memory will satisfy most needs, 1 GB is plenty.

If you're running Linux, prepare a second partition (must be partition #2) with the desired size. Use the usual utilities to do so. This includes gparted, but there are also other means. If you use gparted, you can follow the description for Parted Magic below.

If you have no access to a Linux computer, even not your friend's, your (probably) best choice is to run Parted Magic from a live CD. For this, go to http://partedmagic.com, and burn your CD. Instructions on how to do it with different burning tools are also there.

Step 3.1

: Partition and format your SD card with Parted Magic (also applies to gparted)

The following describes the steps to partition your SD card with Parted Magic. You don't need to use this method - use the tool that suits you best.

I assume you have gparted or Parted Magic running and your SD card inserted into the card reader of your PC. Now select your card from the drop-down menu of available drives in the upper right corner. You better double check that you're on the correct drive (card). It will happily erase your system disk if told to do so.

Right click near top into the block designating your current partition #1. Select "resize". (I assume that your partition #1 is the only one. If not, delete the other partition(s)). Change the size to the total size of your SD card minus the desired size for program storage (/data). Confirm your selection.

There is now a gray block designating free space to the right of your first partition. Right click it and select "New". In the following window, leave the sizes as they are. Leave "create as" to be a primary partition, and change "file system" to ext4. Confirm your selection ("Add").

The gray block at the right has changed to a colored frame. Right click it again and select "Format as". Select "ext4".

If everything went well, you can now click on the green check mark in the icon bar near the top, confirm, and watch Parted Magic resizing your normal (#1, VFAT) partition and creating the new ext4 one.

4. Finale furioso

Now insert the SD card and reboot your phone. The Task Manager will report the new size in its rightmost tab, as do the other utilities like Titanium. All user apps and data should be in place. All will look like you have soldered in an extra chunk of internal memory. Despite not being directly visible, your program memory is resized to be the new partition. You see its size and its usage (in percent) by running

df

from adb or from a terminal emulator. Have a look at the subdirectories of /data displayed there.

As a final step, you can safely remove data2sd.sh from your SD card (/sdcard). It is not needed any more.

Q&A

* How can I remove my SD card while the phone is on?

You can't. Don't try. Always switch your phone off before you remove the SD card.
​

* How can I return to the state before data2sd?

Remove the SD card. All user data and apps will be there in the state you left them before you installed data2sd. The data2sd script you have installed simply does nothing as long as there is no ext4 #2 SD partition.

If you want to reuse the SD card, remove partition #2. This can be done with each partitioning tool, you don't need Linux.
​

• What about app2sd from Kyrillos 3.0? Is it compatible?

Yes. But "no" for the "no wipe" version which was offered for a short period of time. In the latter case, clear out the ext4 partition (important: do not forget the hidden .data2sd_initialized file) or simply reformat it before reusing it.
​

* It doesn't work. What can I do to help diagnose the problem?

See if the file /mnt/asec/data2sd/log.txt exists. If it does, have a look at it and try to make sense of it. If it doesn't tell you anything useful, add it to your error description in the forum here. If there is none, mention that in the description.
​

* What things must be considered if I flash a new ROM?

As always with such actions, make sure you have a backup. That said, just flash the new ROM and then install data2sd. When you reboot with the SD card in place, all user Apps and all data should be there. No restore from backup required.

Only in the rare case that the new ROM explicitly requires you to NOT restore your old data, e.g., from Titanium, you should reformat your ext4 partition (to clear it out) and proceed as advised by the ROM makers.
​

Versions:

2011-03-19 Initial release

2011-03-21 Version 2

- Updated for ROMs without /system/etc/init.d

- Simplified installation of the core parts

2011-03-23 Version 3

- Vibration bug fixed

- App2SD mode added: If the ext4 partition bears the volume label "app2sd" on a new blank SD, only /data/app is moved. This greatly reduces size benefits, but results in nearly no speed loss.

- Just run the data2sd.sh file (as described in step 2) to upgrade without data loss.

- Note: the actual size will NOT be reflected as described in the Task Manager or in Titanium.