Trouble installing stock ROM due to multiple '0' folders !HELP! I am having a lot of trouble restoring my GSM Galaxy Nexus to it's former glory. I installed CM12 and CWM recovery earlier but CM12 suddenly stopped working. My phone started rebooting over and over so I decided it was to time to flash the stock ROM.

I flashed the stock ROM with WugFresh's root toolkit. And it worked fine besides the fact that writing the system.img took 30 mins, which is very unusual. I rebooted my device and CM12 showed up again... ?!. I tried flashing it by hand with ADB but no luck either. CM12 was still there.

I've been busy 3 days now and suddenly realized that CM12 created new root folders after a factory reset which I did multiple times. So for example, my sdcard contains one root with a folder, named 0, that contains the files on my phone before the factory reset. The problem is that this folders contains the system and CM12 ROM too. So I have like four 0 folders, and the 'deepest' one contains the system and ROM.

Assuming that if you flash a stock ROM, it will install in the root of my SD-card, but doesn't boot because it didn't overwrite the CM12 ROM in the deepest '0' directory [​IMG]. If only CM12 was working, I could manualy delete all the unnecessary 0 folders... I really have no idea how to continue from now on and I really need your help [​IMG]

Edit: I tried: adb shell rm -r /sdcard/0 and it is gone but if I reboot Recovery and look into my folders everything is there again...

epilogue:


Maybe the fact that system.img took 30 minutes to write has something to do with all those 0 folders [​IMG]
I tried flashing multiple recovery's to my device but they only show up if I open them via ADB. Otherwise CWMR shows up again because that one is actually installed in the 'correct' (read:incorrect) folder.
With Skipsoft roolkit I actually received an error while writing userdata.img. It said: remote: write fail. I thought this was due the multiple installation folders and the toolkit not knowing where to place/flash the ROM.


So I need to remove all the 0 folders and place the OS back in the sdcard's root, or I have to somehow tell android to place the stock ROM in the same directory as CM12, or I need to somehow wipe the complete sdcard so I can install a new recovery and flash the stock ROM... I have no idea how however.

Thanks in advance!
From what you describe, the most likely cause is that your flash storage no longer applies any writes – be it additions or deletions. For understanding, a simply description of what happens:


You send a file to the storage (copy/flash).
to be most responsive, the OS uses "buffers" in RAM to cache your storage, so that's where the file goes first.
You check if the file arrived, and the OS says it did (but in fact, it just saw it in the "buffer pending to be written")
Now the OS tries to "flush" the buffers (write them to "disk"), but fails
As long as the buffer "lives", you won't notice. But as soon as you write more than the buffer can hold, the oldest entries disappear. On boot, the entire buffer disappears.


So in the end, that was the reason why CM "suddenly stopped working": the storage got unusable. And this is also the reason why your device booted up into CM after you thought you've flashed another ROM: the flash was never performed.

I had this twice with SD cards, a replacement was in order then. Unfortunately, internal storage is soldered in into your device, so you cannot simply replace it: you'd have to send-in the device to have its board replaced. Unless the device is still in warranty (which I very much doubt if we speak about the 2011 "Galaxy Nexus", code-named "Maguro" here), it's probably not worth the postage costs, but you'll rather have to get yourself a replacement device – which might even be cheaper than the repair.