I wrote this short tutorial because extending my internal storage using my new micro SD card on my Retroid Pocket 2+ failed all the time. Only setting it up as portable/external worked. However, this instructions should work in any Android 5.0+ device.
So, in case you have problems setting up your SD card on your Android device via graphical interface (setting up storage as extended internal memory or portable), and you get a corrupted SD card or any other error, follow these steps to fix it via adb shell
:
- Make sure you have adb access to your Android device:
Settings > System > About
, touch/click onBuild number
untilDeveloper options
are enabled: - Go to
Settings > System > Developer options
and enable USB debugging. - Assuming you have adb installed on your remote terminal run the following:
adb shell
- Check if your device supports adopting SD card storage as internal by:
sm has-adoptable
- If you get
true
, you can set up sd card storage to extend the internal storage of your device. Otherwise (false
), you can only set it up as portable/external (like a normal connected storage drive). In any case, ensure your device enforces this mode by:sm set-force-adoptable on
- Check your sd card disk id:
sm list-disks
- Partition your SD card (use your disk id):
- Only as extended internal storage:
sm partition disk:179,32 private
- Only as portable (external) storage:
sm partition disk:179,32 public
- Mixed (part internal and part portable storage):
The value after mixed is the ratio (%) of internal. The rest (100 - internal ratio) will be partitioned as public.
sm partition disk:179,32 mixed 50
- Only as extended internal storage:
- Once it's partitioned, you only need to format it. But first you need to know the id of your volume (partitions):
sm list-volumes
- Format your volume or volumes:
sm format private:179,34
- Then you should be able to mount your new volume or volumes from Android's graphical interface. You can also do it via shell:
In case you don't see your new volume mounted correctly (e.g. wrong capacity displayed), just reboot your device and it should be fixed.
sm mount private:179,34
Important: Make sure you input the right disk and volume ids to run the commands. They probably won't be the same.