Change TWRP /sdcard symlink location from /data/media/0 to /data/media - Android Q&A, Help & Troubleshooting

Hi, I recently compiled a TWRP for E506 plus, the problem is that the internal memory of the device is /data/media but the TWRP continues reading /data/media/0 also creating a new folder inside the internal memory called 0. In this way it is not possible to install zip from the internal memory if not manually browsing to /data/media, how can I solve?
I also tried to modify the fstab like this:
Code:
/sdcard auto /data/media
But it didn't work and I also tried to create a symlink but nothing.
Device Tree: https://github.com/XRedCubeX/twrp_device_E506plus

Thread closed per OP request.

Related

mount sdcard to /sdcard

is there anyway to mount the real sdcard to /sdcard?
i tried to edit the vold.fstab, but it just bootloop on the animation.
http://forum.xda-developers.com/showpost.php?p=23347641&postcount=14
he is mounting to "/mnt/sdcard" while i used "/sdcard"
Code:
dev_mount sdcard /mnt/sdcard auto /devices/platform/msm_sdcc.3/mmc_host/mmc2
where should it be mount to or is it because of different phone?
sams-roots said:
is there anyway to mount the real sdcard to /sdcard?
i tried to edit the vold.fstab, but it just bootloop on the animation.
http://forum.xda-developers.com/showpost.php?p=23347641&postcount=14
he is mounting to "/mnt/sdcard" while i used "/sdcard"
Code:
dev_mount sdcard /mnt/sdcard auto /devices/platform/msm_sdcc.3/mmc_host/mmc2
where should it be mount to or is it because of different phone?
Click to expand...
Click to collapse
/sdcard is normally a symbolic link pointing to /storage/emulated/legacy
There's an internal "sdcard" that normally gets mounted onto /mnt/shell/legacy from /init.qcom.rc - that's symlinked to /storage/emulated/legacy in that same file. It also appears to start up a daemon that re-mounts the internal "sdcard".
What are you trying to do? Normally the external SDcard is mounted to /mnt/extSdCard, so you should just store data there rather than /sdcard.
(Or /mnt/sdcard, /mnt/shell/legacy, /storage/emulated/legacy, or any of the other things simlinked to the internal sdcard.)

[Q] Emulated internal storage as sdcard

