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

Discussion in 'Android Devices' started by NSutherl, Nov 18, 2012.

  1. NSutherl

    NSutherl Well-Known Member
    68

    Sep 6, 2011
    364
    150
    68
    HVAC Design Engineer
    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.
     

    Advertisement
    jbdan, hku987 and Sorzen Acranos like this.
  2. Dmeeks90

    Dmeeks90 Well-Known Member
    36

    Jun 1, 2012
    159
    9
    36
    Male
    AAP
    bartow fl
    How do you like the rom?
     
  3. NSutherl

    NSutherl Well-Known Member
    68

    Sep 6, 2011
    364
    150
    68
    HVAC Design Engineer
    Los Angeles
    It's a good mostly stock ROM. It's moderately stable for me since jakeday incorporated 4.2, but before that it was stable as they come. I imagine it will get more and more stable with each release as he works out the bugs. See here for more info.
     
  4. Danielson2047

    Danielson2047 Well-Known Member
    43

    Jan 10, 2010
    370
    34
    43
    Portage, WI
    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?
     
  5. NSutherl

    NSutherl Well-Known Member
    68

    Sep 6, 2011
    364
    150
    68
    HVAC Design Engineer
    Los Angeles
    It seems to be the general consensus that it has to do with jelly bean's ability to support multiple user profiles.
     
  6. Danielson2047

    Danielson2047 Well-Known Member
    43

    Jan 10, 2010
    370
    34
    43
    Portage, WI
    So maybe the backup for user 1 is numbered "0" then "1" "2" and so on?
     
    NSutherl likes this.
  7. Sorzen Acranos

    16

    Jul 25, 2012
    16
    5
    16
    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
     
    Fuzzy13 and NSutherl like this.
  8. NSutherl

    NSutherl Well-Known Member
    68

    Sep 6, 2011
    364
    150
    68
    HVAC Design Engineer
    Los Angeles
    I think this is correct.
     
  9. AndroidKris

    AndroidKris Well-Known Member
    53

    Dec 20, 2010
    385
    75
    53

    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.
     
    NSutherl likes this.
  10. NSutherl

    NSutherl Well-Known Member
    68

    Sep 6, 2011
    364
    150
    68
    HVAC Design Engineer
    Los Angeles
    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!
     
  11. The_Chief

    The_Chief Accept no imitations!
    Moderator
    1,933

    Nov 17, 2009
    12,511
    12,165
    1,933
    Male
    I'm retired: every day's a Monday :P
    Manchester, TN
    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."

    :)
     
    AnotherFatalEpic likes this.
  12. gapi

    gapi VIP Member
    VIP Member
    223

    May 14, 2011
    1,589
    945
    223
    Professional Investigator, I am licensed under thr
    N GA
    At first I cringed at a multi-user feature at all. Then a co-worker really needed to borrow a phone and it hit me.
    With all the personal & private data I have on my phone I get really jumpy when I let someone make a call.
    Now I am thinking of a Guest Type account to slap it into so that will allow calls only, no file browsing eh?
     
    TMFGO45 likes this.
  13. hku987

    hku987 New Member
    5

    Aug 28, 2012
    2
    0
    5
    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?
     
  14. gapi

    gapi VIP Member
    VIP Member
    223

    May 14, 2011
    1,589
    945
    223
    Professional Investigator, I am licensed under thr
    N GA
    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!
     
    elfaure and hku987 like this.
  15. hku987

    hku987 New Member
    5

    Aug 28, 2012
    2
    0
    5
    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?
     
  16. gapi

    gapi VIP Member
    VIP Member
    223

    May 14, 2011
    1,589
    945
    223
    Professional Investigator, I am licensed under thr
    N GA
    Hm? SIII? This is a Nexus thread. But I have seen this. The onlyway I seen to see them on a PC was to use a Tool Kit to backup the SDcard to the PC and then all are revealed and can be tweaked and then copied back to the phone. But I dunno about a SIII
     
  17. elfaure

    elfaure Member
    18

    Jul 18, 2011
    14
    11
    18
    Mech Engr, Robotics and Automation
    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
     
  18. teddyearp

    teddyearp Well-Known Member
    223

    May 19, 2010
    2,406
    831
    223
    Store Manager
    Pinetop, AZ
  19. elfaure

    elfaure Member
    18

    Jul 18, 2011
    14
    11
    18
    Mech Engr, Robotics and Automation
    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 (Text):
    1.  
    2. su
    3. cd /
    4. find */0
    5.  
    Thks.
     
  20. Hipe0ples555

    Hipe0ples555 Well-Known Member
    28

    Dec 20, 2011
    53
    13
    28
    Ok, well I have looked all over my files and everything is still gone, sdcard and sdcard/0 are still empty along with all the emulators and everything, any help on where it could be?
     
  21. tdevaughn

    tdevaughn Well-Known Member
    163

    Jan 3, 2011
    1,007
    395
    163
    Statesville NC
    Look in data/media and data/media/0
     
  22. Hipe0ples555

    Hipe0ples555 Well-Known Member
    28

    Dec 20, 2011
    53
    13
    28
    I couldnt even find folders in data, never mind any files
     
  23. elfaure

    elfaure Member
    18

    Jul 18, 2011
    14
    11
    18
    Mech Engr, Robotics and Automation
    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 (Text):
    1.  
    2. cd /data
    3. ls -al
    4.  
    And post the output
     
  24. Hipe0ples555

    Hipe0ples555 Well-Known Member
    28

    Dec 20, 2011
    53
    13
    28
    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.
     
  25. teddyearp

    teddyearp Well-Known Member
    223

    May 19, 2010
    2,406
    831
    223
    Store Manager
    Pinetop, AZ
    Make sure you are using the latest version of your favorite custom recovery before flashing a 4.2.x rom.

    good luck
     
Tags:

Share This Page

Loading...