This is the way to have /data
on the SD Card directory:
- Copy all
/data
to the SD card directory: /mnt/sdcard/data
- Delete
/data
- Create a symlink that points to the SD:
ln -s /mnt/sdcard/data /data
The main problem is that /data
could be EXT2/3/4 partition, while the SD Card is FAT32. The best thing to achieve what you want is to create an extra partition on the SD Card as EXT2/3/4 filesystem. Then you can link the directory /data
with the partition.
When the phone restarts, it will mount the data partition more or less like this:
mount <args> /dev/block/mmcblk0p2 /data
Since /data
is pointing now to /mnt/sdcard/data
, the above command is equivalent to this one:
mount <args> /dev/block/mmcblk0p2 /mnt/sdcard/data
So in the end, we would have our data partition mounted in the SD card. Again, it should be in a separate partition, so we have the SD card as FAT and the extra partition as EXT2/3/4 so it won't fail when it mounts due to the filesystem.
If you want a more elegant solution, you can try any of the XDA Developers App2SD scripts, they let you achieve the same but without symlinking (it will mount it and bind it to /data
). You will only need a Custom Recovery to be able to flash them. You can check them here.