Support for MTP as source for backup

I’d like to request a feature of allowing Media Transport Protocol as a data source. This seems to be what modern smart phones use when you connect them via USB.

There is already a topic on this, but not a direct feature request:

Put simply, many people would like to backup their phones and this would make it easier.

Many thanks

You likely mean Media Transfer Protocol (Wikipedia link with an overview – actual spec may be here).

Current status seems to be there’s a 2011 spec and various buggy implementations (search the web).
There’s roughly no chance of Duplicati fixing things at the driver level – besides, wires are out of style.

and you can see my concern and that of others (see Wikipedia too) that this is not a normal filesystem. Confirming that is the spec at the linked site, where they don’t appear to allow partial write, unlike read.
Don’t forget about restore. Duplicati restores by patching blocks into the destination as is seen needed.

There are some schemes that attempt to make a file transfer protocol work more like conventional files.
rclone mount can do this, but with Limitations which make random write (see above) more complicated.

Doing a restore might require staging it locally first (maybe all of it), doing restore, then pushing it back. Sometimes rclone is a nice way to do such moves, but they appear reluctant to get into MTP either…

Add MTP (Media Transfer Protocol or Most Terrible Protocol) support #6175

Device security is getting very tight too. I think this interferes even with apps that are on the device, but apps on the device might be another option to do phone backup. I’m pretty sure they exist (try search).

That’s what I used to use. My last Android file transfer used Nearby Share which might be like AirDrop.

Many people would like basic backup performance and reliability to be improved. See forum.
Asking is fine, but ability to do major feature requests right now is limited by volunteer levels.

Beyond what I’ve said so far, maybe someone else (or the web) can suggest phone backup.
Phone OS (e.g. Android or iOS) often gives a basic one, but I haven’t looked for fancy ones.

Thanks for this thoughtful reply (much more thoughtful than my request), which did not even manage to quote the protocol name correctly.

I see how hard it is now, a bit of a shame that MTP was not created to permit block level updates or appends. I think it could have been written to cope with disconnects if a file was not fully written. I have found some backup apps for the phone (though no good prospect of an Android Duplicati), also I’d probably need to connect the phone up differently or write to a different destination through these techniques. There is just an elegance of having a Swiss Army knife solution for backcup, which Duplicati initially seemed to be when looking at all the targets it can write to.



1 Like

Developer documentation

The backends encapsulate the actual communication with a remote host with a simple abstraction, namely that the backend can perform 4 operations: GET, PUT, LIST, DELETE. All operations performed by Duplicati relies on only these operations, enabling almost any storage to be implemented as a destination.

This includes object storage (common in cloud storage) because it uses very universal capabilities.

The Source side is handled in detail by design, recording metadata such as times and permissions, reading through files a block at a time to spot recent changes, dealing with things such as links, etc.

Generally, it runs best when the Source is local, even though some file-like things that use networks underneath can sometimes be handled. NFS and SMB would be ones that give pretty good abilities, however speed is probably worse, and compexity can add issues. Getting into other things such as backing up a cloud server over SFTP or something gets into the need-simulated-filesystem problem.

People do ask, and it’s a valid need. It just doesn’t fit Duplicati’s asymmetric Source and Destination.
Rclone is even more of a Swiss Army knife, but sadly they don’t seem to want to go into MTP either.

If you can find something that would satisfactorily do the file moving (ideally a simulated filesystem), possibly this can be sort of pulled off, but IIRC the USB drivers (e.g. in Windows) have problems too.

While wondering if rclone could pull this off, I searched in Google for “rclone” “mtp”. I posted first hit.
Why is MTP such a horrible piece of technology, especially on Linux? was its second, but had some comments that might be useful. If not, there might be an answer somewhere that someone can find.


I found payware ($49.95 per user) that may help, someone seeking freeware, and more complaints.

Duplicati is currently written for .NET Framework and mono (putting the portability burden on mono).
Some advanced Source abilities get beyond what those can do, so wind up getting into native code, which can still be portable if it’s on the system (e.g. Windows) already. I think AlphaFS provides that.

MediaDevices is another open source API, saying it wraps the native Windows MTP COM interface, specifically noting that it doesn’t work on Linux and Mac. Once you leave portable code, life is tough.

Media Transfer Protocol at Arch Linux gives some Linux ideas, while noting it’s messy and variable.

In comparison, the Duplicati network based destinations are almost all standard portable TCP code.
Storj DCS is an exception, but the native code (x64 and x86 – no ARM yet) was provided by others.