How can I backup the storage of an Android phone connected via USB?

Hi there,

I’m using Duplicati - 2.0.6.104_canary_2022-06-15 on Windows 10.
And I would like to backup the (accessible) storage of my (non rooted) smartphone (Fairphone 4 with Android 11).

While connected to my PC via USB, I can see the storage in Explorer under This PC | Devices and Drives (maybe Windows uses a different translation, e.g. like in this image https://heise.cloudimg.io/width/1440/q75.png-lossy-75.webp-lossy-75.foil1/www-heise-de/imgs/71/2/2/0/5/9/3/3/01-28c281d5351bd362.png).
In Duplicati, it seems I can only select source drives with a letter. So I have already mounted the SMB storage of my Fritzbox router as Z:, but I can’t do this directly with this phone storage connected via USB.

Is it possible to use this storage as a backup source? (How?)
Or do I need to run an SMB server on my phone and mount this network storage as drive Y: via wifi?
Edit: In the meantime I had to learn, that this won’t do either. Without root Android listen only at port 1024+, but Windows strictly uses port 445 for SMB.

Your help is very welcome.

Greetings
Michael.

This probably has a lot of challenges, but here are some ideas to find a clearer yes/no status:

Can you see folders and files that you want? If so, can you right-click to get the path for them?
If there’s a path, you “might” be able to push it into Duplicati using Add a path directly box.

Before that, though, how well do typical Windows applications work when editing Android files?
Duplicati will want to open files and read through them (including attributes), write restores, etc.
Basically it needs to look like a largely normal file system, and I’m not sure you have enough…

Media Transfer Protocol is likely how you got in, but it’s a limited-ability special-purpose design.
Duplicati has no special support, but there’s a (possibly small) chance Windows allows enough.

Files Transmission using Media Transfer Protocol is one of the articles from a Windows backup
vendor that has MTP support in some of their products. I think File Explorer also supports MTP.
Google search also turned up “FreeFileSync supports MTP”, so maybe it can sync to Windows.

Basically, unless Duplicati can do it directly, you might be able to devise some indirect methods,
however I think there are other ways to backup Android that might be easier than using the PC.

1 Like

Yes and no. I can see the folders but a cannot get a path with RMB or [shift]+RMB.
And also copying the pseudo path from the explorer adress bar “This PC\Fairphone 4 5G\Internal shared memory\DCIM\” results in an warning message from Duplicati that this path doesn’t exist.

Your link to the MTP entry of wiki gives the answer, why:

Windows does not assign drive letters or UNC pathnames to devices connected via MTP; instead, they only appear as named devices in MTP-aware applications such as Windows Explorer. Compared to devices that implement USB mass storage, such devices cannot be accessed programmatically by scripts or normal Windows programs that depend on drive letters or UNC paths. Instead, files must be manipulated using Windows Explorer or applications with specially written MTP support.

And after reading your post and some facts about MTP, I think, that there’s no hope doing my android backups with Duplicati. Too bad, I would have liked to do that. I’ll have to look for a similar android app.

While it can’t be done directly, you should be able to do a CTRL+A (select all), CTRL+C (copy), move to a real folder on the PC, CTRL+V(paste) then run a backup of said real folder. Probably more manual than most would want but I’d rather have an occasional backup than none at all.

1 Like

This is the manual version of what I was suggesting of maybe finding a sync tool to keep a PC clone, however after giving one potential candidate I’m leaving it to the requestor to search more, if desired.

It seems like a good idea. One other issue may be that I’m not sure all of the Android FS is reachable with media transfer protocol, but some might matter less. It would be good to see what you can have.

1 Like

I would start by asking what exactly is “the storage”? I am copying files from my phone every day, before I manually launch backups on my Linux machine. But the “copying files” is a rather delicate operation. I had to write a script to handle the various cases.

My script only makes a copy if something relevant has changed on the phone. From some apps, I want individual files with a specific extension. On computer side, my script adds a timestamp (based on the file’s own age) to the old version, and removes older files with a timestamp before copying a new file from the phone. From some apps, I do not want individual files, but a zip file that contains a whole directory (like, pictures I’ve taken by my phone). This zip file I create on-the-fly, using phone as the source and a zip file on computer as the target. For some files, I also add a password in the same go. For some apps, I need the latest backup file that the app itself creates. For some apps, I need to add a timestamp to the backup file because the app doesn’t add one. And so on.

Do you want to harvest everything you can grab? What is everything?

2 Likes

@JimboJones Thanks, that’s the way I’m already doing it.
But I would prefer the direct way without coping hundreds of GB to disk, if this would be possible.
Seems not possible.

@ts678 I’ll try Syncthing the next days. I’m already using it for syncing a single folder with just e few files.

And no, though I couldn’t see any difference of folder structure between Windows Explorer and MiXplorer (Android), without root access one cannot see the whole file system (in Windows or even in Android).

@AimoE “the storage” is the complete (without root) accessible storage of my Android phone. Other than as UMS with MTP it’s not accessible in CMD or Powershell (or Duplicati). So I cannot use any scripts (and it’s not my profession to script, too ), though it sounds interesting.
I also cannot zip anything on-the-fly, because 7zip cannot see the phone storage via MTP.
Is it possible that you have an older phone which supports USB Mass Storage instead of only MTP?

Yes, I think it’s the easiest (but messiest) way for me.

My phone is a bit old, it has Android 7. Is that too old? I am preparing to switch to a new one, and hadn’t imagined that MTP would stop working for this purpose. Autch.

Have you tried SSH? I have used SSHelper in the past, but now it seems it won’t be maintained anymore.

IDK, but it seems. The Samsung Galaxy S6 Edge with Android 5 to 7 had no USB Mass Storage mode e.g. I doubt, you’ll find an actual smartphone that has.
Of course MTP has some advantages, but there are disadvantages, too, like no longer drive letters or UNC paths on the via USB connected PC.

No, and I won’t try an app, that maybe quit working with the next android update.
But I tried the SFTP (=SSH FTP) server included in MiXplorer. Bad I had issues with empty appearing folders in Windows explorer, that I didn’t like to solve that time.

For now I’m trying syncthing since yesterday. It’s a bit slow but seems stable. And it’ll sync only changed/new files. And (not that I need that, because Duplicati will do that) it can make versions while syncing changed files.