Hello everyone.
Yesterday I received my Huawei Honor 3C and I've installed MIUI ASAP instead of Emotion UI.
Everything's great but I have a problem with double SD Card, I mean: I have my own external card and the phone got his own by emulating it's internal storage as SD Card (it's a symlink to /storage/emulated/0 and it's the same as /storage/emulated/legacy, so this fake sd is eating up my storage, there are also other symlinks in /storage/, /mnt/ and even in root folder there is a symlink sdcard->/storage/emulated/legacy). Phone and apps are correctly seeing external card as SD Card but in reality the internal storage is being used for everything.
Because of this I have only about 5GB available instead of 64GB
Is there any way to terminate the emulation or changing it's target to sdcard2 so that I could use my card correctly? I've tried few things but nothing works. Symlinks are being recreated during boot so editing or deleting them does not work. Editing vold.fstab does nothing because ext is being mounted after boot while the emulation stars while in it - I guess that a proped ini script could do the work.
huaweiproblem said:
Hello everyone.
Yesterday I received my Huawei Honor 3C and I've installed MIUI ASAP instead of Emotion UI.
Everything's great but I have a problem with double SD Card, I mean: I have my own external card and the phone got his own by emulating it's internal storage as SD Card (it's a symlink to /storage/emulated/0 and it's the same as /storage/emulated/legacy, so this fake sd is eating up my storage, there are also other symlinks in /storage/, /mnt/ and even in root folder there is a symlink sdcard->/storage/emulated/legacy). Phone and apps are correctly seeing external card as SD Card but in reality the internal storage is being used for everything.
Because of this I have only about 5GB available instead of 64GB
Is there any way to terminate the emulation or changing it's target to sdcard2 so that I could use my card correctly? I've tried few things but nothing works. Symlinks are being recreated during boot so editing or deleting them does not work. Editing vold.fstab does nothing because ext is being mounted after boot while the emulation stars while in it - I guess that a proped ini script could do the work.
Click to expand...
Click to collapse
First thing I do to troubleshoot that stuff is to copy everything off the internal storage, then format it in recovery, then copy everything back when booted up.
Why do you think that wiping and installing the exact same stuff could help? If you're copying back the same files that were there before - then you're back at starting point.
I've tried also a few different things, mostly trying to modify inid.rc scripts.
I found an interesting script in init.ssd.rc, that is:
Code:
on init
# See storage config details at source.android.com/tech/storage/
# fix non-shell uid process can not access shared-sd
mkdir /mnt/shell 0700 shell shell
chmod 0750 /mnt/shell
chown shell sdcard_rw /mnt/shell
mkdir /mnt/shell/emulated 0700 shell shell
mkdir /mnt/shell/emulated/0 0700 shell shell
mkdir /storage/emulated 0555 root root
mkdir /storage/sdcard1 0000 system system
export EXTERNAL_STORAGE /storage/emulated/legacy
export SECONDARY_STORAGE /storage/sdcard1
export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
export EMULATED_STORAGE_TARGET /storage/emulated
mount tmpfs tmpfs /storage/emulated mode=0705,uid=1023,gid=1023
# Support legacy paths
symlink /storage/emulated/legacy /sdcard
symlink /storage/emulated/legacy /mnt/sdcard
symlink /storage/emulated/legacy /storage/sdcard0
symlink /mnt/shell/emulated/0 /storage/emulated/legacy
symlink /mnt/shell/emulated/0 /storage/emulated/0
symlink /storage/sdcard1 /mnt/sdcard2
and so I deleted those symlinks, packed up the ramdisk and flashed boot.img with those changes... still nothing, the symlinks are still being recreated every boot.
Damn, what a stupid thing. I've found a solution on 4pda forums. I was trying to do it the complicated way while I had everything in the system settings, in a hidden MIUI menu with some untranslated chinese marks.
Under battery settings there are options in chinese, I just had to choose the fifth chinese one and change the storage options :victory:
huaweiproblem said:
Damn, what a stupid thing. I've found a solution on 4pda forums. I was trying to do it the complicated way while I had everything in the system settings, in a hidden MIUI menu with some untranslated chinese marks.
Under battery settings there are options in chinese, I just had to choose the fifth chinese one and change the storage options :victory:
Click to expand...
Click to collapse
Glad you solved it. The reason I mentioned the wipe and all because it's not an uncommon issue when switching from some stock system to custom ones (like CM, etc) where they change the mount point of external from /sdcard to /sdcard0 and it will just copy everything from /sdcard/ to /sdcard0 and you'll have copies of everything which cuts the storage in half. Case in point: http://forum.xda-developers.com/showthread.php?p=51709918#post51709918

[Q] Serious problem with Android's built-in encryption?

