3

I created a symlink from /storage/sdcard1/somefolder to /data/media/0/somefolder, but apps treat the symlink as a file and not a folder (and crash because they are hardcoded to look for files inside a folder at this path).

Root apps that access the symlink from /data/media/0/somefolder works and treat it as a folder, non root apps use fused mount point at /storage/emulated/0/somefolder instead because they don't have the permission to look inside /data/media.

It is not possible to symlink to the fused point directly (cross device link error). Symlink's point permission on fused point are 770 for a app_ID:1028 instead of 777 for root:root like it is from /data/media, it's not possible to change permissions using root on the fused point. /storage/sdcard1/somefolder is 777.

debuggerd exploit is to be avoided as long as possible and mount points won't be visible system wide.

What need to be changed to make the symlink working from the fused point? How will it affect the rest of the system?

2

Android guards mount points since Android 4.2 came out. You already mentioned the debuggerd hack, so I assume you know about this restiction.

This might seem obvious, but you should first check if the file system that is used on the emulated external storage and on the real external storage both support symlinks. If your SD-card is formatted as FAT32, which doesn't support symlinks, nothing will happen and you'll need to format the external storage to something like ext2/3/4 or yaffs.

The 'cross device link' error might be fixed by using ln -s /data/media/0/somefolder /storage/sdcard1/somefolder instead of ln /data/media/0/somefolder /storage/sdcard1/somefolder. This will create a symbolic link instead of a hard link, so it can span across file systems and storage devices. You need to do this as root or else it won't work.

If permissions are a problem you might need to fix the 'external sdcard problem'. This problem causes the real external SD-card to be read-only on versions of Kitkat. The details are on this page. It comes down to editing /system/etc/permissions/platform.xml so that apps with the WRITE_EXTERNAL_STORAGE permission can also write to the 'real' external storage. This can be done by installing this app or by doing the following:

  1. Launch your favorite file manager with enabled root access rights. You can use any app you prefer which can run elevated on your device. For example, the 'Root Explorer' app or 'Total Commander' or 'File Manager' from CyanogenMod will do.

  2. Navigate to the following file:

/system/etc/permissions/platform.xml

  1. Find android.permission.WRITE_EXTERNAL_STORAGE and android.permission.WRITE_MEDIA_STORAGE lines. These are XML sections. You need to make them look exactly like the strings below:
<permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
<group gid="sdcard_r" />
<group gid="sdcard_rw" />
<group gid="media_rw" />
</permission>
<permission name="android.permission.WRITE_MEDIA_STORAGE" >
<group gid="sdcard_rw" />
<group gid="media_rw" />
</permission>

Save the platform.xml file. It’s necessary to set the file permissions to 644 (rw-/r–/r–) before mobile restarting. Now reboot your Android device.

Credits go to poolmaker@XDA

0

Sorry but I didn't get you well but if you mean that you want to free up more space on internal memory by creating symlinks Why don't you try Link2SD now it can to link even the private data of any app to external SD card without causing any problem in addition to but DON'T LINK ANY SYSTEM APPS TO external SD card as it will cause bad effects to your phone. It's so recommendable to have an SD card with high speed writing and reading

  • Link2SD cheat on debuggerd and doesn't allow arbitrary linking, from the last tests i did with it, could you show me an exemple on how to arbitrarly move /sdcard/arbitrary_folder to /storage/sdcard1/arbitrary_folder with Link2SD with files on this folder remaining available on both location for apps hardcoded to read on this unconventional path? How will link2sd allow me to make symlinks work on the fused mount point? – Zulgrib Oct 4 '14 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.