internal sd – SDcard not mounted properly in device

I have an Android 8.1 device (encrypted, not rooted) that is configured to use an SD card as internal storage. That SDcard broke down and needed to be replaced.

After inserting a fresh replacement card, the device recognized it and asked how it should be formatted. I chose “internal”, and the format went though without issues. The card shows up under “Storage” with the correct capacity, just as the old one did.

However, using this card is not possible. All apps that try to access it (like camera, browser downloads, file managers) show “SD card not available” errors.

When I connect to the device through adb shell to check how the file systems are mounted, I can see a difference. This is what shows up when the old card is inserted:

bbb100:/ $ mount
/dev/block/dm-3 on /mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b type ext4 (rw,dirsync,seclabel,nosuid,nodev,noatime)
/mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b/media on /mnt/runtime/default/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid)
/mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid)
/mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b/media on /mnt/runtime/read/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=23,derive_gid)
/mnt/expand/beb7cb3c-0c09-43cf-83b8-ce1eac90a92b/media on /mnt/runtime/write/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid)
bbb100:/ $

and this appears when the new card is inserted:

bbb100:/ $ mount 
/dev/block/dm-3 on /mnt/expand/49d563a3-0905-4173-a1b3-8c29e3917d2c type ext4 (rw,dirsync,seclabel,nosuid,nodev,noatime,data=ordered)
bbb100:/ $

So it seems the new card is not initialized correctly and/or several directories do not get mounted for whatever reason.

Things I tried to no avail:

  • re-formatting the card
  • eject, mount
  • reboot the device
  • ran sm partition disk:179,64 private in adb shell just to see if there are any errors on the console (via) – there is no error
  • tried with different SD card (also brand new) – same behavior

What’s going on here and what else can I do to make the card work?

Additional info: There seem to be permission problems on the new card:

bbb100:/ $ df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                1.1G  3.3M  1.1G   1% /
tmpfs                 1.3G  816K  1.3G   1% /dev
/dev/block/dm-0       4.2G  3.3G  973M  78% /system
tmpfs                 1.3G     0  1.3G   0% /nvram
tmpfs                 1.3G     0  1.3G   0% /mnt
/dev/block/dm-1       496M  393M   93M  81% /oem
/dev/block/mmcblk0p17  96M   74M   22M  78% /firmware
/dev/block/mmcblk0p47  12M  8.3M  3.1M  73% /dsp
/dev/block/mmcblk0p55 992M  8.6M  967M   1% /cache
/dev/block/mmcblk0p34  27M  596K   26M   3% /persist
/dev/block/mmcblk0p52  16M  156K   15M   1% /bbpersist
/dev/block/dm-2        22G   13G  8.8G  61% /data
/dev/block/dm-3        58G   52M   58G   1% /mnt/expand/ff86c4d9-5828-4ca5-9f6e-f4e5b02b7dd9
bbb100:/ $ mkdir /mnt/expand/ff86c4d9-5828-4ca5-9f6e-f4e5b02b7dd9/media
mkdir: '/mnt/expand/ff86c4d9-5828-4ca5-9f6e-f4e5b02b7dd9/media': File exists
1|bbb100:/ $ cd /mnt/expand/ff86c4d9-5828-4ca5-9f6e-f4e5b02b7dd9/media
/system/bin/sh: cd: /mnt/expand/ff86c4d9-5828-4ca5-9f6e-f4e5b02b7dd9/media: Permission denied
2|bbb100:/ $