Saturday, October 4, 2014

sd card - Why did /sdcard/ turn into /sdcard/0/ with 4.2?


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?




Answer



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.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...