Question regarding internal storage... a big mystery! - One (M8) Q&A, Help & Troubleshooting

I recently had a problem where I had to do a factory restore on a non-bootable phone... and my only option was to use adb shell to copy the extracted stock lollipop nandroid files to the TWRP folder in internal storage [there may have been other ways, but I was not aware of one.]. Thanks to 3484jacks, thebobmannh, ckpv5, and redpoint73. I hope I didn't forget anyone.
OK.. so that worked... but it was very messy. Why? Because my first (and obvious) choice was to create the subfolder under TWRP and then adb push the files to that folder.
The folder I am referring to is the "root" folder of internal storage, also called the /sdcard/. It usually has other directories/folders such as .data, Android, Ringtones and/or Media.... I am sure you know what I am referring to. And on this "root" of the internal storage (sdcard) is the TWRP folder which contains backups. The path to the backups is sdcard/TWRP/BACKUPS/{device serial number}/name-date of backup.
However, when I did an adb push to the above folder, by using the following command:
adb push c:/nandroid/ /sdcard/ TWRP/BACKUPS/FXXXXX/nandroid (<<==I had already created the nandroid folder as you cannot push an entire folder to your phone; only the files contained therein will be pushed over)
....my files did not end up in /sdcard/TWRP/BACKUPS/FXXXXX/nandroid. Instead they were copied to /sdcard/storage/TWRP/BACKUPS/FXXXXX/nandroid. For some reason when pushing to the sdcard, adb pushes it to a subfolder called storage. I am not sure why this is... perhaps it is because we really are not talking about a physical sdcard, but rather internal storage. In any event, to fix my phone I had to use adb shell and I copied all of the nandroid files from /sdcard/storage/TWRP/{. . .} to /sdcard/TWRP/{ . . .}.
If you are in the true root (system) directory, there are several paths which lead to "internal storage"... and I want to know if anyone has any clue why there are multiple paths and what they mean. Below are the multiple paths from the system directory to internal storage:
(root)/storage/emulated/0/
(root)/storage/emulated/legacy/
(root)/storage/sdcard/
(root)/sdcard/
All of above paths lead to the exact same place (or so it seems)...a place which very much appears like internal storage.
However, I have run into this weird creation of a storage folder on the sdcard (internal storage) before. Several months ago, I copied via USB my entire sdcard to my Windows desktop. Oddly, several folders that I would have expected to be on the sdcard (as they are when viewing with Root Explorer) were not there. When inspecting what I had copied to my desktop, I found that the Download folder and 4 or 5 other folders, ended up in a "/(sdcard)/storage" sub-folder. EXACTLY like what happened to me yesterday (but kind of in reverse as I was copying TO the sdcard)
So that is my first question... Why does this happen? What is emulated? what is the difference between (root)/storage/emulated/0/ and (root)/storage/emulated/legacy/????
My next question, very intimately related to the above, is more of a problem.
The nandroid files I referred to above which I had initially pushed to the sdcard whereupon they ended up in the storage subfolder are still there. And whether I use Root explorer or adb shell, I get a "DELETE FAILED" or "PERMISSION DENIED" error respectively. And in case you are wondering, I did a 'su -' in adb shell before I attempted this. I had to grant access to SuperSU as a toast came up asking for the root rights.
Strange....I never thought internal storage had permissions, but I guess they do.
So the big question...and a solution to getting rid of the mess of files which are taking up several GBs of space on my sdcard (internal storage)... how do I delete the /storage/ folder on my sdcard? The folder was not there before.
Even if I drill down to the individual files (either in adb shell or root explorer) I still get a PERMISSION DENIED.
Please help. NOTE: I thought about reformatting the partition... but what guarantee will I have if I try to push my backed up sdcard data BACK to internal storage?? I probably can make sure that I delete the problematic nandroid files above by deleting them first in Windows, but that doesn't mean my sdcard won't still have another storage subfolder create.... and who knows what will be in it? [and this is the genesis behind my asking the first questions above about internal storage, the "emulated" name in the path, and the multiple paths from the system folder. I figured if I understood what was going on, I would be more likely to fix it.]
Thank you in advance for any assistance!!!

