Replacement SD card not mounted properly in device


Question

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?


Answer

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.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes