1
0
Fork 0
knowledge-base/KB/Android/ADB Backup.md

48 lines
2 KiB
Markdown
Raw Normal View History

2022-09-04 12:54:22 +00:00
---
creation date: 2022-01-08
tags: [note,android,adb,backup]
---
A small tutorial on how to backup Android _application data_ via the `adb` tool. Currently, this is the only mechanism to backup the _entire_ device.
If defaults won't work for you, have a look at the options for `adb` in the scripts. Defaults are that only _app data_ of installed and systems apps will be backed up. **NOT THE STORAGE ITSELF!**
Android apps can exclude themselves from backup, thus this mechanism cannot back them up.
## Prerequisites
### On your PC
You need the `adb` tools in order for this to work:
* Extract to e.g. `C:\Android` so that `adb.exe` resides in `C:\Android\adb.exe`
* Add `C:\Android` to the environment to make the `adb` command available
* Check in `cmd` (<Super/Windows key> + r, type 'cmd', press ENTER) if `adb devices` lists your device, else install additional driver for your device, also check that debug mode is enabled and your device is properly connected
### On your phone
* Enable `Developer Settings` by clicking 10+ times on the build number of your Android version
* A new menu should be there: Developer Settings
* In this new menu, enable `debug USB mode`
## Usage
### Backup
* Once installed, execute the script by double-clicking while your device is connected and debug mode is enabled
* Confirm any screens on your phone
* Your backup will be placed in a defaulf location, e.g. `C:\Users\<your-username>` in Windows or `/home/<your-username>` on UNIX
### Restore
Currently there's no script provided for restoring a backup as this is a single command in your command line. When your device is connected and in debug mode, use the following command pointing to the backup file you like to restore:
2023-03-29 16:16:29 +00:00
```shell
2022-09-04 12:54:22 +00:00
# Windows (<Super/Windows key> + r, type 'cmd', press ENTER)
adb restore C:\Users\<your-username>\mybackup.ab
# UNIX
adb restore /home/<your-username>/mybackup.ab
```
Confirm any dialogs popping up on your phone and maybe enter an encryption key to restore.