<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>porfirio's blog - mtp</title><link>https://porfiriopaiz.github.io/site/</link><description/><atom:link href="https://porfiriopaiz.github.io/site/feeds/mtp.rss.xml" rel="self"/><lastBuildDate>Sat, 21 Nov 2026 03:17:00 -0600</lastBuildDate><item><title>Backing Up an Android Device via MTP Using rsync on Fedora</title><link>https://porfiriopaiz.github.io/site/posts/2026/11/21/rsync-android-mtp-gvfs-fedora.html</link><description>&lt;p&gt;Standard &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt; cannot directly read &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;mtp://&lt;/span&gt;&lt;/tt&gt; URLs because &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;mtp://&lt;/span&gt;&lt;/tt&gt; is
a &lt;strong&gt;GVfs (GNOME Virtual File System)&lt;/strong&gt; abstraction rather than a POSIX
filesystem path. Since &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt; requires direct access to a real filesystem
mount point, you must target the underlying directory where GNOME mounts MTP
devices inside &lt;tt class="docutils literal"&gt;/run/user/&lt;/tt&gt;.&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;div class="section" id="step-1-locate-the-local-gvfs-mount-point"&gt;
&lt;h2&gt;Step 1: Locate the Local GVfs Mount Point&lt;/h2&gt;
&lt;p&gt;Open a terminal on &lt;tt class="docutils literal"&gt;taylor&lt;/tt&gt; and list the active GVfs mounts:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ls&lt;span class="w"&gt; &lt;/span&gt;-la&lt;span class="w"&gt; &lt;/span&gt;/run/user/&lt;span class="nv"&gt;$UID&lt;/span&gt;/gvfs/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will see a directory name starting with &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;mtp:host=...&lt;/span&gt;&lt;/tt&gt;, corresponding
to your connected Android device (such as a Motorola ThinkPhone):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;mtp:host=motorola_ThinkPhone_by_motorola_ZY22H4FF5S/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To access the internal storage directly, the full POSIX path on your
filesystem takes the following structure:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;/run/user/&lt;span class="nv"&gt;$UID&lt;/span&gt;/gvfs/mtp:host&lt;span class="o"&gt;=&lt;/span&gt;motorola_ThinkPhone_by_motorola_ZY22H4FF5S/Internal&lt;span class="w"&gt; &lt;/span&gt;shared&lt;span class="w"&gt; &lt;/span&gt;storage
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;hr class="docutils" /&gt;
&lt;div class="section" id="step-2-run-rsync-against-the-gvfs-path"&gt;
&lt;h2&gt;Step 2: Run rsync Against the GVfs Path&lt;/h2&gt;
&lt;p&gt;Because MTP operates over a USB protocol that does not support Linux file
permission bits (&lt;tt class="docutils literal"&gt;chmod&lt;/tt&gt;), file ownership (&lt;tt class="docutils literal"&gt;chown&lt;/tt&gt;), or symbolic links,
running standard &lt;tt class="docutils literal"&gt;rsync &lt;span class="pre"&gt;-a&lt;/span&gt;&lt;/tt&gt; (&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--archive&lt;/span&gt;&lt;/tt&gt;) will trigger &lt;tt class="docutils literal"&gt;Operation not
permitted&lt;/tt&gt; errors.&lt;/p&gt;
&lt;p&gt;Instead, use the &lt;strong&gt;`-rtvP`&lt;/strong&gt; flags (recursive, preserve times, verbose,
progress) and wrap the source path in double quotes to handle spaces and
special characters (&lt;tt class="docutils literal"&gt;:&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;=&lt;/tt&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;-rtvP&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/run/user/&lt;/span&gt;&lt;span class="nv"&gt;$UID&lt;/span&gt;&lt;span class="s2"&gt;/gvfs/mtp:host=motorola_ThinkPhone_by_motorola_ZY22H4FF5S/Internal shared storage/&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;/home/porfirio/antares/
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;Adding a trailing slash (&lt;tt class="docutils literal"&gt;/&lt;/tt&gt;) at the end of &lt;tt class="docutils literal"&gt;&amp;quot;Internal shared
storage/&amp;quot;&lt;/tt&gt; copies the &lt;strong&gt;contents&lt;/strong&gt; of your internal storage directly
into &lt;tt class="docutils literal"&gt;/home/porfirio/antares/&lt;/tt&gt; (e.g., &lt;tt class="docutils literal"&gt;DCIM&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;Download&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;Pictures&lt;/tt&gt;). If you omit the trailing slash on the source path, all
contents will be placed inside a parent subdirectory named &lt;tt class="docutils literal"&gt;Internal
shared storage&lt;/tt&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="flag-breakdown"&gt;
&lt;h3&gt;Flag Breakdown&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;strong&gt;`-r` (`--recursive`):&lt;/strong&gt; Recurses into all subdirectories (&lt;tt class="docutils literal"&gt;DCIM&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;Download&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;Pictures&lt;/tt&gt;, etc.).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;`-t` (`--times`):&lt;/strong&gt; Preserves original file modification timestamps.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;`-v` (`--verbose`):&lt;/strong&gt; Displays files as they transfer.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;`-P` (`--partial --progress`):&lt;/strong&gt; Displays a real-time progress bar for
large transfers and retains partially transferred files so interrupted
transfers can resume cleanly.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr class="docutils" /&gt;
&lt;div class="section" id="step-3-handling-connection-drops-and-mtp-timeouts"&gt;
&lt;h2&gt;Step 3: Handling Connection Drops and MTP Timeouts&lt;/h2&gt;
&lt;p&gt;MTP connections over USB can occasionally stall or drop during large file
transfers. If the process hangs or disconnects midway, simply re-run the
exact same &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt; command.&lt;/p&gt;
&lt;p&gt;Because timestamps are preserved via &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-t&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt; will compare file
sizes and modification times, skip identical files that were already copied
completely, and resume right where it left off.&lt;/p&gt;
&lt;/div&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Porfirio Páiz</dc:creator><pubDate>Sat, 21 Nov 2026 03:17:00 -0600</pubDate><guid>tag:porfiriopaiz.github.io,2026-11-21:/site/posts/2026/11/21/rsync-android-mtp-gvfs-fedora.html</guid><category>floss</category><category>android</category><category>backup</category><category>cli</category><category>fedora</category><category>gvfs</category><category>mtp</category><category>rsync</category></item></channel></rss>