Backup your Android

Install the Android-SDK .

To backup your device with data only:

adb backup -all -f d:\nexus5_data_20170412.ab

To backup your device including Data and Apps:

adb backup -all -apk -shared -f d:\nexus5_complete_20170412.ab

Restore the backup

adb restore d:\nexus5_20140101.ab

Custom ROM

If your phone is not supported anymore (Nexus 5) you can install a custom rom to have all security related updates on it.

It first the phone must have an unlocked boot loader .

Install TWRP

Download twrp from:

I used

Make sure developer mode is enabled on the phone.
Rename twrp-3.0.2-0-hammerhead.img -> recovery.img Open a terminal and type:

adb reboot bootloader
fastboot flash recovery d:\Nexus5_backup\recovery.img
fastboot reboot

Make sure to hold directly volumn down + power.

Now select recovery mode and you should see the new recovery image loaded.


Connect a OTG usb adapter and a USB stick (formatted with FAT32). In TWRP select backup and select OTG as backup destination.

Install custom rom

I use the pure nexus project:

Tested with:

Unlock the bootloader

Make sure you do a full backup before you continue.
To unlock the bootloader switch of the phone. Then boot into bootloader/fastboot mode by holding volume down + power.

Plug the phone to your computer and make sure it could be found:

cd C:\Users\idefix\AppData\Local\Android\Sdk\platform-tools
fastboot devices

If it is found, continue:

fastboot oem unlock

Confirm on the phone using the volumn key and power button.

Reboot the phone with:

fastboot reboot

Now wait till the phone is completely booted again and restore your backup.