TL;DR: I messed up. Now my phone won't store pictures because it's probably trying to write to some directory that doesn't exist. How can I fix this? What directory structure is expected? I caused it by maybe screwing up a bit when moving to Adopted Storage, but that may not be important for the answer.
I migrated to adopted storage this morning. I wanted a mixed partitioning, but accidentally got full-card adoption (i used the GUI). As part of that I suppose I migrated the existing /storage/emulated
to the adopted storage.
Because I wanted a mixed setup and I had backups of my data, I just ran sm partition ... mixed 25
and nuked the existing adopted storage.
Now I can't take any pictures. If I do a screenshot, it says it couldn't save it. If I take a picture with OpenCamera, it says the same.
I would like to avoid the hassle of factory resetting if it's just a matter of creating some directories and/or creating some symlinks. I tried setting up a symlink /media/expand/<my-adopted-storage>/user -> /storage/emulated
and created DCIM
(mode 1777
) in /storage/emulated/0/DCIM
(where it used to be). That doesn't help.
Am I on the right track and just getting the details wrong, or am I screwed?
As you can see from the tags, I'm on CyanogenMod 13 / Android 6 / Marshmallow.
Further investigation:
Looked where OpenCamera is looking, and it's looking at /sdcard/DCIM
. /sdcard
is a symlink to /storage/self/primary
and that's a symlink to /mnt/user/0
. Tried creating a symlink to the existing DCIM
there, didn't help. Maybe it needs to point to the right place in the system to slip through the security tracks? Trying a reboot and seeing where things end up.
EDIT: It was /sdcard -> /storage/self/primary -> /mnt/user/0/primary
. I created /mnt/user/0/primary -> /mnt/expand/*/user/0
. No go.
There is a secondary user on the phone. When I switch to that, I get a bunch of "Unfortunately YouTube/Gallery/foo stopped." and I can't run any of the installed apps -- then I get the same message.
I had three SD "Cards" listed in Storage & USB: Purple (successfully adopted), Grey (first adoption, now abandoned, said "not mounted") and sdcard1. I figured that maybe it's still yearning for that unmounted (nonexistent) partition, so I clicked it and chose "Forget". Now sdcard1 is corrupt (!). Will reboot again and see what it makes of it.
Progress! After forgetting that original adoption and rebooting, now we have /sdcard -> /storage/self/primary -> /storage/emulated/0
.
/storage/emulated/0
is a FUSE system that seems to have the same size as /data
, so things look pretty normal now. I took a screenshot, and /sdcard/Pictures
was created.
sdcard1
is back and looks fine.
Now there was a Migrate data command on both Internal storage and the adopted storage. When I clicked it on the adopted storage, emulated/0
was remounted as a FUSE proxy for the adopted storage and screenshots now go there instead of to internal-internal. I think this is like I want it now.
/sdcard/Pictures/Screenshots
(at least that's where they were on all devices I've checked; I've never seen them going toDCIM
, which is the camera app's default). I'd assume Android creates this directory automatically if it not exists – so maybe you can check the logs while trying to take a screenshot? That might give some clues on what's going wrong.