Linux rsync into Android (termux)

very long story happend to me today would take days to be written to sync my massive media dir to be 1:1 with my android phone usually I used jmtpfs it’s good but I had to mess with udev rules for kernel usb autosuspend (not configured on archlinux by default) and more headaches until I came to

  • rsync
  • sshfs
  • sshd (termux)

I would simply move and delete files around after while sync them to my android phone over network for destination to be 1:1 as my source directory

on my phone with termux :

# if openssh not install
# pkg install openssh
# set a user password with passwd
passwd
sshd
#default port is 8022 not 22 because Android's security rules block normal apps from using any port number below 1024

from my archlinux pc :

# now i mount my phone using sshfs over sftp
sshfs [email protected]:/sdcard/ phone/ -p 8022
# and simply rsync my media direction
rsync -av --size-only --partial --delete /mnt/base/mcore/ phone/mcore/

that’s saved much of my time around 3000 files get removed added automatically
with the help of rsync

also special thanks for @hydn for his amazing blog about rsync it helped me understanding it better


3 Likes

Cool, I’ve never thought about using rsync for my smartphone.

I’ve been using Syncthing for ages to synchronise my computer, smartphones and tablets.

Thanks for sharing!

1 Like

If you want to go the application route there is copyparty on github.
It supports phones also.

1 Like