Backup with Ubuntu Touch is a not yet solved problem. However, yesterday I needed a working backup solution because for my job I wanted to test an Android app on my Nexus 5 with a real Android system.
The current solutions mentioned in the UBports forums doesn't seem to work. Something with adb pull data/*** leads to errors and never finishes. Using TWRP, a custom recovery tool for Android phones, was not recommended.
Disclaimer: Try this on your own risk! It worked for me but this doesn't mean that it will work perfectly for your device too!
So I tried to use TWRP for recovery. My device: Nexus 5!
First I have saved all files from my phone on my computer and disabled all the 2fa I'm using with the brilliant app authenticator.
Then I have booted my phone into fastboot mode with:
adb reboot fastboot
Then came the TWRP installation. After downloading the correct TWRP version from the website, I have flashed it with the command:
fastboot flash recovery [TWRPFILENAME].img
Then I have rebooted into recovery with:
fastboot reboot recovery
On the Backup page I've created a backup with activated compression and all partitions selected! This has taken a while...
After this I have saved the whole TWRP directory on my computer (important!) and used TWRP to wipe my phone (panic!!! Will this work?? No one knows?!?) and install Android on it. This worked like a charm.
After doing the test stuff I wanted to switch back. Just restore the TWRP backup? No! First wipe the complete phone by installing Ubuntu Touch with the UBports installer again with wipe selected so you get a clean start! Then flash TWRP again and then copy the TWRP directory from the computer back to the phone and restore the backup. And THIS worked like a charm!
I don't know if this will work without the reflashing at the end or any other changes but for me it's a way to backup the Nexus 5 and restore everything.