Restic for Android

  1. Is there a version of restic for Android?
    It would be awesome if i could backup my phone to my cloud repo.

  2. I didn’t happen to see one, so i wonder – how difficult would it be to compile the app on Android? would it be possible to backup the phone’s root directory (say, in terms of permissions)?

Thanks!

1 Like

One option would be to run Syncthing on Android and sync to one of your home computers, then run restic on your computer against the synced directory.

1 Like

Besides the @cdhowie option, you can also use restic with Termux. I’ve tried it (not extensively) and it works.

Edit: I think I got to work the arm64 version if I’m not mistaken but you have to make sure to give Termux permissions to storage. If you have your phone rooted, I think it could be possible to backup the root directory; if not, you can access to /storage/emulated/0 and backup everything there which could be more than enough since that’s the directory that contains basically everything. Also, you can use cd .. in Termux and right there you should find home and usr directories. Navigate to /usr/bin and put the restic binary there for convenience.

3 Likes

Thanks @cdhowie for referencing Syncthing. It seems like an elegant syncing solution.

However, i am looking for a distributed client-to-cloud backup architecture so that each client (whether it is a computer, a phone, a tablet, etc), could periodically backup independently of the rest. I find it much more attractive than turning one of the machines into, essentially, a storage-hungry backup server, which also needs to be regularly turned on.

Thanks @Dj0k3, i will give it a try!

I wonder – is there a technical/other reason that an Android installation of restic has yet to arrive? Instead of using an emulator… AFAIK there are not so many effective and cheap Android backup solutions. IMHO, this could be it! I’m curious to hear what do you think.

Yeah, Android without root doesn’t have to many options for backup. And still, the backup options available are like… outdated? A little weird to work with them, that’s for sure. But since you can backup all your pictures using the Google Photos and use Drive to backup your settings, I think maybe developers don’t see the point. Personally, I don’t backup my phone. I just backup the pictures and Google Photos is nice for that but the downside is that if you opt for storing the original pictures then it takes space from your Drive and if you decide to use the “unlimited” option, then you lose the original resolution.

It would be great if someone decides to develop a restic frontend for Android, but I’m no developer or anything related; just another user.

1 Like

The way restic works can be pretty demanding on the hardware. Even if you’d manage to compile restic for Android it’s uncertain if restic would properly work on low end or middle class smarphones. But I guess we’ll never find out as long as nobody tries it out. :smiley:

2 Likes

I read this and tried it. As @Dj0k3 pointed out, using Termux and downloading the arm64 version worked for me. I’m impressed, really. It worked as expected, 2GiB 20 minutes to backup. In my case, I didn’t had to install anything besides restic and openssh, configure a ssh key and that’s it. Just like in my laptop. Didn’t get any errors. Checked the backup and it is all there. I will continue using it for my pictures.

2 Likes

Nice, glad to hear that it worked! Note that as the repository grows, the amount of RAM needed by restic (even just to perform a backup) can increase. If you find that restic starts crashing because it’s out of memory, then you’ve just hit that ceiling on your phone.

2 Likes

Yes, indeed. Lucky for me, I don’t have a lot in my repo. Just like 200GiB (raw-data) and I don’t really expect for this to increase much. Maybe over the years, but hopefully by that time restic team would have figure out something to improve the RAM issue.

Note that the amount of data is not as important as the number of objects, which incidentally scales linearly with the size of the indexes. On this Github issue, I determined that at least on OP’s system, the ratio of index-size to peak-memory-use is approximately 1:8 (for restic check).

1 Like

Had the same idea the day before, and was able to successfully backup my phone using restic_0.9.6_linux_arm64. I saved only the /data folder, but other parts of the phone should work just the same way (but are probably not needed for backup).

The backend that I used was rest-server using HTTP. For some reason it didn’t work via HTTPS / TLS, probably because I am using a self-signed certificate. (Same procedure works fine using Ubuntu 20.04.)

I started restic via adb shell as root. This is probably not as comfortable as it should be, but in my case it is sufficient for now.

Maybe someone will take the time to write a UI for Restic on Android. It would be great!

I’ve made a restic android app because I didn’t really like all the other backup solutions for android and I really love restic.
It uses the official restic linux binaries and a bit of proot/chroot magic to fix dns resolution.
You can check it out here:
https://github.com/LolHens/restic-android

Keep in mind that this is still a very early version and it probably contains a few bugs.

3 Likes

Cool :smiley:
Cool :smiley:

1 Like

Just for reference, as the Android app by @LolHens currently is quite limited: I created a detailed guide on using restic with Termux over at the /e/ community forums, but the guide can also be used with any Android OS of your choice: [HOWTO] End-to-end Encrypted Full Backup and Restore Solution for /e/OS using Termux and restic - eOSWiki - /e/OS community

1 Like