Create a Secure Android Backup Using ADB

11 min read Learn step‑by‑step how to back up your Android device safely with ADB, store the backup locally, and restore it when needed—all without third‑party apps. September 23, 2026 23:00 How to Create a Secure Android Backup Using ADB and Local Storage

Why Use ADB for Backups?

Most Android users rely on cloud services or manufacturer‑provided tools to protect their data. While convenient, those solutions often tie you to a specific account, limit the types of data you can back up, or store the backup on servers you don’t control. Using the Android Debug Bridge (ADB) gives you full control over what gets saved, where it is stored, and how it is protected. Because the backup resides on your own computer, you can encrypt it, keep multiple versions, and restore it even if the device is bricked.

What You’ll Need

  • A Windows, macOS, or Linux computer with at least 2 GB of free space.
  • A USB‑C or micro‑USB cable that supports data transfer (charging‑only cables won’t work).
  • The Android device you want to back up, running Android 6.0 (Marshmallow) or later.
  • ADB installed on your computer (part of the Android SDK Platform‑Tools).
  • Optional: A password‑protected archive tool (e.g., 7‑Zip, WinRAR, or the built‑in zip command) for encrypting the backup file.

Step 1 – Enable Developer Options and USB Debugging

  1. Open Settings on your Android device.
  2. Scroll down to About phone and tap it.
  3. Find Build number and tap it seven times. You’ll see a toast message saying “You are now a developer!”.
  4. Return to the main Settings screen. A new entry called Developer options appears.
  5. Enter Developer options and toggle USB debugging on. Confirm any security prompt that appears.

Enabling USB debugging allows your computer to communicate with the device over a USB connection using ADB commands.

Step 2 – Install ADB on Your Computer

ADB is distributed as part of the Android SDK Platform‑Tools package. Follow the instructions for your operating system.

Windows

  1. Download the latest Platform‑Tools ZIP from the official Android developer site.
  2. Extract the ZIP to a folder such as C:\adb.
  3. Add the folder to your system PATH so you can run adb from any command prompt.

macOS

  1. Use Homebrew: brew install --cask android-platform-tools.
  2. Alternatively, download the ZIP, extract it, and add the platform-tools directory to your PATH in .zshrc or .bash_profile.

Linux

  1. On Debian‑based distros: sudo apt-get install android-tools-adb.
  2. On Fedora: sudo dnf install android-tools.
  3. If you prefer the official ZIP, extract it and add the platform-tools directory to your PATH.

After installation, open a terminal (or Command Prompt) and run adb version to verify the tool is accessible.

Step 3 – Verify the Connection

  1. Connect your Android phone to the computer via the data cable.
  2. On the phone, you may see a prompt asking to allow USB debugging from this computer. Tap Allow.
  3. In the terminal, type adb devices. You should see a line with your device’s serial number followed by device.

If the device is listed as unauthorized, re‑check the prompt on the phone and ensure you have accepted it.

Step 4 – Choose the Backup Scope

ADB offers two primary backup modes:

  • Full backup (adb backup -apk -shared -all -f backup.ab) – captures apps, app data, and shared storage (photos, downloads, etc.).
  • App‑only backup (adb backup -apk -f appbackup.ab com.example.app) – backs up a single app and its data.

For a comprehensive safety net, we’ll perform a full backup. If you only need specific apps, replace the -all flag with the package names you want.

Step 5 – Run the Full Backup Command

Open your terminal and navigate to a folder where you want the backup file to reside. Then execute:

adb backup -apk -shared -all -f android_full_backup.ab

Explanation of flags:

  • -apk – includes the APK files of installed apps.
  • -shared – backs up files from the shared storage (DCIM, Downloads, etc.).
  • -all – backs up all user apps and their data.
  • -f – specifies the output file name.

After you press , the device will display a screen asking you to confirm the backup. You can optionally set a password to encrypt the backup. **We strongly recommend using a password**; it prevents anyone who obtains the .ab file from extracting the data without the key.

Enter a password (or leave blank for no encryption) and tap Back up my data. The backup process may take several minutes depending on the amount of data.

