6

I have an old 64 GB sdcard and a new 128 GB sdcard, how do I copy over all files from my old card to my new in a way that makes android treat the new card just as the old card.

I tried simply copy-pasting over my DCIM folder, then I put the new sdcard in and rebooted my phone, on startup the phone recreated the /Android folder and all apps had rights to their new folders.

Ways I tried to move the files:

1)

  • dd old card to disk
  • dd to new card
    • after this the card works but is seen as having 64 GB instead of 128 GB space
  • use gparted to resize partition
    • this makes android see the card as having used 64 GB space but with no files or folders

2)

  • dd old card to disk to disk
  • dd to new card
  • use fdisk resize partition
    • this makes android see the card as having only empty folders, but still used 64 GB space

3)

  • create 128 GB partition
    • this I have tried with both FAT32 and exFAT
  • mount via mtp
    • Update: I have also tried to copy paste all the files and folders directly to the sdcard from the old card via the cp comand on linux (that was the very first thing I tried... I only tried all the other things because this did not work)
  • rsync all files and folders to the sdcard
    • this seems to make android see all the folders and files, but now my apps can't write to their own folders
    • eg the problem in all of the above cases is that android eigher a) does not see the file, simply sees the card as a file with 64 GB used space but it cannot see any of the folders, or it does copy it over but the apps does not have 'access' to their own directories eg Android/data/com.bambuna.podcastaddict/files/podcast/ is where my podcasts are, but the app podcastaddict does not have write premissions for the folder.

so in short... how do I copy over all my files from the old sdcard to the new one... or do I have to factory reset my phone and redownload all my apps such that all the folders and appropriate premissions are created by android... which seems to be my only option

additional information

  • my phone is a unrooted z5 compact
    • it runs android 5.1
  • I have access to a Linux and windows computer, but would prefer Linux solutions.
  • I don't care what file system is on my external SD card.
  • I am familiar with the command line and would prefer solution listing a few commands I need to copy-paste

As Firelord suggested, rebooting the phone makes android "display" the DCIM folder, so this one can be copied over, however it still seems that the /Android/data/com.company.app/ folders have to be created by the apps themselves, otherwise they cannot write to them, but you can subsequently copy files into these folders

Factory reset and restore from backup did this for me... it is an ugly solution... but at least it works.

I erroneously assumed that file permissions werehidden somewhere on the SD card and therefore tried to find the 'correct way' to copy, but it seems that the folder permission is saved on the internal card, or they are tied to the application in some non-trival way.

I restarted my phone again, and then some of my apps lost permissions to write to their SD card folders?!?!, ie podcastaddict which had downloaded 300 podcasts overnight could not write to sdcard1/Android/data/com.bambuna.podcastaddict/files/podcasts

By deleting and reinstalling podcastadditc it regenerated its folder and it has been working since.

  • 1
    Wow, this has a downvote! I'm bit surprised. Anyhow, jcr, does your device have OTG support? Although I believe that plainly copying the files from one card into another followed by a reboot should work, I want to see what would happen if you copy the files from one card to another when both are connected and mounted into Android? – Firelord Dec 28 '15 at 17:15
  • @programming good point what i did was "rsync -rtvu --size-only /media/local/Share/microSD/ SD\ Card/", I will try to add a "-a" or is there a better flag to set... I am in the midst of factory resetting my phone to make sure that it is not because android was somehow corupted – jcr Dec 28 '15 at 17:22
  • @Firelord I don't know it I have OTG support, how would I go about mounting both in android?, I do have MTP support as that was the protocol I used to mount in linux – jcr Dec 28 '15 at 17:27
  • 1
    DCIM folder issue is fixed because mediaserver (indexes multimedia files and images) is run on every reboot. How it did fix the Android/data/ issue is not sure to me. – Firelord Dec 28 '15 at 21:18
  • No offense, but I have done this many times in my Linux box, all I have ever done is power off the phone insert the original SD card in the computer, make a temp folder in my home directory, open a terminal and cd to the temp folder, then issue the command cp -r /media/.../* (adjust for proper mount point) then remove the card, insert the new one, format it as FAT32 with the same volume name, and then reverse the copy process, then reinsert the new SD card in the phone an boot. Done. It should not be more complicated than that. – acejavelin Mar 11 '16 at 1:07
1

I got a real 128 gb card, here I simply copy pasted over my DCIM folder, then I put the new sdcard in and rebooted my phone, on startup the phone recreated the /Android folder and all apps had rights to their new folders.

so my method:

  1. backup and delete all aps that use the SD card
  2. format the sd card
  3. take a photo to generate the DCIM folder
  4. insert SD card in your compuer
  5. delete the /Android folder (it will be regenerated when you insert the card in your phone)
  6. move relevant files to the DCIM folder
  7. insert sdcard in phone
  8. restart phone
  9. reinstall aps from backup
  10. do something that makes them regenerate their folders (ie down load a file, take a picture ect)
  11. restart the phone
  12. for all aps that cannot write to their own folder, delete he app and delete their /Android/data/com.company.app_name folder then go to 8
  • how come you deleted guide to detect whether the card was fake? – jcr Mar 11 '16 at 19:47
  • Detecting fake sd-cards is another topic. This is not a forum. One question, one answer. By the way my method below seems to be much easier. Copy the volume id followed by a straight copy, that’s it. – erik Oct 14 at 13:35
1

TLDR

  • copy the volume id of old card to new card
  • then copy the whole content of old card to new card (or copy it first to a harddisk and then from the harddisk to the new card, doesn’t make a difference).

Step by step

I used my Fedora linux computer to do this, as it is a Thinkpad with SD-card slot.

  1. First I looked what the volume id of the old sd-card was. I haven’t found a commandline tool for this, yet. So I used (KDE) partitionmanager (as gparted is not supporting extfat). Installed it with

    dnf install kde-partitionmanager
    
  2. Then I inserted the new sd-card and formatted it adding the volume id of the old sd-card. For that I had to install several exfat tools.

    dnf install -y fuse-exfat exfat-utils
    

    Then I formated new card with the old volume id (in the example the volume id is 01234567)

    mkfs.exfat -i 01234567 /dev/mmcblk0p1
    
  3. I then tried to copy from old to new sd-card with rsync -aP but astonishingly that didn’t work (data rate was really low (20–40 MB/s) and it seamed that only some files were copied to the new card, I have no idea why that happened, first time to see that, but as I didn’t have time, I didn’t further investigate). Then I just copied it with cp -a, which was at a rate of 100+ MB/s.

    cp -a /mnt/oldcard/. /mnt/newcard/
    

Inserted the new card in the phone, restarted it (didn’t have to, I think). Worked like a charm. Everything worked as before (Antennapod, Osmand, MapsMe, Aard 2 dictionary with offline Wikipedias, photos, etc.). Nothing was missing. But I have a lot more space left on the sd-card now. :-D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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