wiki-grav/pages/04.other/android/adb/default.en.md

29 lines
1.3 KiB
Markdown
Raw Normal View History

2022-11-18 19:25:06 +01:00
---
title: ADB
visible: true
---
[toc]
## Full Storage backup
The easiest, and probably intended way to copy files using adb can be seen in the following command.
`$ adb pull -a -p /sdcard/ ./<target folder>`
2022-11-19 14:55:05 +01:00
The example here makes a copy of all content in "sdcard", the user's data directory.
This is probably still the best way, with compression afterwards on the host system. Simply, because other options don't allow browsing of the file structure properly.
Additionally, this will show a progress meter, allowing for guesses when the transfer will be complete.
Compress the directory using this command.
`$ tar -cv -I"zstd -19 -T0" -f sdcard.tar.zst <folder>`
2022-11-18 19:25:06 +01:00
### Compressed backup
2022-11-18 22:17:25 +01:00
> [Stackoverflow answer](https://stackoverflow.com/a/39429196)
2022-11-18 19:25:06 +01:00
Using this command, a backup can be pulled as well. This time however, it is passed to zstd for compression.
Tar on the phone doesn't do much except go through all files and send them to the terminal's STDOUT. All the compression happens on the host.
2022-11-18 22:17:25 +01:00
*All data has to be transfered first. very slow with USB 2.0*
2022-11-19 14:55:05 +01:00
*Also not readable after the transfer*
2022-11-18 19:36:08 +01:00
`$ adb exec-out "tar -cf - /sdcard/* 2>/dev/null" | zstd -19 -T16 -v -o sdcard-2022-11-18.zst`
2022-11-18 22:17:25 +01:00
2022-11-19 14:55:05 +01:00
*testing*
2022-11-18 22:17:25 +01:00
`$ adb exec-out 'GZIP="-9" /system/xbin/busybox tar -czf - /sdcard/*' > sdcard.tar.gz`