Android backup using MTP
TL/DR Fast way to backup an android device on Linux using the USB cable, MTP and rsync
Media Transfer Protocol is available on most Android devices as the primary method for USB synchronization. On Linux there are several implementations of MTP on top of libmtp.
On Nexus 5 both mtpfs and jmtps were extremely slow copying files. On this device, go-mtpfs had the best performance by far copying 9gb of data, but your mileage may vary.
Assuming that you have go-mtpfs
and rsync
installed and the device is
connected:
mkdir -p ~/mnt ~/backup
go-mtpfs ~/mnt &
rsync -rP ~/mnt ~/backup
fusemount -u ~/mnt
-rP
on rsync stands for recursive and with progress. It’s worth checking the
documentation for additional flags that might be useful to you. -c
can be
used for recurrent backups to avoid copying files already on disk by computing
their checksum.