Backup and Restore

The Backup and Restore actions allow you to backup and restore most partitions present on the device.

When adding a Backup action, you will be presented with a dialog allowing you to choose a backup type, followed by a partition selection dialog listing the partitions that can be backed up for that backup type. The latter dialog also allows you to select a location to store the backup, and give the backup a descriptive name.

When adding a Restore action, you will be presented with a dialog allowing you to select which partitions you want to restore from the backup. By default, only the basic Android partitions are pre-selected.

File-based encryption

If your device is encrypted using file-based encryption (standard on most devices that came with Android 7.0 Nougat and newer out of the box), then only the primary user can be backuped and restored. Additional users' data will be lost.

Additionally, a backup made on a device encrypted with file-based encryption, will only restore in encrypted form if the device is also encrypted with file-based encryption when the restore is performed. Otherwise, it will restore in unencrypted form.

Backup types
  • Normal
    Common partitions.

    Creates a standard backup with only the basic Android partitions pre-selected.

  • ID
    Device IDs, EFS, IMEI.

    Creates a standard backup with only the partitions that have been detected to be relevant to the device's identification - on the network or otherwise - pre-selected.

  • Full
    All partitions.

    Creates a standard backup with all partitions pre-selected.

  • Raw
    Force raw backup.

    Creates a RAW backup with the partitions one might normally want a RAW backup of pre-selected.

  • Fastboot
    Fastboot flashable backup.

    Creates an archive containing Fastboot flashable copies of supported partitions.

  • ODIN
    ODIN flashable backup.

    Creates an ODIN flashable archive of supported partitions.

Fastboot backups

Fastboot backups are meant to be flashed from your computer using the fastboot command. These backups cannot be fully restored using FlashFire, though you can recover some partitions (but not /data or internal storage) by using the Flash firmware package action on the ZIP file.

The backup is a ZIP archive that needs to be transfered to your computer and extracted before you can use it. It includes a flash-all.bat script with the required fastboot commands.

Fastboot backups can only be created for basic Android partitions, and this currently does not include bootloader, radio, or modem partitions. Please note that your device may not boot if the restored boot image and system partition are not compatible with the bootloader/radio/modem present on the device.

Please be aware that restoring /data will always result in a decrypted partition in ext4 format, regardless of encryption state or filesystem type when the backup was created. Your device may re-encrypt at first boot after restore, or you may need to re-encrypt manually if you want to continue using encryption.

Restoring /data will also wipe internal storage, so if you did not include internal storage in the backup itself, its contents will be lost.

Additional notes and requirements:

  • Your bootloader must be unlocked
  • The fastboot binary must be on the PATH
  • The fastboot binary must support the -u switch
  • The flash-all.bat script will also work on Linux and Mac if you chmod +x it
  • Partition format is based on Motorola's sparsechunk format
ODIN backups
This feature is currently disabled due to unsolved issues

ODIN backups are meant to be flashed from your computer using the ODIN tool. These backups cannot be fully restored using FlashFire, though you can recover some partitions (but not /data or internal storage) by using the Flash firmware package action on the ZIP file.

The backup is a ZIP archive that needs to be transfered to your computer and extracted before you can use it. It contains a .tar.md5 file that you can put in the AP or PDA slot in ODIN.

While many partitions can be included in an ODIN backup, it is advised to create a separate backup for the basic Android partitions and the special device partitions such as bootloaders and radio/modem. This way, if the special partitions fail to flash for any reason, you can restore the complete original firmware, followed by the Android partitions, and save your data.

Please be aware that restoring /data will always result in a decrypted partition in ext4 format, regardless of encryption state or filesystem type when the backup was created. Your device may re-encrypt at first boot after restore, or you may need to re-encrypt manually if you want to continue using encryption.

Restoring /data will also wipe internal storage, so if you did not include internal storage in the backup itself, its contents will be lost.

Additional notes and requirements:

  • Your bootloader must be unlocked
Backup format

Standard and RAW backups are folders containing individual files representing partitions.

Individual partitions are either in raw (.bin) or archive (.tar) format, potentially lz4 (.lz4 or .tlz4) or gzip (.gz or .tgz) compressed.

