<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Backup – Yeri Tiete</title>
    <link>https://yeri.be/tag/backup/</link>
    <description>Yeri Tiete&#39;s blog</description>
    <language>en</language>
    <copyright>© Yeri Tiete</copyright>
    <lastBuildDate>Tue, 03 Jan 2023 03:02:59 +0100</lastBuildDate>
    <atom:link href="https://yeri.be/tag/backup/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Mounting a whole disk with partitions</title>
      <link>https://yeri.be/mounting-a-whole-disk-with-partitions/</link>
      <pubDate>Tue, 03 Jan 2023 03:02:59 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/mounting-a-whole-disk-with-partitions/</guid><enclosure url="https://static.yeri.be/2023/01/mounting-a-hard-disk.jpg" length="0" type="image/jpeg" />
      <description>&lt;p&gt;I reinstalled one of my RPis (moving from 32 to 64 bit). &lt;/p&gt;&#xA;&lt;p&gt;Before doing the full reinstall, I took a dump (&lt;code&gt;dd&lt;/code&gt;) of my disk. &lt;/p&gt;&#xA;&lt;p&gt;Usually, I create one per partition, but this was the &lt;a href=&#34;https://yeri.be/tag/christmas-card&#34;&gt;Christmas season&lt;/a&gt;, and I was half occupied with feasting and half occupied with entertaining &lt;a rel=&#34;noreferrer noopener&#34; href=&#34;https://ila.tw/&#34; target=&#34;_blank&#34;&gt;Ila&lt;/a&gt;. So, mistakes were made. &lt;/p&gt;&#xA;&lt;p&gt;I ran &lt;code&gt;dd if=/dev/sdb of=backup.img&lt;/code&gt; -- but this means I can&#39;t mount the disk directly, as it&#39;s not a partition:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://static.yeri.be/2023/01/mounting-a-hard-disk.jpg" alt="Mounting a whole disk with partitions"></p><p>I reinstalled one of my RPis (moving from 32 to 64 bit). </p>
<p>Before doing the full reinstall, I took a dump (<code>dd</code>) of my disk. </p>
<p>Usually, I create one per partition, but this was the <a href="https://yeri.be/tag/christmas-card">Christmas season</a>, and I was half occupied with feasting and half occupied with entertaining <a rel="noreferrer noopener" href="https://ila.tw/" target="_blank">Ila</a>. So, mistakes were made. </p>
<p>I ran <code>dd if=/dev/sdb of=backup.img</code> -- but this means I can't mount the disk directly, as it's not a partition:</p>
<pre class="wp-block-code"><code># mount backup.img /tmp/disk
mount: /tmp/disk: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.</code></pre>
<p>I should've dd'd /dev/sdb2 instead of the entire disk. </p>
<p>All right, so let's figure out what can be done... First, let's look at the content of the image:</p>
<pre class="wp-block-code"><code># fdisk -l backup.img
Disk backup.img: 111.8 GiB, 120040980480 bytes, 234455040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8297a463

Device          Boot  Start      End  Sectors  Size Id Type
backup.img1 *      8192   532479   524288  256M  c W95 FAT32 (LBA)
backup.img2      532480 34078199 33545720   16G 83 Linux</code></pre>
<p>So, we can probably mount starting from sector <code>532480</code>. </p>
<p>We can see that the sector size is 512 (which, I think, is the default for most). So, if we multiply <code>512 * 532480</code> we get <code>272629760</code>.</p>
<p>Now we can mount the disk using the following command:</p>
<pre class="wp-block-code"><code>mount -o loop,offset=272629760 backup.img /tmp/disk</code></pre>
<p>And that should do it. </p>
<p>The 2nd partition (the one with data) is now mounted and accessible under <code>/tmp/disk</code>. </p>
<p>If you need the first partition, the same can be done by running <code>512 * 8192 = 4194304</code>; the following command mounts the boot partition: </p>
<pre class="wp-block-code"><code>mount -o loop,offset=4194304 backup.img /tmp/disk.</code></pre>
]]></content:encoded>
      <category>errors</category><category>linux</category><category>software</category>
      <category>backup</category><category>raspberrypi</category>
    </item>
    
    <item>
      <title>Unable to complete backup. An error occurred while creating the backup folder.</title>
      <link>https://yeri.be/unable-to-complete-backup-an-error-occurred-while-creating-the-backup-folder/</link>
      <pubDate>Wed, 22 May 2013 16:30:18 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/unable-to-complete-backup-an-error-occurred-while-creating-the-backup-folder/</guid>
      <description>&lt;p&gt;5 or so days ago, this error suddenly popped up:&lt;/p&gt;&#xA;&lt;pre&gt;Unable to complete backup. An error occurred while creating the backup folder.&lt;/pre&gt;&#xA;&lt;p&gt;I have a Raspberry Pi, &lt;a href=&#34;https://yeri.be/home-made-timemachine&#34;&gt;acting as TimeMachine&lt;/a&gt; (using afp/Bonjour/Netatalk).&lt;/p&gt;&#xA;&lt;p&gt;There are &lt;a href=&#34;https://discussions.apple.com/thread/3524877?start=15&amp;amp;tstart=0&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;several things&lt;/a&gt; I tried to solve this, including messing in the sparebundle from Linux (chowning) and deleting my &lt;a href=&#34;http://pondini.org/TM/A4.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;TM .plist&lt;/a&gt;. This probably messed up my backup a bit.&lt;/p&gt;&#xA;&lt;p&gt;But what seemed to &amp;lsquo;solve&amp;rsquo; it for me was:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>5 or so days ago, this error suddenly popped up:</p>
