Android: Can someone explain to me its folder structures?

lopri

Elite Member
Jul 27, 2002
13,211
596
126
The whole root, system partition, sdcard thing confuse me. As you will see I am a total noob in this area so please bear with me and hopefully someone will educate me.

I have heard some people talking about moving their applications to sdcard to save space in the system partition (is that the correct term?). I do not know what that means so I decided to see for myself, and gained root access in my Nexus 7. Browsing the folder structure, I am completely lost because I have no idea which is which. I tried to draw what I am trying to learn about;

RI2lf.png


1. /sdcard/ (along with /root/ directory and other system-level directory)
2. /storage/emulated/0/
3. /storage/emulated/legacy/
4. /storage/sdcard0/

Prior to root access, I believe I was looking at #2, which would be /storage/emulated/0/. That's where I saw some application folders as well as data folders. Upon gaining root access, however, I found three more folders that seem to contain identical contents.. I suppose they are not duplicates (four copies of everything?), but I am terribly confused.

My questions (for now):

- What are these 4 for? And which one is "real" in a physical sense? (does it even make sense to refer it as "real" instead of "shortcuts" or "aliases"?)
- Which one is the system partition, or ROM? Are they referring to the same thing?
- Which one is "external storage"? Do "external storage" and "sdcard" mean the same thing? And which is "internal storage"?
- When people talk about moving stuff to sdcard (e.g. "app to sdcard"), which one is the starting point and which one is the end point?

Obviously appreciated.
 
Last edited:

lxskllr

No Lifer
Nov 30, 2004
57,478
7,681
126
That's different from my current, and previous tablets. Both of mine have /mnt/sdcard and /mnt/extsd

/mnt/sdcard is builtin(extra) storage, and /mnt/extsd is a removable sdcard. I'd guess /sdcard is the proper place, but I don't know for sure.

Edit:
BTW, if you want to manipulate files on the device itself, GhostCommander will let you manipulate files as root as long as you have root access. It gives a nice dual pane commander-like interface

http://f-droid.org/repository/browse/?fdid=com.ghostsq.commander&fdpage=7

^^^That's the main repository I use for apps. It's sparse compared to Play store, but it's all libre apps that have source code available. Most are completely clean, but three's a couple that have hindrances. They either track, or have ads. Those are very few, and clearly marked though. I guess someone just has to rip out the offending bits.
 
Last edited:

lopri

Elite Member
Jul 27, 2002
13,211
596
126
I have a Nexus 7, and it doesn't have any slots for external/removable sd cards. Yet people refer certain part as "internal storage" (system partition, or ROM?) and "external storage" (which was another confusion that I understood quickly)
 
Last edited:

lxskllr

No Lifer
Nov 30, 2004
57,478
7,681
126
I have a Nexus 7, and it doesn't have any slots for external/removable sd cards. Yet people refer certain part as "internal storage" (system partition, or ROM?) and "external storage" (which was another confusion that I understood quickly)

My "internal" storage is /data/app
 

postmortemIA

Diamond Member
Jul 11, 2006
7,721
40
91
I have a Nexus 7, and it doesn't have any slots for external/removable sd cards. Yet people refer certain part as "internal storage" (system partition, or ROM?) and "external storage" (which was another confusion that I understood quickly)
there's separate partition where apps are installed by default, and that is never on external card but on the internal.
 

lopri

Elite Member
Jul 27, 2002
13,211
596
126
Thank you for the suggestion but I do have a file/folder manager. I am not trying to manipulate files (yet), but rather trying to understand what I see.. Right now I don't even understand what exactly /sdcard/ means. (internal? external? emulated?)
 

lopri

Elite Member
Jul 27, 2002
13,211
596
126
there's separate partition where apps are installed by default, and that is never on external card but on the internal.

Which one would it be, among the 4 I found? Is it #1? (system partition) Where is the line drawn? And why "emulated"?

The thing is, I see exact same contents in all 4 folders I listed. (I could be wrong since I did not check one by one, but they looked the same to me)
 

lxskllr

No Lifer
Nov 30, 2004
57,478
7,681
126
I spoke wrong earlier. My root apps(ROM) are in /system/app, and downloaded apps are in /data/app

I still don't know about the rest of your setup :^D
 

lopri

Elite Member
Jul 27, 2002
13,211
596
126
OK I took screenshots. Big pictures below.

This is as deep as I can go with root privilege. Note /sdcard/ and /storage/ are here together, as well as /system/. (is /sdcard/ system partition, and /storage/ external storage?)

wSWvm.png