The partitions are divided into 1024 MiB chunks. The first chunk is called partition.ext, while the following chunks are called partition.%04d.ext.

Each chunk comes with its own MD5 file of the same name, but with the .md5 extension.

Android Debug Bridge (ADB)

To backup to your computer using ADB (either through USB or Wi-Fi), simply select Android Debug Bridge (ADB) as the Location for the backup. You will be provided with the adb commands to run when you need to run them.

If the type of backup you are creating normally consists of individual files, those will be wrapped up in a ZIP container. While you can safely extract all the files from the ZIP file and transfer them to your device to restore them directly without ADB, this does not work the other way around. The contents of the ZIP file need to be in the right order, so simply ZIPping up an on-device backup and trying to restore it through ADB will not work.

To restore a backup through ADB, tap the USB icon at the top right of backup selection dialog you get when adding a Restore action. In the next dialog you will be able to select which partitions to restore. Unlike on-device backups, which only show you the partitions that are actually present in the backup, you are now presented with all the partitions detected on your device. The partitions you select will only be restored if they are actually present in the backup file you to pass to ADB. You will be provided with the adb commands to run when you need to run them.

When restoring a backup through ADB, MD5 verification is disabled by default. If you re-enable it, you will have to send the entire backup file to your device twice. While this is obviously the safer route, it will take twice as long.

It is advised to connect the USB cable before hitting the Flash button, even if you are going to use Wi-Fi for the transfer and will just use USB for charging. Sometimes the USB connection is not detected if it was not present before you tapped Flash, and sometimes (dis)connecting the cable even during a Wi-Fi transfer may break the operation.

Restore from TWRP

The standard and RAW backup types come with twrp.zip file in the backup's folder. This ZIP file can be Installed in TWRP to perform an emergency restore.

Please note that only the /system, /vendor, /oem, /data (excluding internal storage) and /cache partitions are restored!

Additionally, if the backup was made on a device encrypted with file-based encryption, the restore will be done unencrypted.

Internal Storage

When you select Internal Storage to be backed up, backups from FlashFire itself, TWRP, CWM and TitaniumBackup are skipped.

USB mounts located in usbStorage are also skipped, as are multirom slots.

Adopted Storage

Please note that Internal Storage always refers to the actual internal storage, and that Adopted Storage always refers to the partition on the sd card that has been adopted. This holds true even if you have fully migrated your device to use adopted storage, so that normal applications see the adopted storage as internal storage.

You should also note that using Android's migrate functionality to transfer your data between internal and adopted storage, may wipe the target before performing the migration. In other words, if you have backups stored on your internal storage, and data on adopted storage, and decide to migrate the data back from adopted storage to internal storage, the backups stored on the internal storage are likely to be deleted by Android.

Excludes

You can create a file on the internal storage that lists files and directories that should not be included in backups of the data partition or internal storage, /sdcard/FlashFire/userdata_excludes and /sdcard/FlashFire/internal_storage_excludes respectively.

The contents of these files are case sensitive and relative to the base path of the partition, with one entry per line. For example, to exclude dalvik-cache and Chrome's cache from backups, this could be the contents of userdata_excludes:

    dalvik-cache
    data/com.android.chrome/cache

Similarly, to exclude camera images and your music collection from backups, this could be the contents of internal_storage_excludes:

    DCIM
    Music

Note that even if you exclude files from being backed up, they may still be restored from backups that already contain these files. A restore of such a backup will overwrite files already present.

The wipe action has the option to respect these excludes as well for internal storage. However, the excludes for the data partition are not respected, and are assumed to be cache-related files that can be regenerated by apps as needed.

Advanced users: The lines listed in these files are actually passed to tar's --exclude option prefixed with ./. You could exclude all app's caches by adding these lines to userdata_excludes, but this is neither advised nor guaranteed to be supported long-term.

    data/*/*cache
    user/*/*/*cache
    user_de/*/*/*cache
Bootloader partitions

Restoring bootloader partitions is dangerous and disabled by default. Please see the Flash bootloaders setting for further details.

Device specific instructions

Please see the Devices page for further details.