<pre>Unable to complete backup. An error occurred while creating the backup folder.</pre>
<p>I have a Raspberry Pi, <a href="https://yeri.be/home-made-timemachine">acting as TimeMachine</a> (using afp/Bonjour/Netatalk).</p>
<p>There are <a href="https://discussions.apple.com/thread/3524877?start=15&amp;tstart=0" target="_blank" rel="noopener noreferrer">several things</a> I tried to solve this, including messing in the sparebundle from Linux (chowning) and deleting my <a href="http://pondini.org/TM/A4.html" target="_blank" rel="noopener noreferrer">TM .plist</a>. This probably messed up my backup a bit.</p>
<p>But what seemed to &lsquo;solve&rsquo; it for me was:</p>
<ol>
    <li><span style="line-height: 13px;">Start a backup manually (it will fail after a minute or two with the above mentioned error)</span></li>
    <li>Open finder, and go to the now mounted disk</li>
    <li>In my case, there was a &lt;date&gt;.inProgress file
<a href="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.32.19.png">
<img class="alignnone size-full wp-image-5065 aligncenter" alt="Screen Shot 2013-05-22 at 15.32.19" src="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.32.19.png" width="794" height="460" /></a></li>
    <li>If TimeMachine mounted the share for you, you will have write access (see notes below)</li>
    <li>Delete the inProgress file</li>
    <li>Empty your trash</li>
    <li>It should be gone:
<p><em id="__mceDel" style="text-align: center;"><a href="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.43.13.png"><img class="alignnone size-full wp-image-5069 aligncenter" alt="Screen Shot 2013-05-22 at 15.43.13" src="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.43.13.png" width="230" height="383" /></p>
<p></a></em></li>
<li>Unmount everything</li>
<li>Try backing up again</li></p>
</ol>
<p>In my case it changed to this error, which happens to me every so often due to corrupt backups (loss of network (because the drive is on VPN, and when I connect to my VPN Mac starts backing up, eventhough I actually don&rsquo;t really need/want that, it just happens to find the LAN), sleeping at the wrong moment, and Apple just generally not supporting DIY-TimeMachine). So this does mean I have to start from scratch anyhow&hellip; :(</p>
<p><a href="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.58.35.png"><img class="alignnone size-full wp-image-5070 aligncenter" alt="Screen Shot 2013-05-22 at 15.58.35" src="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.58.35.png" width="423" height="257" /></a></p>
<p><em>Notes</em>: I&rsquo;ve tried to manually mount the afp or smb share first, and open  the .sparebundle myself via finder.</p>
<p>Like this:</p>
<p style="text-align: center;"><a href="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.45.04.png"><img class="alignnone size-full wp-image-5067 aligncenter" alt="Screen Shot 2013-05-22 at 15.45.04" src="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.45.04.png" width="424" height="134" /></a></p>
<p style="text-align: center;"><a href="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.45.04.png"></a><a href="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.43.21.png"><img class="alignnone size-full wp-image-5068" alt="Screen Shot 2013-05-22 at 15.43.21" src="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.43.21.png" width="222" height="164" /></a></p>
<p>However, both via Finder as via terminal (including sudo) gave permission errors (partly reading, mostly writing) such as:</p>
<p><a href="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.32.38.png"><img class="alignnone size-full wp-image-5066 aligncenter" alt="Screen Shot 2013-05-22 at 15.32.38" src="https://static.yeri.be/2013/05/Screen-Shot-2013-05-22-at-15.32.38.png" width="410" height="134" /></a></p>
]]></content:encoded>
      <category>apple</category><category>errors</category><category>linux</category><category>networking</category><category>software</category>
      <category>backup</category>
    </item>
    
    <item>
      <title>Home made TimeMachine</title>
      <link>https://yeri.be/home-made-timemachine/</link>
      <pubDate>Sat, 23 Mar 2013 04:01:21 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/home-made-timemachine/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://www.bootc.net/archives/2010/11/07/apple-time-machine-and-netatalk/&#34; target=&#34;_blank&#34;&gt;This&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Used my Raspberry Pi, with an USB disk as TimeMachine. Another disk as NAS/storage. It&amp;rsquo;s just quite slow&amp;hellip; Not sure whether it&amp;rsquo;s my WiFi or RPi that can&amp;rsquo;t keep up.&lt;/p&gt;&#xA;&lt;p&gt;But for now, it&amp;rsquo;s working.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><a href="http://www.bootc.net/archives/2010/11/07/apple-time-machine-and-netatalk/" target="_blank">This</a>.</p>