Related

[Q] How do I allow apps to write to internal SD? (Jelly Bean JRN84D)

Just put on this jelly bean ROM, and when trying to save files from dropbox onto the internal sd it says "error". Audiogalaxy, another app I use, won't allow me to save copies of my songs to the internal SD either. I feel like there's a setting somewhere that's preventing me from save files onto the internal sd, but can't find it. In ICS I was able to find it, pretty sure in Settings -> Storage, but no dice in Jelly Bean.
Any help?
I have you made sure settings>developer options>protect USB storage is not checked. That's where I'd start.
Just fired up Wugs toolkit 1.4 and set full file read/write/execute permissions to all those directories (or at least tried to). Still nothing.
Wanted to update that I was able to rename the DCIM folder to DCIM1 and now it can save camera pics to the phone. I still can't open up a dropbox file due to "storage full or unavailable".
I think you have an issue. You shouldn't have to grant any extra permissions for the apps to write to the SDcard, as there isn't actually an SDcard or partition for it. It's just a symlink to /data/local, a virtual "SDcard".
All my apps work fine writing/reading the "SDcard".
Have you made sure settings>developer options>protect USB storage is not checked. That's where I'd start.
o_z0ne said:
Have you made sure settings>developer options>protect USB storage is not checked. That's where I'd start.
Click to expand...
Click to collapse
Yessir this is not checked.
EDIT: also noticed that when I take a picture, it doesn't save it to the phone. The pic just disappears after it's taken.
Try fixing permissions and checking the permissions/owner on /sdcard/ and /data/media (where the /sdcard folder is symlinked from). There have been lots of threads about sdcard permissions and Jelly Bean,.
ex:
http://forum.xda-developers.com/showthread.php?t=174832
http://forum.xda-developers.com/showthread.php?p=2696762
Similar:
http://forum.xda-developers.com/showthread.php?p=21746289
Other possible solutions are suggested in links.
Just fired up Wugs toolkit 1.4 and set full file read/write/execute permissions to all those directories (or at least tried to). Still nothing. There's gotta be something I'm doing wrong here, I can't be the only guy who has this jelly bean rom installed and isn't using a microSD card.
papabri said:
There's gotta be something I'm doing wrong here, I can't be the only guy who has this jelly bean rom installed and isn't using a microSD card.
Click to expand...
Click to collapse
That's probably true, considering the GNex doesn't have a MicroSD slot .
haha yes true.
Wanted to update that I was able to rename the DCIM folder to DCIM1 and now it can save camera pics to the phone. I still can't open up a dropbox file due to "storage full or unavailable".
Solved this issue by doing this:
Reflash stock. Hold off on restoring data/media. There seems to be a problem with it in v1.4.
{{ WugFresh }}
I since put back on the JB rom and have full access with no issues. My issue was when I restored my backup to the phone, the permissions were messed up.
What you probably had was an ownership issue, not permissions.
http://forum.xda-developers.com/showpost.php?p=22970837&postcount=14
cmstlist said:
Latest CWM touch as of today, and also tried it with latest CWM non-touch.
Incidentally I just bumped into a caveat of transferring files to the GN in recovery mode. The permissions are set strangely when you push files over ADB in recovery, and as a result when booted into the OS I was unable to rename any of the pushed files/folders or put new files in. Since the DCIM directory was one that I'd pushed over, new photos weren't saving. And I did not have permission to change permissions.
To see the permissions properly when booted into the OS, you have to go into /data/media rather than /sdcard (same directory but permissions appear differently).
When I went in there and typed ls -n, I found that all the files I had pushed in recovery have UID & GID of 0. All files I had created afterwards had UID & GID of 1023. That explains everything. The owner is root for files that came from ADB in recovery, and media_rw for files created in the OS.
I can use chown, but it looks like the version of chown that comes with busybox does not have -R recursion implemented. Hrm. Aha! In CWM, chown does support -R. And we're off to the races. So from recovery I did:
cd /data/media
chown -R media_rw.media_rw *
Click to expand...
Click to collapse
So if you bump into this again, try chown in ClockworkMod in ADB shell over USB.

