14

I've got a Moto G 2014 LTE running CM13. When I found out about the whole 'adopt SD card as internal storage' thing, I was quite excited, as the actual internal storage on this phone is tiny. I set up a 16gb micro SD, the biggest I had at the time, and have been using it with minimal problems.

Fast-forward to this day, and I now have a 64gb micro SD that I want to use instead of the 16gb one. However, I'm at a loss as to the best way to copy the data over onto the new one, or if it's even possible. The ideas I've got so far include:

  • Titanium Backup all [system] apps, factory reset, format new SD and then restore (should work, but a massive pain)
  • NANDroid the SD card onto a USB OTG stick, then restore to the new one (pretty sure this is a bad idea and won't work, but...)
  • Copy all the stuff onto my computer via my phone through a file manager of some sort (I have a linux/linux/windows triple boot, so file format isn't a problem), format the new SD into phone, and copy back (can't be that simple, can it? Hidden/inaccessible files?)
  • Copy the files onto USB OTG with a root file explorer app, reformat the SD as portable, format the new one as adopted, and then copy them back (could work, except for the point below)
  • Format the 64gb SD card as internal through an OTG card reader with the command adb shell sm set-force-adoptable true, use a root browser to copy all the data over from the old SD, format the old SD as external and remove it, and take the new SD and put it in the SD card slot (seems overly complicated, and also suffers the below pitfall)

The other thing that worries me is mount points: will the apps with externally-stored data know to look at the new SD card for it? Will I have to remount it in a specific location with the shell each boot (or use an init.d script perhaps)? I suppose that it can always be accessed through /sdcard or /storage/emulated/0, but I'm not 100% sure what goes on behind the scenes.

I've got recent NANDroid backups, so if anyone can eliminate the options that definitely won't work (or say which one[s] probably will), I can try them and report back in case someone stumbles across this question in the future.

EDIT: So, my phone further bit the dust and got to the point where it got into a pretty major bootloop. Ended up having to flash a whole new ROM. As such, I probably won't be able to test the full image/decryption/etc. method that I was originally planning. However, I will write up what I've discovered so far in case anyone wants to take up this particular method in the future:

  1. Image the old SD with dd as follows: sudo dd if=/dev/mmcblk0 of=~/SDCardBackup.img, where /dev/mmcblk0 is the location of the sd card as obtainable through lsblk
  2. Restore the image you just made to the NEW sd card : sudo dd bs=4M if=~/SDCardBackup.img of=/dev/mmcblk0 (you may have to unmount it first)
  3. From here on in, I was following this (thanks @beeshyams!) tutorial, which explains the next steps way better than I ever could have done. The plan was to decrypt the storage and resize the main partition with gparted. I had no idea whether it would work or not, but I felt it was worth a try. However, when I came to run the actual decryption command using the key I'd extracted, I got an error (which I believe was my shoddy linux skills more than anything).

As I say, I have no idea if the above method would work or not even if everything did go to plan. Also, feel free to correct any of my commands above if I mis-typed them (I'm on Windows currently, so this is all from memory.) If this info helps anyone, then good. But until then, @faidherbard's comment should work fine.

Thanks, Jackdafish

  • Key thing you are missing is that it is, encrypted, which means not possible as far as I know. See adoptable-storage for more info (edited your tag list to include this). There is a possible way, theoretically, you can try to get over the encryption problem – beeshyams Apr 2 '16 at 15:44
  • @beeshyams Thanks, I'll take a look and report back if I have any luck. Is the encryption key retrievable/findable with root access? I seem to remember something of the sort... – Jackdafish Apr 2 '16 at 15:57
  • One Possible (?) way to recover encryption key is linked in the comment. – beeshyams Apr 2 '16 at 16:11
  • @beeshyams OK, I'll take a proper look when I get back. If you move the files off the phone while it's on though (i.e. file explorer app > USB OTG, or plugged-in-phone > desktop file explorer), don't they get unencrypted? Otherwise they'd be unreadable on the next machine. – Jackdafish Apr 2 '16 at 16:17
  • 1
    Thanks for all the info guys! I think I'll grab that encryption key and try getting the lot off the SD card, formatting the new one, grabbing that encryption key and copying all the data back. See how it goes. I've got all my backups in order, so if that doesn't work I'll do a factory reset. If it does, I'll write up a step-by-step answer in a few days time in case anyone else comes across this post. Cheers :) – Jackdafish Apr 2 '16 at 20:26
17

Having a similar issue, I read through the comments to your question and ended up doing the following based on a hint suggested by Barleyman:

  • Go to Settings > Storage & USB › Internal Storage, click on "Migrate data" to move your data back to internal

In case you do not have enough space left on internal to move everything back (which was my case), here are some additionnal steps:

  1. Connect the phone to a PC via USB and back-up the contents of the old "adopted" SD Card
  2. Manually delete enough data from the old SD Card to be able to do the move: typically pictures and videos that you can easily restore afterwards
  3. Click on "Migrate data" in Settings > Storage & USB › Internal Storage
  4. Check that the old "adopted" SD Card is now empty (or even format it back to "Portable") then eject it
  5. Insert the new SD Card and set it up as "Internal storage" and agree to move the data to it
  6. Eventually reconnect the phone to the PC via USB to restore manually deleted data

Reference: Answer to "How does the "Format as internal storage" feature work in Android 6.0+?":

  1. You can reverse the process by opening "internal storage" from storage settings and there's "migrate data" that will copy everything back to internal nvram.
  • Hey, makes perfect sense. – Jackdafish Jul 13 '16 at 17:10
  • After step 3 I had to go through all the apps listed as stored on the SD card and move them to the internal memory until there were no more apps stored on the SD card. Then after step 5 do the opposite to whatever apps you want to store on the SD card. Otherwise, it worked like a charm. – Matt Oct 13 '16 at 3:47
  • I keep getting "not enough storage" even though my SD card only has 4 GB and my internal has 40 GB free – Shevek Aug 20 '17 at 9:10

protected by Community Sep 28 '16 at 14:56

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.