how to transfer files to new external sdcard


Question

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.


Answer

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


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