I came across a problem with Android's built-in encryption function and typical sdcard data. I searched everywhere on the internet and this is what I could collect so far:
Also, from my research, while I cannot confirm this, I have read that prior to 4.2, external (public) storage in Android was /mnt/sdcard/ (if you are not familiar with the Android file system, "sdcard" refers to public storage that is internal...not necessarily an external sdcard), but this was just a symbolic link from the protected /data/ directory. At the time, Android only encrypted /data/, which was fine because the symbolic link would also encrypt any personal files in the public directory.
After 4.2, due to multiple profiles, the public storage was moved to /storage/emulated/legacy. That means if Android's "full disk encryption" only encrypted /data...then any sensitive data in the public directories is not encrypted (this could be downloads from work, private photos, etc).
Click to expand...
Click to collapse
Source and full topic: https://productforum...xus/Lzsje-4QfTQ
This can be OEM dependent indeed, but /mnt/sdcard is now just a symlink to
a 'virtual' SD card that lives under /data. So downloaded documents, media
etc. are encrypted along with private data, etc. From the boot script:
# create virtual SD card at /storage/sdcard0, based on the /data/media directory
# daemon will drop to user/group system/media_rw after initializing
# underlying files in /data/media will be created with user and group
media_rw (1023)
If one some device /mnt/sdcard (external storage) is independent from /data,
it might not get encrypted. But then again they may modify the
firmware to encrypt it.
Click to expand...
Click to collapse
Source and full topic: https://groups.googl...uss/-mE-XTot0Gg (This is also only referring to Android versions =< 4.0)
1.) I checked a CM 11 installation on a Huawei Ascend Y300 and I could find the same internal SD card data in
/internal_sd -> /storage/sdcard0 (fuse)
/mnt/internal_sd -> /storage/sdcard0 (fuse)
/mnt/media_rw/sdcard0 -> /mnt/media_rw/sdcard (vfat)
2.) /data/media does not contain the files as the others in 1.).
3.) /internal_sd is the only partition visible via TWRP file manager, which could mean that the others are created during the start of Android itself.
2012
So the actual physical storage place is still /data/media. /storage/sdcard0 is a "virtual" SD card. /sdcard and /mnt/sdcard are symbolic links of /storage/sdcard0.
Click to expand...
Click to collapse
I'd guess that the virtual sdcard exists because /data/media is part of an ext# partition, so they use fuse filesystem and virtual sdcard to make it look like fat to apps, many of which don't understand ext# filesystems.
Click to expand...
Click to collapse
2013
http://forum.xda-developers.com/galaxy-s3/general/info-flashed-4-2-sdcard-data-t2274218
Click to expand...
Click to collapse
I'd assume the actual physical storage place is /storage/sdcard0 now, but I'm not sure.
Conclusion: To make the encryption include typical "sdcard data" again, we would have to somehow change it back to this:
So the actual physical storage place is still /data/media. /storage/sdcard0 is a "virtual" SD card. /sdcard and /mnt/sdcard are symbolic links of /storage/sdcard0.
Click to expand...
Click to collapse
Are my thoughts on this correct so far or does anyone have an idea?
Does this mean older Android versions (pre-4.2) did not actually have this problem?

Help Remount Default /sdcard PATH, Please

Reasons:
0.) You know, apps like messing up internal storage.
1.) I have installed dozens of ROMs flashed with DualBoot Patcher(It's a great tool), and all of them share the same /sdcard path( /data/media/0, actually it's /raw/data/media/0 ), it's a terriable mess.
2.) Android Nougat does NOT have xposed yet, so I cannot use xposed module XInternalSD to do this.
Due to /sdcard being linked to /storage/emulated/0, I should mount -o bing $another_path to /storage/emulated/0.
What I want to do is:
remount $data_partition_mount_point/media/$my_path to /storage/emulated/0 when the phone is booting, so my system can use another path for internal storage
I want to unmount the default /storage/emulated and only to mount /storage/emulated/0 to keep /storage/emulated clean.
CAN I ?
But after too many times failed, I failed again. I CANNOT mount $my_path as Internal Storage again. It ends up with "Access Denied",or "cross-device link", or seperated permissions(not as a sdcard)
Also, I tried to modify install-recovery.sh to let my scripts execute when booting, but sepolicy denied my orders (like mkdir, mount, setenforce ). So, I run my scripts via APP "Boot Shell".
Is there anyone who know how to do this? Or, can a script change the default Internal Storage path?

symlink app data to external sd card

Hi,
i'm trying to move the data folder of google photos to my external sd card.
i entered in ssh and created a symlink (with ln -s) of the folder /data/data/com.google.android.apps.photos --> my sdcard.
i updated the authorization of the symlink and of the files on the sdcard, i changed the group/owner also.
from a 'ls -l' the link looks like the original directory.
it's not working, it looks like google photo can't write/update its "database" file
I thought maybe google photo doesn't have the right WRITE_EXTERNAL_STORAGE but it has.
I have two partitions on my sdcard, vfat and ext4, do i need to link to a specific one maybe ?
What i'm doing wrong ?
thanks

Categories

Resources