1

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
  • copied device- and partition UUIDs (PTUUID, PARTUUID) from old SD card to new card using gdisk, hoping that Android would recognize the new card as "known" and mount it. It doesn't.

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

5
  • 1
    Did you try Forgetting the old card before formatting the new one? Commented Oct 17, 2020 at 14:15
  • @IrfanLatif No, I did not, for fear that would then be unable to access anything on that card anymore, since it's encrypted. I saved most of the data, but I might have forgotten something.
    – Tomalak
    Commented Oct 17, 2020 at 14:56
  • @IrfanLatif I could try to change the UUID of the new SD card to match the old card, would that convince Android to mount it properly? (It probably would, but it's unclear to me why bending over backwards so much is necessary - why won't the OS treat a new card properly on its own?)
    – Tomalak
    Commented Oct 18, 2020 at 9:18
  • Sorry I personally never used Adoptable Storage except for experimenting. So can't be very helpful. Commented Oct 18, 2020 at 11:29
  • @IrfanLatif For what it's worth, you were right. Thanks for the pointer.
    – Tomalak
    Commented Oct 19, 2020 at 17:01

1 Answer 1

2

Okay, I figured it out (hat tip to @IrfanLatif). What's going on is this:

Android focuses on one single "primary" SD card that can be used to permanently enhance internal storage, e.g. by moving apps to it.

When it is removed, the system remembers that apps and settings are still stored there, and waits that it shows up again. Other SD cards can be formatted for internal use, but they won't actually be usable until all ties with the known SD card are broken.

This means the card must be explicitly forgotten. The option to Forget a card is available from the Storage menu when that card is not currently inserted.

  • Be sure to backup everything you need before doing that.
  • Eject the card via the menu and remove it from the slot.
  • Tap the card's name in the storage menu and then "Forget".
  • Confirm the warning that all data on that card will be lost forever, since the card is encrypted and Android is about to delete the encryption keys.

Only after that, Android will accept a different SD card as its primary storage and make it available to the rest of the system.

1
  • Thanks, @Tomalak. After searching a very long time, this answer finally gave me a way to replace an android sdcard formatted as internal with a larger one.
    – hcc23
    Commented Apr 3, 2022 at 19:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .