0
  1. /sdcard -> /storage/sdcard0

  2. /storage/sdcard0 -> /storage/emulated/legacy

  3. /storage/emulated/legacy -> /storage/emulated/0

It is known that symlinks in the above example are locations on the Android file system that reference other storage locations on a device. However, when a user creates a file, in any of the locations above, all of the locations will contain the same file, but where is the original file? Does the file remain in the location in which it was created and is referenced by all the other symlinks? I would like to know if any of the above locations store the original file or if there no original file, what is the technical process that Android handles that file?

  • 1
    The device which is mounted, in all of your three examples, is always the internal storage, masked by FUSE. The "real" location is /data/media. – Grimoire Apr 28 '17 at 8:45
  • 1
    You might wish to read the Wikipedia article on symbolic links to get an understanding of how they work :) Apart from that, there's a system call (getExternalStorageDirectory()) used by apps to determine their "entry point", if that's what you mean. (For interested readers: this is the question which led to the current one.) – Izzy Apr 28 '17 at 13:57
  • @Izzy , Well. I was hoping someone could help explain it simply for me to understand...My guess is that it exists in the file path in which it was intentionally created. I believe emulated storage is just a reference to sdcard storage and that files actually reside in sdcard storage. Would you agree? – Narcotixs Apr 29 '17 at 7:41
  • 1
    Not really, which is why I linked the Wikipedia article. Symlinks are just "pointers" you could understand as "please go there". So files are always stored "there", where the symlinks point to – i.e. the "real location". Second, no: it's the other way around. (Internal) SD-Card storage simply is a reference to the emulated storage: /storage/sdcard0 -> /storage/emulated/legacy :) – Izzy Apr 29 '17 at 9:32
  • The thread continues at: android.stackexchange.com/questions/173983/… – Narcotixs Apr 29 '17 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.