<p>Used my Raspberry Pi, with an USB disk as TimeMachine. Another disk as NAS/storage. It&rsquo;s just quite slow&hellip; Not sure whether it&rsquo;s my WiFi or RPi that can&rsquo;t keep up.</p>
<p>But for now, it&rsquo;s working.</p>
]]></content:encoded>
      <category>apple</category><category>hardware</category><category>linux</category><category>networking</category><category>software</category>
      <category>backup</category><category>raspberrypi</category>
    </item>
    
    <item>
      <title>Rsync backups</title>
      <link>https://yeri.be/rsync-backups/</link>
      <pubDate>Mon, 25 Feb 2008 21:14:37 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/rsync-backups/</guid>
      <description>&lt;p&gt;My own simple rsync backup &amp;lsquo;script&amp;rsquo;.&lt;/p&gt;&#xA;&lt;p&gt;You&amp;rsquo;ll need a rsync server, something to backup, and ssh-agent running to ease the process (or, fill in your password each time).&lt;/p&gt;&#xA;&lt;p&gt;Add the following lines (using a terminal text editor) to a text file (&amp;quot;.rsync&amp;quot; for example, hidden files under Unix-like systems), and chmod +x $file.&lt;/p&gt;&#xA;&lt;pre line=&#34;1&#34; lang=&#34;bash&#34;&gt;rsync --archive -uv --exclude-from=/home/you/.rsync_exclude \&#xA;--rsh=&#34;ssh -p 222&#34; --delete --stats --progress /Users/you/Documents/ \&#xA;you@remost.host.com:/home/you/remote-backup-directory&lt;/pre&gt;&#xA;&lt;p&gt;This will upload any files in /Users/you/Documents to /home/you/remote-backup-directory.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>My own simple rsync backup &lsquo;script&rsquo;.</p>
<p>You&rsquo;ll need a rsync server, something to backup, and ssh-agent running to ease the process (or, fill in your password each time).</p>
<p>Add the following lines (using a terminal text editor) to a text file (&quot;.rsync&quot; for example, hidden files under Unix-like systems), and chmod +x $file.</p>
<pre line="1" lang="bash">rsync --archive -uv --exclude-from=/home/you/.rsync_exclude \
--rsh="ssh -p 222" --delete --stats --progress /Users/you/Documents/ \
you@remost.host.com:/home/you/remote-backup-directory</pre>
<p>This will upload any files in /Users/you/Documents to /home/you/remote-backup-directory.</p>
<p>It will use ssh on port 222 to transfer the files.</p>
<p>Just execute ./.rsync (if that&rsquo;s the name of your file) to run it.</p>
<p>If you make any  changes (locally), and run this, the changes will be applied on the remote server (e.g. file changes, renames, deletes, &hellip;) &ndash; this will delete files on the remote server if you&rsquo;ve deleted them locally!</p>
<p>The file .rsync_exclude is optional, it includes all files or directories that should NOT be uploaded</p>
<p>This is what I have in my .rsync_exclude:</p>
<pre line="1" lang="bash">Nazgul:~ yeri$ cat .rsync_exclude
Parallels/*</pre>
<p>Simple as hell, and yet so handy!</p>
]]></content:encoded>
      <category>apple</category><category>linux</category><category>software</category>
      <category>backup</category><category>rsync</category><category>ssh</category>
    </item>
    
  </channel>
</rss>