Step 6 – Verify the Backup File

Once the command finishes, you’ll see the android_full_backup.ab file in the folder you chose. Verify its size – it should be roughly comparable to the amount of data on your device. To ensure the file isn’t corrupted, you can perform a quick checksum:

# Windows PowerShell
Get-FileHash .\android_full_backup.ab -Algorithm SHA256

# macOS / Linux
shasum -a 256 android_full_backup.ab

Record the hash value in a secure note. If you ever need to compare the file after copying it elsewhere, the hash should match exactly.

Step 7 – Encrypt the Backup for Extra Safety

If you didn’t set a password during the ADB step, you can still encrypt the .ab file using a standard archive utility:

# Using 7‑Zip on Windows
7z a -tzip -pMyStrongPassword -mem=AES256 android_full_backup.zip android_full_backup.ab

# Using zip on macOS / Linux
zip -e -P MyStrongPassword android_full_backup.zip android_full_backup.ab

Replace MyStrongPassword with a passphrase you can remember but that is difficult to guess. Store the password in a password manager, not in plain text.

Step 8 – Restoring the Backup

When you need to restore data (e.g., after a factory reset or on a new device), follow these steps:

  1. Ensure USB debugging is enabled on the target device and that the device is authorized for the computer.
  2. If you encrypted the backup with an external archive, first extract the .ab file using the same password.
  3. Run the restore command:
    adb restore android_full_backup.ab
  4. The device will prompt you to confirm the restore operation. Enter the password you set during the backup (if any) and tap Restore.
  5. Wait for the process to finish. Your apps, app data, and shared files should reappear as they were at the time of backup.

Note that some system apps and settings cannot be restored via ADB; you may need to configure those manually.

Step 9 – Managing Multiple Backup Versions

It’s a good practice to keep a rotating set of backups (e.g., weekly). To avoid clutter, adopt a naming convention that includes the date:

adb backup -apk -shared -all -f backup_2024-09-23.ab

Combine this with a simple script that deletes backups older than a certain age, or store older backups on an external hard drive or cloud storage that you trust.

Risks and Compatibility Limitations

  • Android 9 (Pie) and later introduced stricter restrictions on the adb backup command. Some apps opt‑out of backup via the android:allowBackup="false" manifest flag. Those apps won’t be included in the .ab file.
  • Encrypted device storage (e.g., devices using File‑Based Encryption) may prevent certain data from being exported via ADB. In those cases, a full device image (via custom recovery) is the only reliable method.
  • Rooted devices can use more powerful backup tools (e.g., Titanium Backup), but the ADB method works on both stock and rooted phones without additional software.
  • Data loss risk – always verify the backup before wiping the device. A corrupted or incomplete backup can leave you without a restore point.

Step 10 – Automating the Process (Optional)

If you’re comfortable with scripting, you can automate daily or weekly backups using a simple batch (Windows) or shell (macOS/Linux) script. Here’s a minimal example for Linux/macOS:

#!/bin/bash
# backup_android.sh – creates an encrypted ADB backup with a timestamp
DATE=$(date +%Y-%m-%d)
FILE="android_backup_${DATE}.ab"
PASSWORD="$(cat ~/.adb_backup_pass)"   # store password in a protected file
adb backup -apk -shared -all -f "$FILE" -noapk -nosystem
# Encrypt the backup
zip -e -P "$PASSWORD" "${FILE}.zip" "$FILE"
# Remove the raw .ab file
rm "$FILE"

Remember to set the script as executable (chmod +x backup_android.sh) and schedule it with cron or Task Scheduler. Keep the password file readable only by you (chmod 600 ~/.adb_backup_pass).

Conclusion

Backing up an Android device with ADB gives you granular control, encryption options, and the peace of mind that your data lives where you decide. While the process involves a few command‑line steps, the flexibility it provides—especially for power users, developers, or anyone who wants a reliable offline backup—far outweighs the learning curve. Follow the guide above, keep your backup files organized, and you’ll be prepared for accidental wipes, software glitches, or device upgrades without losing a single photo or setting.

User Comments (0)

Add Comment
We'll never share your email with anyone else.