And from here, when I go to /sdcard/, I see this (which is #1 in my origianl thread. Check the top tree).

#1 [/sdcard/]
5zvrg.png


If I go to /storage/ from the first screen, I see this.

6fLuF.png


Then

#2 [/storage/emulated/0/]:
h1Zhr.png

#3 [/storage/emulated/legacy/]:
QsHiP.png

#4 [/storage/sdcard0/]:
ZMRyN.png
 
Last edited:

lxskllr

No Lifer
Nov 30, 2004
57,478
7,681
126
I dunno man. Android is a different beast than GNU/Linux. I was starting to get into it early this year, but broke my tablet, so I quit playing with it. I never got to understanding how it all goes together. I'm wondering how much it varies per manufacturer, because my setup isn't like that.

If you don't get any love here, you may want to read some Android specific forums. If you go that route, take some time to learn before you ask questions. There's a lot of noobs with Android devices, and they get in the forums and ask questions that were answered on the same page they were asking on. It's easy to burn out the people with knowledge when they get asked the same questions over and over. I knew almost nothing, and I was getting burned out repeating what little I did know. You should be able to find some good stuff here...

https://www.xda-developers.com/
 

vshah

Lifer
Sep 20, 2003
19,003
24
81
all the weird /emulated/0 stuff is a result of the new multi user profiles in 4.2.
you'll see what appear to be the same files in several different places. i think it's using a lot of symlinks or something, and it swaps them out when you swap user profiles.

of course, the multi user profiles aren't enabled on the Nexus 4, only the Nexus 10. so us N4 users just get stuck with the weird folder structure.
 

lopri

Elite Member
Jul 27, 2002
13,211
596
126
vshah, could you enlighten me as to the following?

- When people talk about "internal storage" and "external storage" (think of an app like app2SD), which folder is "internal storage" and which folder is "external storage" in Jelly Bean? Of course we're not talking about removable disks or SD slots.

- Is it correct to view that some of these folders are indeed partitions on the volume? In other words, unlike alphabets in Windows (e.g. C: drive, E: drive, etc,.) Android uses folders to denominate partitions (mounted, perhaps?)? (but they are actually partition on the disk of Android device?)

- Is it correct to view, both the internal storages and external strages exist on same physical disk, just in different partitions? Or perhaps they are separated by different NAND memory chips? Do you happen to know how much internal storage is reserved in Android?

- Is it correct to view, the folders that I had access to prior to root access (in my case that was /storage/emulated/0/ ) is an external storage, considering that I had the total control of it? So if I use a tool such as "app2sd," that is where the app2sd will try to move stuff to?
 
Last edited:

lopri

Elite Member
Jul 27, 2002
13,211
596
126
Or is it the opposite? If you look at the first screenshot I posted earlier,

wSWvm.png


You can see

/sdcard/
/storage/
/system/

Again, the screen seen above is the highest at the folder hierarchy with root access in my Nexus 7. If you were to guess, which one is which (a partition, a folder, an internal, an external, etc,.?)

If I were to guess that /sdcard/ is external storage partition, and /system/ is a folder residing in /storage/, which is an internal storage partition - does it sound plausible?
 

vshah

Lifer
Sep 20, 2003
19,003
24
81
on nexus devices since the nexus S, there is only one partition.

/sdcard, /storage/emulated/0 etc. are all pointing to the same place, and that is the "sdcard" or "External storage" as far as apps are concerned.

"internal" storage is everything else you see at the top level:
/data - apps are installed to /data/app and store their data in /data/app-asec among other subfolders.

/system contains components of the android OS. /system/app contains system apps like the launcher. you'll find your SU binary in /system/xbin


it doesn't make any sense to use apps2sd on a nexus device, since it's all one partition. you can fill up the "internal storage" part, or you can fill up the "external storage" part, it makes no difference.
 

imagoon

Diamond Member
Feb 19, 2003
5,199
0
0
I have heard some people talking about moving their applications to sdcard to save space in the system partition (is that the correct term?).

This function is built in to Android. You do it in the app management section of the GUI. You don't have to root the system or do anything in the file system.

App management -> click the app -> "Move to SDCard."

As for the rest... Android FS is a maze and I can't offer anything there.
 

vshah

Lifer
Sep 20, 2003
19,003
24
81
This function is built in to Android. You do it in the app management section of the GUI. You don't have to root the system or do anything in the file system.

App management -> click the app -> "Move to SDCard."

As for the rest... Android FS is a maze and I can't offer anything there.

while it is built in, OP won't see it on his Nexus 7 since there's only one partition so moving an app to "sdcard" would have no effect on storage utlization.
 

imagoon

Diamond Member
Feb 19, 2003
5,199
0
0
while it is built in, OP won't see it on his Nexus 7 since there's only one partition so moving an app to "sdcard" would have no effect on storage utlization.

Well ok, then what is the point of the OP request? Also I think the proper term is "one mount point." My Nexus has 1 partition with /sdcard mounted to the internal storage chip.

Anyway my original question stands. I would be interested to see the fdisk list out from a terminal emulator.
 

lxskllr

No Lifer
Nov 30, 2004
57,478
7,681
126
Well ok, then what is the point of the OP request? Also I

I think it gets slow if the file system gets too full, but I don't know how much "too full" is. I've been moving my apps to the root partition. Deleting a bunch of default apps, and putting my own in.
 

lopri

Elite Member
Jul 27, 2002
13,211
596
126
I did some reading today and vshah, I thank you very much. Your post (#14 specifically) cleared a lot of things that I was confused about. And your explanation totally makes sense. (obviously, since you're stating facts) No wonder I did not see any kind of physical partitions with those low-level diagnostic tools.

I am still digesting and "indoctrinate" myself on this new knowledge. I am likely to have more questions, but I want to thank everyone trying to help me. Again, I am not done and will probably (more like definitely) have further questions.
 

vshah

Lifer
Sep 20, 2003
19,003
24
81
I did some reading today and vshah, I thank you very much. Your post (#14 specifically) cleared a lot of things that I was confused about. And your explanation totally makes sense. (obviously, since you're stating facts) No wonder I did not see any kind of physical partitions with those low-level diagnostic tools.

I am still digesting and "indoctrinate" myself on this new knowledge. I am likely to have more questions, but I want to thank everyone trying to help me. Again, I am not done and will probably (more like definitely) have further questions.

No worries, the new folder structure threw me for a loop when I first encountered it as well
 

rileyrg

Junior Member
Oct 20, 2013
2
1
0
shamrockirishbar.com
I dunno man. Android is a different beast than GNU/Linux. I was starting to get into it early this year, but broke my tablet, so I quit playing with it. I never got to understanding how it all goes together. I'm wondering how much it varies per manufacturer, because my setup isn't like that.

If you don't get any love here, you may want to read some Android specific forums. If you go that route, take some time to learn before you ask questions. There's a lot of noobs with Android devices, and they get in the forums and ask questions that were answered on the same page they were asking on. It's easy to burn out the people with knowledge when they get asked the same questions over and over. I knew almost nothing, and I was getting burned out repeating what little I did know. You should be able to find some good stuff here...

https://www.xda-developers.com/

If you dont know, then why reply? It stuff like this that litters google and pollutes it with false leads.
 

lxskllr

No Lifer
Nov 30, 2004
57,478
7,681
126
If you dont know, then why reply? It stuff like this that litters google and pollutes it with false leads.

Awe, did someone come here expecting to be spoon fed, and left empty handed? Sucks having to put in effort, doesn't it? That thinking stuff is hard.

This is a discussion forum. Truth is found by bouncing ideas around, and narrowing possibilities to the fewest. It isn't your personal free help desk. if you want personal support, you're free to pay someone for it. If you want discussion, and a degree of self help, you join a forum.
 

000_Cthulhu_000

Junior Member
Nov 28, 2013
1
0
0
I'm gonna bump this one as a new user and get it back on track.

I'm having the same curiousities as the OP.

My file structure on my Galaxy Nexus, 4.3 Jelly Bean is exactly the same.

My 'abnormality' is that I am still working with Windows Vista (...irk...:hmm:) and as windows explore displays it from My Computer - 'Internal Storage'.

This I assume is the same with other people. As I browse through each file structure; comparing the Android that has;

/sdcard/
/emulated/0
/legacy/

...etc...

Windows has simply...a completely different appearance...what I mean is folders that don't exist on the above mentioned folder structure appear in Windows Explorer...this causes a nuisance with media and other files.

I want to work around this and find the real 'internal storage' on the /root/ that Android does not display. I've also, read that it may be a seperate patition all together. Any thoughts...?

PICTURES....!!!!

https://www.dropbox.com/s/c9793o0elabnmcw/Windows.jpg

https://www.dropbox.com/s/ea7hbew6rmcb6ya/Windows2.jpg

https://www.dropbox.com/s/w71yknm6z2xk1p5/Screenshot_2013-11-28-11-34-24.png

https://www.dropbox.com/s/i4u70jtoal5nt1o/Screenshot_2013-11-28-11-41-09.png

https://www.dropbox.com/s/3jll4o284o9sggk/Screenshot_2013-11-28-11-42-46.png