Confused by file system

When I plug my phone into my PC I can see a file on my SD card called 'Android' with my game data.
But when I open ES File explorer on my phone there is another file called 'android' (small 'a') which appears empty, but I can't delete it.
When I go up to root /data/media I can see what looks like my SD card with the 'Android' and 'android' folders but there appear to be duplicate files while others are missing or moved.
I think after flashing new kernels this week there are duplicate files being created. I often have to re-download game data after flashing a kernel and I seem to be losing a lot of SD memory.
I just want to know which folders should I delete?
Using superuser permission should allow you to delete the "android" folder or file. If ES Explorer don't work, try Root Explorer or do it in adb if you know how.
In linux file systems, A and a can be two different files or folders.
Or you can reflash google factory image and that will wipe the entire internal storage.
Thanks.
I managed to delete both the Android folders.
Had to re-download all my game data but I've ended up with about 3 gig more memory.

[Q] How do I fix file permissions on SD card?

OK, I finally installed PA 2.99 beta6 which I've wanted to do for a while. First to preserve the file structure and not have /0 folders, I copied all my old SD card files to /data/media as told in the guide linked below. I'm thinking my issue started when I didn't delete the /0 folder after installing the stock 4.2.1, but now all my old SD card files have incorrect permissions for me to access them. Is there a quick and easy way to fix it, preferably from the phone? I'm gonna wipe and reinstall everything tomorrow if necessary, but I can't do it until tomorrow morning. I'm not even sure what permissions I should set to make the files accessible again. I think I may have screwed up by not setting permissions when copying files using the toolkit also. I'm still pretty noobish and I thought that was only necessary for system files. I thought the correct permissions would follow everything else. I did find that I can take a song that's in the /data/media/music file, which won't play, move it to /sdcard/music, and it plays. I tried changing permissions and owners on the non-working files to match the working files, but no luck.
I really appreciate any advice or help anybody has.
http://forum.xda-developers.com/showthread.php?t=1999214
Ok, so you have moved all your content, in the new media folder, but I read you can't read any media from that folder. I guess that it s completely normal, as I would have only put backups to be used in this precise folder. Correct me anybody if I'm wrong, but music should be pasted in the new music folder, and so on and so on, for each media. In the first place, those files were not all put in the data/media folder right ?
So, why not try and use a file explorer, and move the content in their respective appropriate new folder, and see how it works. And that done delete the initial folders. Hope it will work.
Aur3L said:
Ok, so you have moved all your content, in the new media folder, but I read you can't read any media from that folder. I guess that it s completely normal, as I would have only put backups to be used in this precise folder. Correct me anybody if I'm wrong, but music should be pasted in the new music folder, and so on and so on, for each media. In the first place, those files were not all put in the data/media folder right ?
So, why not try and use a file explorer, and move the content in their respective appropriate new folder, and see how it works. And that done delete the initial folders. Hope it will work.
Click to expand...
Click to collapse
According to the guide to keep the pre-4.2 file structure, with no /0 folders, you're supposed to ADB push all sd card files to the /data/media folder. Now I think what I screwed up on is I was supposed to delete any /0 folders but I misread the guide and didn't delete the folder. Now all of the data I pushed to the phone is in it's respective folders under data/media, such as Music and Downloads, but there is also a /data/media/0 folder with standard android folders. There is also /sdcard, with standard android folders. From my understanding, either data/media and /sdcard or /data/media/0 and /sdcard should show the same files, but neither does. If I make a change in one directory it doesn't show in the other directory. The weird part to me is that when I copy and paste a file from /data/media/Music (or any other directory there) to /sdcard, the file permissions and owners and groups of the file will change, and then I can access the file in the /sdcard directory. But if I try to apply the exact same permissions and owner and group to the file under /data/media it will still not give me access. On Root Explorer, looking at properties of a file in /data/media, the md5sum shows Access Denied, but works on /sdcard. I'm thinking it has something to do with the /data/media folder's permissions instead of the files/folders under it, but I'm kinda afraid to mess with it. When I get home in the morning I'm gonna try dumping EVERYTHING and start again, but I would love to be able to fix it first.
Will I see any problems if I just copy all the files from /data/media to /sdcard, where I'm sure I can use them? Also, why doesn't /data/media or /data/media/0 show the same files as /sdcard?
Thanks for any help!
02ranger said:
According to the guide to keep the pre-4.2 file structure, with no /0 folders, you're supposed to ADB push all sd card files to the /data/media folder. Now I think what I screwed up on is I was supposed to delete any /0 folders but I misread the guide and didn't delete the folder. Now all of the data I pushed to the phone is in it's respective folders under data/media, such as Music and Downloads, but there is also a /data/media/0 folder with standard android folders. There is also /sdcard, with standard android folders. From my understanding, either data/media and /sdcard or /data/media/0 and /sdcard should show the same files, but neither does. If I make a change in one directory it doesn't show in the other directory. The weird part to me is that when I copy and paste a file from /data/media/Music (or any other directory there) to /sdcard, the file permissions and owners and groups of the file will change, and then I can access the file in the /sdcard directory. But if I try to apply the exact same permissions and owner and group to the file under /data/media it will still not give me access. On Root Explorer, looking at properties of a file in /data/media, the md5sum shows Access Denied, but works on /sdcard. I'm thinking it has something to do with the /data/media folder's permissions instead of the files/folders under it, but I'm kinda afraid to mess with it. When I get home in the morning I'm gonna try dumping EVERYTHING and start again, but I would love to be able to fix it first.
Will I see any problems if I just copy all the files from /data/media to /sdcard, where I'm sure I can use them? Also, why doesn't /data/media or /data/media/0 show the same files as /sdcard?
Thanks for any help!
Click to expand...
Click to collapse
Again, as I said previously move your music photos apks downloads in the sdcard structure, then erase the /0 folder, you would have found your stuff, where it's ought to be, legible by their respective programs. So move your photos /data/media to your actual /sdcard/Dcim/ folder, and so on and so forth for each content, problem should be solved. It's really simple.
Aur3L said:
Again, as I said previously move your music photos apks downloads in the sdcard structure, then erase the /0 folder, you would have found your stuff, where it's ought to be, legible by their respective programs. So move your photos /data/media to your actual /sdcard/Dcim/ folder, and so on and so forth for each content, problem should be solved. It's really simple.
Click to expand...
Click to collapse
I understand that and that is what I plan to do to get through tonight. My question is, why is this even a problem? Is there something that I could do to not have to move the files? Not out of laziness, more out of curiosity. I still plan to dump everything because with all the crap I've tried to fix the permission issues there's no telling what I may have screwed up, but until I get to start over I'm planning to just copy everything to /sdcard. Now I just would like to know why it was an issue. Why can't I access files in the /data/media folder, or any other folder on my phone for that matter, when I'm rooted and using a root explorer? I have never seen this issue before, regardless of phone or ROM. Is this due to the new 4.2 multiuser file structure, or something I did? I appreciate your help and I apologize if my intention wasn't clear from my last post, I am at work and typing in a hurry. I started the thread looking for an easy fix and you've given me that, now I'm mostly just curious as to why it happened to begin with.
Thanks again!
Edit: I just tried copying some alarms into the /sdcard/Alarms/ and they won't play either, but Music still does. I actually got a "Not Enough Free Space" message when trying to copy them, with 5+ GBs free on the sdcard and the files were only about 130kb. I'm just going to have to dump everything and just copy what I really have to have to the phone. If you have any other ideas I'm open to hear them, but I think its FUBARed at this point. Thanks though.
Well, if you use a root explorer, such as ES file, you have to move your alarms/rigtones notifications in telephone/system/media. Once put in here, you will have to correct the permissions to rw rr , and reboot your phone. As to why it happens like this, I guess it is related to the new structure, and also because you cannot play everything from everywhere in your device, some folders are system folders, and not every file is legible from that location. My guess in your situation is that you have twice the same content on your phone (hence the Not enough free space message), so just paste everything you need in the appropriate volume, and erase the one you have messed up with.
Might be a suggestion, but if you have a nandroid backup, just look at how and where your files are organised.
Now, however, if you have a hard time fixing this up, well you might as well save your stuff on your computer, flash a stock image, root it, install TWRP, your favorite Rom, transfer your files back from your computer, and you will have a fresh and probably better running phone.
Hope it will help you, and if you have an insomnia, just take that opportunity to browse your phone structure, so that you know where each file is located. Good luck with it .
That last part is what I did. I just wiped everything, reinstalled PA 2.99B6 and ADB pushed to /sdcard instead of /data/media. It all works perfectly now. I'm not 100% sure what the issue was before, but I still think it was the new file structure. If I go at a music file through /data/media it still won't play but will from /sdcard, which is the only place I put the files. I guess its just the way the new file structure for multi-user works. I appreciate your help. I think I'll keep the /0 folder too. Trying to get rid of it is part if why I did things that caused problems, and its gonna be part of the future of android so we might as well get used to it.
Thanks again!

