Mount sdcard partition as /data I originally wanted to comment here to ask a clarification question. But as I haven't enough reputation and it seems there isn't any private messaging possible, I opened this new question.

The device is a Moto G2 with 8GB storage. I configured it under cm13 to use a 64GB sdcard as adoptable storage.
After a few weeks my sister called, the device disconnects the sdcard very often and wants it to be reinserted.

In the hope that it's only the sdcard giving up, I ordered a new one and copied the whole disk with dd if=/dev/oldCard of=/dev/newCard.
Have to wait, if the problem is gone or not. But I thought about, if the adoptable storage option of Android isn't that brilliant and therefore googled if I could somehow mount an ext4(/or f2fs) partition on the sdcard under /data.

The answer I found here on Android Enthusiasts, sounds interesting, but I can't believe that this works this way, as of my understanding...
So, in the linked answer, it says:


  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
  


So, my problem/confusion with this are the following points:


If I create a symlink in the root dir to something else, this link is gone up on a reboot. So how am I supposed to make the link from /data to some other place persistent?
If I make /data point to /sdcard/data, wouldn't the mount command now mount the partition in which the data is really stored under /sdcard/data? So the data would still be placed in the internal memory, but the point where it's mounted in the system is a different/wrong one, right?


My aim would be, to have a sdcard formatted with ext4/f2fs and get it mounted as /data like mount /dev/block/mmcblk1p1 /data instead of the internal data partition. But can I do that WITHOUT modifying the fstab of the kernel for every update I want to do manually?

L
I have done the exact same thing in the past with a Samsung Galaxy Y DuOS S6102 by replacing all the mount lines concerning the data partition in the init scripts and fstab file. 

I couldn't find better solutions (think as future-proof) for the problem because once you look at the boot process for a generic Android device in Wikipedia, you'll notice the kernel runs the init scripts which makeup the directory tree and mount certain stuff that lay the foundations for Dalvik/ART runtimes to kick-in.

So by making a few tweaks to these scripts and partitioning the 8GB SD card into 1GB and 5.6GB, I was able to make it work boot.

Note: The device I used runs on ancient technology with little security features as compared to modern techniques. Hence, you might wanna be careful before making changes.