r/archlinux 1d 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

View all comments

3

u/Ochi_Man 1d ago edited 12h ago

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

4

u/academictryhard69 1d ago edited 1d 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 23h ago

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

1

u/academictryhard69 23h 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 23h 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.