teddyearp
Android Expert
So, though this sticky is a bit behind the times, I did first start noticing problems with Jelly Bean 4.2.x as I polled and pointed out here:
Is a full 4.2 ROM really worth the trouble?
While still called "Jelly Bean" the update from Android 4.1.2 to 4.2.x changes the file structure of the 'virtual' sdcard on our Galaxy Nexus devices. Actually it changes it for every device, but I only will cover the GNex here. What has changed is that the ability to add user accounts, similar to any regular computer, has been implemented. However, if the proper steps are not taken before you crack flash a few new 4.2.x Roms, you will end up with a huge mess and run out of room on your device in a hurry.
Moving on, the actual location when viewed with a root file manager like SUFBS or ES Explorer (or others of your choice) of your 'virtual' sdcard has been here on 4.1.x:
/data/media
And though you will see the same files in /sdcard and /storage/sdcard0, those are just symlinks to the same info, just like a shortcut (on a windows box) or alias (on a mac box). Once you flash a 4.2.x ROM, the actual location gets changed (and all the files moved) to here:
/data/media/0
And the symlinks get changed to /sdcard/0 and /storage/sdcard0/0. On the surface, no big deal, right? Wrong. The problems arise if the version of your custom recovery is not compatible with a 4.2.x ROM. If it is not and you keep crack flashing 4.2.x ROMs you might soon end up in trouble. If, while using the 'older' custom recovery, you continue crack flashing, your 'virtual' sdcard ends up somewhere around here:
/data/media/0/0/0/0/0/0 (etc.) with all your files copied to every '0' directory and your symlinks end up the same way, and your device quickly runs out of space (the dreaded "your device is low on storage" message).
You get my drift, I hope. This may also make it very difficult to restore your nandroid of a 4.1.x ROM as well. If you are already in that situation, not to worry, the solution for that is later in this post.
But first, you ask: "How do I avoid this mess in the first place?"
Answer: Make sure you first have the proper version of a custom recovery compatible with an Android 4.2.x ROM installed on your device. If you have CWM 6.0.1.x or TWRP 2.3.x.x you must update your custom recovery before flashing a 4.2.x ROM. At the very least, CWM 6.0.2.3 or TWRP 2.4.x.x are required before you flash a 4.2.x ROM, therefore you will not end up with the 'nested /0/0/0/0' directories if you continue to crack flash.
Though there are several ways to flash the latest custom recovery to your phone, I have found that Scary Alien's "Android Root Toolkit" available for free in the Play store is a pretty good tool to check your current recovery version and then flash the ones I have mentioned.
Now, "What do I do if I have all these nested '0' directories?" First off, go ahead and flash the compatible custom recovery as mentioned above, then find a way to copy (just in case) all the files found in the last /data/media/0/0/0/0 (?) folder to your computer. Then using a file manager that will show hidden files and folders, copy/move the files in the last '0' directory to:
/data/media/0
And then use your file explorer to delete all the other '0' directories until you have just this one:
/data/media/0
leaving nothing else in the symlinks but /sdcard/0 and /storage/sdcard0/0. A reboot of your device is essential at this point.
Additional info and disclaimer:
As in the very first thread I linked in this post, I have yet to go from an Android 4.1.2 ROM to an Android 4.2.x ROM for fear of this situation. Call me chicken poop. So I have compiled the information in this post from several sources, both from the posts I will link below as "References" and a couple of PM's from tdevaughn; so far the feedback I have received is that I am correct. I have flashed the latest recoveries that I mentioned, just in case. Also, iowabowtech has some really great adb commands to also help troubleshoot some of the 'nested /0/0/0 directory' problems I mentioned here. I give him full editing rights to add/insert them where or if he sees fit.
----->Gray area:
If after flashing a 4.2.x ROM you decide you don't like it and want to restore your nandroid to your saved 4.1.2 ROM, how does that work out? Obviously I haven't done it, maybe someone else has and will chime in. tdevaughn said he did and found no problem with the fact that 4.1.2 points your sdcard to /data/media and mentioned symlinks and 4.2.x points your sdcard to /data/media/0; I kind of find that hard to believe.
So because of that I will leave this sticky open for addtional info, but useless posts will be reported and deleted.
------------------
References:
NEED serious help. cm10.1 bricked
Can't reach root of SD card because of file structure.
0 directory on sdcard question
HELP! Verizon GNex stuck in Recovery
[How To] Manually fix SD card issues when switching from 4.1.x to 4.2.x.
VZW Galaxy Nexus stuck on 4.2.1
Is a full 4.2 ROM really worth the trouble?
While still called "Jelly Bean" the update from Android 4.1.2 to 4.2.x changes the file structure of the 'virtual' sdcard on our Galaxy Nexus devices. Actually it changes it for every device, but I only will cover the GNex here. What has changed is that the ability to add user accounts, similar to any regular computer, has been implemented. However, if the proper steps are not taken before you crack flash a few new 4.2.x Roms, you will end up with a huge mess and run out of room on your device in a hurry.
Moving on, the actual location when viewed with a root file manager like SUFBS or ES Explorer (or others of your choice) of your 'virtual' sdcard has been here on 4.1.x:
/data/media
And though you will see the same files in /sdcard and /storage/sdcard0, those are just symlinks to the same info, just like a shortcut (on a windows box) or alias (on a mac box). Once you flash a 4.2.x ROM, the actual location gets changed (and all the files moved) to here:
/data/media/0
And the symlinks get changed to /sdcard/0 and /storage/sdcard0/0. On the surface, no big deal, right? Wrong. The problems arise if the version of your custom recovery is not compatible with a 4.2.x ROM. If it is not and you keep crack flashing 4.2.x ROMs you might soon end up in trouble. If, while using the 'older' custom recovery, you continue crack flashing, your 'virtual' sdcard ends up somewhere around here:
/data/media/0/0/0/0/0/0 (etc.) with all your files copied to every '0' directory and your symlinks end up the same way, and your device quickly runs out of space (the dreaded "your device is low on storage" message).
You get my drift, I hope. This may also make it very difficult to restore your nandroid of a 4.1.x ROM as well. If you are already in that situation, not to worry, the solution for that is later in this post.
But first, you ask: "How do I avoid this mess in the first place?"
Answer: Make sure you first have the proper version of a custom recovery compatible with an Android 4.2.x ROM installed on your device. If you have CWM 6.0.1.x or TWRP 2.3.x.x you must update your custom recovery before flashing a 4.2.x ROM. At the very least, CWM 6.0.2.3 or TWRP 2.4.x.x are required before you flash a 4.2.x ROM, therefore you will not end up with the 'nested /0/0/0/0' directories if you continue to crack flash.
Though there are several ways to flash the latest custom recovery to your phone, I have found that Scary Alien's "Android Root Toolkit" available for free in the Play store is a pretty good tool to check your current recovery version and then flash the ones I have mentioned.
Now, "What do I do if I have all these nested '0' directories?" First off, go ahead and flash the compatible custom recovery as mentioned above, then find a way to copy (just in case) all the files found in the last /data/media/0/0/0/0 (?) folder to your computer. Then using a file manager that will show hidden files and folders, copy/move the files in the last '0' directory to:
/data/media/0
And then use your file explorer to delete all the other '0' directories until you have just this one:
/data/media/0
leaving nothing else in the symlinks but /sdcard/0 and /storage/sdcard0/0. A reboot of your device is essential at this point.
Additional info and disclaimer:
As in the very first thread I linked in this post, I have yet to go from an Android 4.1.2 ROM to an Android 4.2.x ROM for fear of this situation. Call me chicken poop. So I have compiled the information in this post from several sources, both from the posts I will link below as "References" and a couple of PM's from tdevaughn; so far the feedback I have received is that I am correct. I have flashed the latest recoveries that I mentioned, just in case. Also, iowabowtech has some really great adb commands to also help troubleshoot some of the 'nested /0/0/0 directory' problems I mentioned here. I give him full editing rights to add/insert them where or if he sees fit.
----->Gray area:
If after flashing a 4.2.x ROM you decide you don't like it and want to restore your nandroid to your saved 4.1.2 ROM, how does that work out? Obviously I haven't done it, maybe someone else has and will chime in. tdevaughn said he did and found no problem with the fact that 4.1.2 points your sdcard to /data/media and mentioned symlinks and 4.2.x points your sdcard to /data/media/0; I kind of find that hard to believe.
So because of that I will leave this sticky open for addtional info, but useless posts will be reported and deleted.
------------------
References:
NEED serious help. cm10.1 bricked
Can't reach root of SD card because of file structure.
0 directory on sdcard question
HELP! Verizon GNex stuck in Recovery
[How To] Manually fix SD card issues when switching from 4.1.x to 4.2.x.
VZW Galaxy Nexus stuck on 4.2.1