Confusing internal memory folder structure - Galaxy S3 (I9300) I am using Samsung Galaxy S3 (I9300) for a while now. I have rooted the device, removed the stock ROM and replaced it with CM11. Of late, I have been having Camera FCs, poor battery back up and slow down in apps (I though it was due to low availability of internal memory - 1 GB out of 11.5 GB). I tried clearing several folders from internal memory. Since the results weren't satisfactory, I decided to re-install the OS by doing a factory reset.

Now that I have done it, to my surprise, the internal memory was still not completely cleared. Android was still reporting as 4.5 GB available, out of 11.5 GB. When digging little deeper, I found that it was due to my old user data folders still residing on the phone. They were available under \emulated\0 and also \emulated\legacy. I initially assumed it would be present in my external SD card and \emulated\0 possibly could be just a symlink to it. To clear up the doubt, I removed the SD card from the phone and rebooted it. But, I still see the files in \emulated\0. I again tried to do a Factory Reset, but nothing has changed.

Though, I can just delete the \emulated\legacy folder and go about installing a different ROM. I am trying to understand what actually has happened (how to correctly fix it) and if it could happen again, or if it could be something due to me fiddling around with any OS level settings. Any explanation as to why/how the duplicate files are created and how to fix it for good, will be much appreciated.
The folders you are referring to are for multi-user purposes: /emulated/legacy is a symlink pointing to the internal SD folder of the "current user", while /emulated/0 is that folder for the owner (the number at the end will be incremented for additional users created thereafter, so e.g. if you created an additional user, his place would be /emulated/1, and logged in with that user /emulated/legacy would point there).

There are sometimes issues when updating from older Android versions, where content gets duplicated from the old single-user place to /emulated/0 during the conversion process (i.e. the content is copied to the new location instead of being moved, and not deleted afterwards). As a factory-reset usually doesn't touch "user storage" (external/internal SD cards), it offers no relief to that, so you'll have to clean that up manually afterwards (if it happens).

As to your question in your comment: If this happens, it does so only when converting from "single user" to "multi-user". So your next upgrade would already start with a "multi-user ROM", which means the same issue will not happen again (as no conversion is required in this context).