Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I've never seen this before so I'm assuming that it happened when I upgraded to 4.2: I'm fairly certain that /sdcard/ used to take me straight to my sdcard, but now when I go to that path (in CWM recovery for example) I need to go to /sdcard/0, there's also /sdcard/legacy knocking about suddenly.

What are these folders and why have they appeared?

share|improve this question

2 Answers 2

up vote 18 down vote accepted

That has to do with the Multi-User feature enabled with JellyBean 4.2 (not 4.1). In order to handle separate accounts, parts of the directory structure had to be changed. /sdcard/legacy e.g. always points to the currently logged-in user's sd card directory.

I currently cannot find the document where I read the details, so I cannot link any source. But with the above in mind, it's easy to guess that /sdcard/0 will most-likely be the device owners (or "first users" -- the "first user" always becomed the "device owner", only this user can create additional accounts) sd card, and so on. I will add a link to a source as soon as I can find it.

EDIT: One of the pages I got that idea from is AndroidNext. 1droid gives a different explanation when it comes to sd card:

With Android 4.2, Google introduced multiple users as a new feature. In order to accommodate multiple users, Google is now giving each user a their own folder for storage. If you upgraded to 4.2 from 4.1, then the 4.2 ROM will look for a certain file in /data to determine whether it needs to migrate all of your files to the new multi-user data structure. By default, 4.2 migrates all of /data/media to /data/media/0.

A problem arose though with custom recoveries. A custom recovery retains the /data/media folder during a factory reset. When you factory reset and then boot a 4.2 ROM again, the 4.2 ROM will migrate everything in /data/media again. It will migrate your files every time you factory reset. This multiple migration is what resulted in some people having their files moved to /sdcard/0 or even /sdcard/0/0 etc.

So it has in fact to do with the new Multi-User feature -- one way or the other.

share|improve this answer
    
You are a gentleman and a scholar, great answer. Your theory about 0 being the first user also makes sense since I only have one user, and /sdcard/0 is the only "number directory" that exists. –  bigbadonk420 Dec 17 '12 at 11:01
    
Also relevant to this is Dan Morrill's explanation of why Android moved from USB Mass Storage to MTP access for the internal storage, which touches on the "fake" /sdcard/ fodler issue androidpolice.com/2011/11/18/… –  GAThrawn Feb 13 '13 at 14:52
    
Though I strongly disagree with him on the "file picker" question (I already bookmarked that article a while ago). We're not at Cupertino here, nor we Gnomish. We don't have to hide things, and tell the user what he really wants (though he "might not know yet"). I prefer the options, whatever defaults are set. Make it a general switch in the config: "Yes, I'm a mature user" / "No, I rather like other people deciding for me"... Apart from that: Good point :) –  Izzy Feb 13 '13 at 15:27

Take a look at Android External Storage Technical Information for an explanation and configuration examples: http://source.android.com/devices/tech/storage/index.html

share|improve this answer
4  
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference (please edit your question and do so). –  bmdixon Sep 9 at 7:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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