[Q] Can someone explain to me how storage works? What is

I decided to upgrade to Lollipop after holding out for awhile.... before I did though, as I knew I was going to run an RUU so I wouldn't have any problems with the OTA, I copied everything in my "storage" (all folders) to my windows laptop desktop via USB.
After upgrading, I copied it all back, making sure not to over-write anything.
What is strange is when I copied all my folders to my laptop initially, I didn't see a Download folder... which I expected to see. But after looking through the folders I had copied, I saw a folder called storage, and in that folder another called emulated, and then another called "0". In that folder I finally saw my Download folder.
I didn't think much of this at the time, however, when I look at storage from Root Explorer, I note there is a new Download folder at the "root" level of storage, but the storage/emulated/0 path is still there as well.... and following it takes me to my old Download folder....
So...to get back my original folders and contents before I upgraded to Lollipop, I have to copy over every folder in this path up 3 levels. i.e., from /storage/emulated/0/storage/emulated to /storage/emulated.
What is going on? Why is there an "0" and a "legacy" if I go up one level from /storage/emulated/??? Why did my old Download folder end up where it did?
I had this exact same thing in my mind.
Why is there such a folder ?
My phone storage was almost full and I found out this folder is taking up whole space.
I cut the storage folder and pasted it into memory card
now all my downloads go to memory card (mmc:storage/emulated/0)
+1
I have also this folder that takes a lot of internal memory space.
I experiment one thing:
I have 1 game that takes 2Gb of data and I have moved it to sdcard memory (using Android-M feature : move app from internal to sdcard )
I saw in this directory (emulated/0/ ) the 2Gb of this game. ????? So, I tryed to copy/paste this data to sdcard, in order to free internal memory space. But I loose the game's configuration.
I was thinking that moving app from internal to scard, the data of the app also move, isn't it ?
I need help to understand that ...
Nang06

advanced question - internal and external file transfers

I have a rooted 5x nougat with twrp recovery and stock rom. When I attempt to copy my TWRP backup to my computer via MTP file transfer, I cannot. Same with my titanium backup folder. I also tried to move my TWRP backup to my DCIM folder such that I could try PTP file transfer but that didn't work either.
Indeed, i cannot even transfer files within my own phone's file directory. I'm using root Explorer. I've toggled and made the file system read-write. I tried to change file folder permissions, and that failed.
Any advice Xda family? I have the proper drives installed.
Apologies in advance if my verbiage isn't accurate technically. I'm pretty good with android but by no means an expert.
Mario
File Transfers
I'm not really sure as to why you'd have problems moving files within your phones internal storage, however I do have a solution (work around, really) to your MTP problem, as long as you have ADB working.
I also never got MTP working so I just use a file manager to check the path to the folder I want from my phone to my computer, and then use the command:
Code:
adb pull /path/to/folder/on/phone /path/to/destination/on/computer
And if I want to put something from my computer on my phone, I do the opposite command:
Code:
adb push /path/to/file/on/computer /path/to/destination/on/phone
Additionally, if you really need to move files around on your phone, you can use:
Code:
adb shell
su
mv /path/to/file /path/to/destination
Hope that helps!
Thanks. It does help and I have adb. I'll try that method. I'm not sure why I'm having that issue either.

Categories

Resources