• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

[Verizon] 4.2 /sdcard and /sdcard/0 Observation

NSutherl

Android Enthusiast
Sep 6, 2011
364
150
Los Angeles
After flashing Jelly Belly v10.0, I was getting annoyed knowing that there were 2 different storage locations (/sdcard and /sdcard/0), so I looked into it and here's what I found:

I had 2 different directories under /sdcard. Inside /sdcard, I had the normal folders that Android and apps create (like Alarms, data, DCIM, etc...) as well as a folder named 0. Inside this /sdcard/0 folder, I had all of the folders I had pre 4.2 Jelly Bean, including the standard Android folders and all the folders I had created (folders I created to organize the ROMs, kernels, etc that I have on my sd card).

So it seems like when you flash your first 4.2 ROM, it creates a backup of your /sdcard directory under this /sdcard/0 folder. From then on, /sdcard becomes the default directory where Android functions.

Oddly enough, I found 3 virtual symlinks that had the same file structure. These locations were:

/storage/emulated/0 and /storage/emulated/0/0 (new and "backup" locations, respectively)
/storage/emulated/legacy and /storage/emulated/legacy/0 (new and "backup" locations, respectively)
/storage/sdcard0 and /storage/sdcard0/0 (new and "backup" locations, respectively)

In al, there were 4 locations that had the exact same data. I merged all of the /sdcard/0 "backup" folders to /sdcard so everything was in 1 location. Hope this helps someone and please share your own insights.
 
The file system is weird, especially with clockwork. The folder it looks for for backup/restores of nandroids is data/media/clockworkmod. Why is it looking there and not on the sd card? Then there's 4 locations of the same location (if that makes since), legacy folders, aaaaaaaaaaaah! Anyone got a explanation for why its done that way? Is it a 4.2 thing, or just jelly belly?
 
Upvote 0
After flashing Jelly Belly v10.0, I was getting annoyed knowing that there were 2 different storage locations (/sdcard and /sdcard/0), so I looked into it and here's what I found:

I had 2 different directories under /sdcard. Inside /sdcard, I had the normal folders that Android and apps create (like Alarms, data, DCIM, etc...) as well as a folder named 0. Inside this /sdcard/0 folder, I had all of the folders I had pre 4.2 Jelly Bean, including the standard Android folders and all the folders I had created (folders I created to organize the ROMs, kernels, etc that I have on my sd card).

So it seems like when you flash your first 4.2 ROM, it creates a backup of your /sdcard directory under this /sdcard/0 folder. From then on, /sdcard becomes the default directory where Android functions.

Oddly enough, I found 3 virtual symlinks that had the same file structure. These locations were:

/storage/emulated/0 and /storage/emulated/0/0 (new and "backup" locations, respectively)
/storage/emulated/legacy and /storage/emulated/legacy/0 (new and "backup" locations, respectively)
/storage/sdcard0 and /storage/sdcard0/0 (new and "backup" locations, respectively)

In al, there were 4 locations that had the exact same data. I merged all of the /sdcard/0 "backup" folders to /sdcard so everything was in 1 location. Hope this helps someone and please share your own insights.

This was annoying me as well and i did the same thing you did. I like everything in one place. Glad you made a post about this before i did
 
Upvote 0
The file system is weird, especially with clockwork. The folder it looks for for backup/restores of nandroids is data/media/clockworkmod. Why is it looking there and not on the sd card? Then there's 4 locations of the same location (if that makes since), legacy folders, aaaaaaaaaaaah! Anyone got a explanation for why its done that way? Is it a 4.2 thing, or just jelly belly?


I've been watching the sdcard and file system changes since 2.1 and the /data/media is how almost all Linux distros mount external storage. Since Android is based on Linux, this is where the sdcard is ACTUALLY mounted. All the other locations you find are symlinks.
 
  • Like
Reactions: NSutherl
Upvote 0
I've been watching the sdcard and file system changes since 2.1 and the /data/media is how almost all Linux distros mount external storage. Since Android is based on Linux, this is where the sdcard is ACTUALLY mounted. All the other locations you find are symlinks.

This makes sense now that I think about it. When doing a factory reset in TWRP, I've noticed that the script says "wiping data without wiping data/media", which would be the sd card location. Thanks for the tip!
 
Upvote 0
If you didn't see this, it may help to explain this for some readers:

