Multiple partitions on sdcard (fat, exfat) on Android?


Question

How is Android supposed to handle multiple partitions on an extern sd card?



As an experiment, I took a 64 GB SDXC card, looked at it in Gparted, it turns out it is exfat formatted, with some amount of MB unallocated at start. Using gparted and gnome-disks, I managed to split the partition into two exfat partitions, which should be around 32 GB each.



Inserted this into an Xperia Z2, stock ROM (the last Android 5.x update). The phone didn't put out any notification upon plug in of the sdcard, but notified the plug out of the card, and complained it should be unmounted first. I inspected a bit via adb logcat and it looks like mounting is ultimately fine, as /storage/sdcard1. But when I look at that via Settings/Storage, I can only see 29.12 GB for "SD Card". Plugging the card back at the PC, I can see only the first partition has Android files saved, not the second one. Same result if first partition is exfat, and second partition is fat32.



So, basically, is this the expected behavior of Android when presented with an SD card with two partitions - it just mounts the first one, and ignores the rest? Could I mount the second partition from say adb shell, and would I need a rooted device for that?


Answer

By default, Android only uses the first partition found on the card and mounts it as described in your question. Subsequent partitions will be ignored. That's what's utilized by tools like : as the system won't interfere on other partitions, they use those for their purposes – be it moving apps to free up space on internal storage (Link2SD), having a swap partition/file, or something else.



Now, if you want to use multiple partitions for your own purposes, you'll have to care for them yourself – which, next to the obvious creation, also includes mounting. To do so, you will most likely need root; I have not read about a user-accessible FUSE method for this (open to learn if it exists :)


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