0

I have a rooted phone with Magisk 20.1 running on it. Inspired by this answer on Unix SE, I successfully created a bind mount using Termux. It was between a folder on external SD card and one in the internal storage. The commands executed are as below:

>su
>mount -o bind /storage/6333-6461/Books /storage/emulated/0/Books

The original folder in SD card is about 9GB, and my phone memory had only 1.2GB free. Needless to say, thanks to the Linux architecture, there was no problem because the folder in internal storage was just pointing to the one in SD card.

Now, I placed a test file in /storage/emulated/0/Books, and it was instantly visible in the original folder in SD card.

Then I removed the bind mount using the command >umount /storage/emulated/0/Books. I found that the test file was still there in the original folder in SD card.

My question is: When I placed the test file in the bind mount before unmounting, where was it actually located: in internal storage or external SD card? If I place a large file in the bind mount (i.e. in /storage/emulated/0/Books), where will the file take up space: in the internal storage or the SD card?

Wrichik Basu
  • 939
  • 3
  • 15
  • 32
  • I had used similar Magisk modules earlier (don't recall which one) but to answer your question, file is on external SD. To verify place a really large file >10 GB. It can't fit into your internal storage but it will allow because it is stored on external. I don't understand the how – beeshyams Nov 17 '19 at 14:52
  • Thanks @beeshyams. 10GB would have been to much; I tried with a 300MB file. You are right. Maybe post this as an answer that I can accept? – Wrichik Basu Nov 17 '19 at 15:06
  • Thanks but no because the answer should also explain the how,not just the end result. I am sure someone else can explain.//BTW 300 Mb file is not a good test case because it is smaller than internal free space. Try something larger than internal free space. – beeshyams Nov 17 '19 at 15:29
  • Obviously your file would be written to external SD card, that's the whole purpose of bind mounts. Your actual question is How bind mounts work? and it's generally about any Linux-based OS, not Android specifically. However bind-mounting inside storage/emulated/0 may cause you trouble in some situations. You may want to read details here: https://android.stackexchange.com/a/217936/218526 – Irfan Latif Nov 17 '19 at 17:58

0 Answers0