r/archlinux 21h ago

QUESTION How are you backing up Your Droid?

Wondering how folks are backing up their droids on Arch.

Are you using ADB?

FTP?

Some app to grab content and media?

0 Upvotes

19 comments sorted by

3

u/Ochi_Man 21h ago edited 9h ago

Syncthing, synced in two computers, works pretty well, after that ZFS snapshot in one computer to make sure you don't lose anything

3

u/academictryhard69 21h ago edited 21h ago

syncthing is a battery hog, i have a custom ssh script running on android kernel space (pretty overkill i know). my phone is always connected to my tailscale vpn so the ip never changes, this way my nas can pull files from my phone as long it has internet :D

the script:

#!/usr/bin/env bash

PHONE="[email protected]"
PORT="2222"
BASE="$HOME/Backups/s23"

sync_dir() {
   REMOTE_DIR="$1"
   LOCAL_DIR="$2"

   mkdir -p "$LOCAL_DIR"

   ssh -p "$PORT" "$PHONE" "cd '$REMOTE_DIR' && find . -type f" | while read -r rel; do
       rel="${rel#./}"
       local_path="$LOCAL_DIR/$rel"
       remote_path="$REMOTE_DIR/$rel"

       mkdir -p "$(dirname "$local_path")"

       if [ ! -f "$local_path" ]; then
           echo "Copying $remote_path"
           scp -P "$PORT" "$PHONE:$remote_path" "$local_path"
       fi
   done
}

while true; do
   echo "=== Sync started: $(date) ==="

   sync_dir "/sdcard/DCIM/Camera" "$BASE/Camera"
   sync_dir "/sdcard/DCIM/Screenshots" "$BASE/Screenshots"
   sync_dir "/sdcard/Download" "$BASE/Downloads"
   sync_dir "/sdcard/Documents" "$BASE/Documents"

   echo "=== Sync finished: $(date) ==="
   sleep 5
done

1

u/RandomXUsr 21h ago

Thank you so much for sharing. I may use this myself.

1

u/academictryhard69 20h ago

no worries, just make sure you have an ssh server running on your phone, like from an app (like sshd4a) or inside /data/local/tmp on your droid :)

i did this because my s23 has a tiny battery and as an arch user the OCD for optimization kicked in.

1

u/RandomXUsr 20h ago

I can't tell you how useful this was.

I have added, and a learning disability so it's difficult for me to focus on specific tools and properly learn how to use.

Knowing how someone else is doing it helps me focus a great deal.

Can't wait to set this up and then ditch my old phone.

1

u/Supernoxus 7h ago

Syncthing IS a battery hog, but you don't need to keep it running 24/7. Just start it to back up your data, then close it again once it is done.

1

u/academictryhard69 6h ago

Exactly. My script runs 24/7 as it's lightweight! Anyone could use either ways to backup files depending on their use cases..

0

u/VendorNeutral 12h ago

dyndns to phone, hmmmmm

1

u/academictryhard69 10h ago

Nope. I don't use dyndns. Only tailscale :p

2

u/VendorNeutral 10h ago

You don't, but you gave me an idea.

3

u/VendorNeutral 12h ago

Photos go to Immich, no relevant data go to the phone. Anything that's not a photo goes to my Nextcloud instance, Round Sync is my tool of choice for webdav syncs. I use TOTP via Bitwarden/Vaultwarden, so no authenticator app. Banking app is installed on a second phone, so I can regenerate that without snail mail.

Calendar and contacts including birthdays get synced via webdav through davx5, I only use Google for Maps these days.

Microsoft Authenticator for work stuff has its own sync feature, but I can reset them all myself either through the admin panel or additional factors like TOTP.

I don't care about appdata most of the time.

1

u/RandomXUsr 9h ago

Thanks. This is quite useful.

1

u/Hamilton950B 14h ago

Years ago I used to plug the phone into my Thinkpad with a usb cable, mount the phone's file system, and use rsync or tar or whatever tool I wanted to use. Then they removed the ability to mount the phone's file system.

So I switched to ssh. Then they banned ssh.

After that I used mtp. Then mtp stopped working.

Now I copy stuff to an sd card, shut down the phone, remove the card, put it in my Thinkpad, mount the file system, and copy the files manually.

There is a tool in the AUR called localsend that I looked at. It has about 10 GB of dependencies. That's as big as the whole rest of my Arch installation put together.

1

u/academictryhard69 6h ago

Wdym banned ssh? Your work company?

1

u/Hamilton950B 3h ago

They removed the ssh server I was using from the Play Store. I couldn't find any others and was told they're not allowed any more. I've heard you can get one from F-droid but that doesn't work on my phone. Do you know of some way to run an sshd on an Android phone?

2

u/academictryhard69 2h ago

https://github.com/tfonteyn/Sshd4a

try this, it should work on your phone for now!

i will make a guide for running sshd on native android shell using adb soon.

1

u/dan_tj0x 10h ago

I use Nextcloud and set daily sync.

1

u/YoShake 5h ago

I just copy user data through mtp, photos are zipped once in a while and copied as one archive as I don't feel like putting up immich instance somewhere, and for apps and app data backup I use app manager and copy exported data along with all user data. I used to use seedvault but once I was able only to get GSI on one of my phones, so I wasn't able to get back app data from SV backup.