Quoted from Androidspin.com -

"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.

In TWRP 2.3.2.0 we have corrected this problem by ensuring that we do not delete the special file during a factory reset. However, if ended up having your files upgraded you will need to move or merge them back into /sdcard. Also, if you have moved your TWRP folder from /data/media/0 to /data/media so that you could restore backups while using prior TWRP versions, you may now need to move the TWRP folder back into /data/media/0.

As a special note, if you restore a backup to a prior version of Android, you may have to move your files out of /data/media/0 and into /data/media to be able to see them again."

:)
 
  • Like
Reactions: AnotherFatalEpic
Upvote 0
I have the same problem. I was using CyanogenMod 10 and I flashed 10.1. Now I have nested directories. (sdcard/0/0)
I can't add a google account on my phone now. Also I can't access those directories with my PC. This is highly annoying. I have bunch of copies of my system and I can't delete them. I backed up before I flashed CM 10.1 but now I can't restore because restore is looking for a different directory.

Is there anybody that can help me with this?
 
Upvote 0
I have the same problem. I was using CyanogenMod 10 and I flashed 10.1. Now I have nested directories. (sdcard/0/0)
I can't add a google account on my phone now. Also I can't access those directories with my PC. This is highly annoying. I have bunch of copies of my system and I can't delete them. I backed up before I flashed CM 10.1 but now I can't restore because restore is looking for a different directory.

Is there anybody that can help me with this?

I had the same kind of issue. What I always do is make sure my base ROM.zip is always in my SDcard Root. And the usual SDcard backup on the PC.

I do a FULL wipe including format/system and reflash the base 4.1.x ROM. Go to Gplay and load Root Explorer.

Find the Clockworkmod folders, both of them.
In the 0/ colckworkmod folder I multi-select all the subfolders and files and do a "move" to the other non-0/ clockworkmod folder.
Then I do GPlay and load ROM manager. There I do a restore and my nandroids are there and BAM!

As for moving the CWM sub folders and files, don't do a copy, it takes a while and is prone to corruption being so large, as the move just renames the location and BAM!
 
  • Like
Reactions: elfaure and hku987
Upvote 0
Here is the question though. I can't locate any of those subfolders on my PC when the phone is plugged in. I have Galaxy S3 and it doesn't look like a drive. I get into "Internal Storage" and it shows the latest "sccard" version. I can't get into sdcard/0 or sdcard/0/0.

I can see them in my CWM recovery, but I can't see them on the PC.

Messed part is that now google play doesn't work. When I go to Accounts, there is no option for adding google account. lol . this is pissing me off

How do you access to the entire internal storage when plugged in to the PC?
 
Upvote 0
I had the same kind of issue. What I always do is make sure my base ROM.zip is always in my SDcard Root. And the usual SDcard backup on the PC.

I do a FULL wipe including format/system and reflash the base 4.1.x ROM. Go to Gplay and load Root Explorer.

Find the Clockworkmod folders, both of them.
In the 0/ colckworkmod folder I multi-select all the subfolders and files and do a "move" to the other non-0/ clockworkmod folder.
Then I do GPlay and load ROM manager. There I do a restore and my nandroids are there and BAM!

As for moving the CWM sub folders and files, don't do a copy, it takes a while and is prone to corruption being so large, as the move just renames the location and BAM!

I put a link to this thread on XDA. Gapi the BAM man has the plan#! Thanks.

http://forum.xda-developers.com/showthread.php?p=40911246#post40911246
 
Upvote 0
Maybe this is old news to you guys but 4.2.1 just came out for my device. When I was doing some research on it I found this thread, which was helpful to me. Maybe what I'm working on now won't help you directly but it will help others.

If someone on 4.2 could run this code and post the results, either here or on XDA, that would help me to help others. I'm still on 4.1 and have to near future plans for 4.2 so I can't do it on my device.

Code:
su
cd /
find */0

Thks.
 
Upvote 0
How did that happen? Are you looking from the device or your PC? What file manager are you using? Have you checked it from the terminal?

Code:
cd /data
ls -al

And post the output

Well now im back on my nandroid and probably wont try again until the weekend, but i tried three different file managers and couldn't find it. I think im also going to try flashing earlier versions of the aokp mr-1 roms to see if it moves the files automatically, or even try like cm-10.1 and see if that moves them correctly.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones