1

So I'm running out of space and I'd like to use link2sd to move my apps to sd card. But before that I need to create a partition on my SD card, and to do that I would have to move my files from it and keep them somewhere else temporarily, format/create a partion on the SD card, and then move the files back. I'm using a lot of apps with a lot of data that would obviously no longer be there if something happens to the files during the move.

I'm also using XinternalSD (though xposed) to automatically store some of the apps data directly on the SD card.

So basically alot of the files on the SD card aren't put there directly by me but rather through apps. I'm not sure what their write protection is and I don't want to risk losing some in the move.

I want to be able to move everything as is and move them back in a way that it would be exactly how it was before the move and nothing changes or apps not being able to detect some of the files or anything like that.

What's the best way to achieve this?

Android 7 | Rooted | Moto C Plus

Note: OS available: Ubuntu | Windows | Android

23
  • 1
    The safest way to create a backup of an SD-card is to use an USB-SD-card reader in your PC and create a full image of the whole SD-card (on Linux e.g. via dd on Windows there is the Win32DiskImager.exe project which can create an image file of an SD-card). Afterwards you can make a second backup by copying the files one-by-one to a backup directory (just to be safe).
    – Robert
    Mar 11 at 10:58
  • android.stackexchange.com/q/226573 check 'ls -1 /storage' for uuid and run the adb tar command on storage/D073-8B1B (instead of sdcard) without leading /
    – alecxs
    Mar 11 at 13:38
  • 1
    Last but not least (no matter how you copy the files, run sha256sum to make sure the copied data is identical.
    – Robert
    Mar 11 at 14:14
  • @alecxs How can I achieve this on Ubuntu?
    – JJrussel
    Mar 23 at 5:25
  • adb commands work on every platform. in case you have card reader, same as you did for adoptable-storage. just skip the decryption and mount partition, then create tar
    – alecxs
    Mar 23 at 9:20
2

For regular fuse/FAT file system type, there is no need to preserve file permissions, just copy all files as usual. You can check file system type by typing in mount in the terminal emulator. You will see somthing like this example:

/mnt/media_rw/149B-8301 type vfat
/storage/149B-8301 type fuse

149B-8301 is the UUID of the SD card and it shows that the file system is vfat.

To copy files regularly, run the following:

adb pull -a /storage/149B-8301 ~

advanced copy (tarball archive)

adb exec-out "tar -c storage/149B-8301 | gzip" > ~/sdcard_backup.tar.gz

copy from PC MicroSD Card Reader

cd /media/xubuntu
tar -czf ~/sdcard_backup.tar.gz 149B-8301

Note: replace ~ with path to target disk drive providing enough free disk space on PC

3
  • three different methods. first two methods are for MicroSD Card inserted in phone (will take several hours)
    – alecxs
    Mar 27 at 15:41
  • Thank you very much. Obviously for the first 2 methods (on the phone) it means I need 20 GB free space in internal memory, correct?
    – JJrussel
    Mar 27 at 16:23
  • no, it is streamed directly to PC
    – alecxs
    Mar 27 at 17:50

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.