First of all, my SD card is not corrupted and I can access all my files with TWRP recovery file manager after entering my pattern to decrypt my storage, all of my files are not corrupted either. This question is not about how to restore files.
My Android 6 phone (Alcatel 5010D) fails to mount internal SD card on boot as adopted storage. It does mount the card only at /mnt/expand/5cf86564-54ca-4bbf-85e7-1f491f7ef923 (/dev/block/dm-1) but my /sdcard directory is empty (actually, it is a link to /storage/self/primary which in turn is a link to /mnt/user/0/primary). In settings > Storage & USB I can see my SD card, it says “8.21 GB used of 28.50 GB” (this is correct). But if I click on it, Apps, Images and everything else are using “0.00 B” which obviously is not correct. I have plenty of applications and some images. If I click “Explore”, it shows empty screen.
So, how can I manually mount it? Or at least understand why Android does not do it automatically anymore? I have root access.
Please note that I know for a fact that mounting /sdcard manually is possible. TWRP recovery does this somehow, and I can access all my files in its file manager. In the past I was able to fully recover by copying all of them with adb pull while in TWRP recovery, format SD card for internal storage, copy everything back and then it works again normally. But sometimes Android stops mounting internal SD card on boot automatically for no apparent reason. If I knew how to do it manually, I would at very least had a quick fix for this issue and perhaps I could understand why Android fails to mount it automatically. I tried to Google an answer to this question, but usually I find methods like to mount encrypted storage on PC which is not what I’m looking for.
Also, as I already mentioned, my SD card is not physically corrupted, and I can read all files on it just fine. I know how restore everything, I’m aware of an option to format SD card as portable. But I would like to try to fix the issue at hand without reformating my card.