<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Minecraft on mapletree.moe</title><link>https://mapletree.moe/tags/minecraft/</link><description>Recent content in Minecraft on mapletree.moe</description><generator>Hugo -- 0.160.1</generator><language>en-us</language><copyright>This work is licensed under the MIT0 License.</copyright><lastBuildDate>Fri, 14 Oct 2016 03:00:00 -0500</lastBuildDate><atom:link href="https://mapletree.moe/tags/minecraft/index.xml" rel="self" type="application/rss+xml"/><item><title>Collegi Backup - Work Notes</title><link>https://mapletree.moe/posts/collegi-backup-work-notes/</link><pubDate>Fri, 14 Oct 2016 03:00:00 -0500</pubDate><author>bakayuki</author><guid>https://mapletree.moe/posts/collegi-backup-work-notes/</guid><description>&amp;lt;no value&amp;gt;</description><content type="text/html" mode="escaped"><![CDATA[<p><strong>EDIT (2026/04/25):</strong> <em>Collegi has been discontinued for quite a while now, the
below information is still broadly useful, however, so it is maintained.
However, I have switched from borg to another software called Kopia.</em></p>
<h1 id="collegi-minecraft-server-series">Collegi Minecraft Server Series<a href="#collegi-minecraft-server-series" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li><a href="/posts/collegi-backup-system">Collegi Pixelmon Server Backup</a></li>
<li><a href="/posts/collegi-backup-part-2">Collegi Backup System: Part 2</a></li>
<li>Collegi Backup Work Notes <strong>(You are here.)</strong></li>
</ul>
<p>The following post is an extreme rough draft. In fact, it isn&rsquo;t even actually a
post. These are my development notes from my refactoring of the collegi data
infrastructure. As such, they&rsquo;re arranged in no real sensible order besides
having been written chronologically. Additionally, these have not been
proofread, grammar checked, copyedited, or spell checked, as i write them in an
IDE and not an actual text editor. As such, please don&rsquo;t judge my writing
ability off of them. More importantly, however, these do not have the
standardized links that i provide to new concepts or commands in my blog posts,
as embedding links to things I already know or have access to in a developer log
that on average no one else sees just seems silly.</p>
<p>So, if you have questions, use google, and expect these to be updated over time.</p>
<p>The logs as of this posting run from 10/13/2016 to 10/16/2016, so over three
days of work. There is a -LOT- more to be done.</p>
<p>They are broken down into the following format. Each list is a set of specific
actions I took, and sometimes the list ends up with notes in it because, again,
no one generally sees these, but under the task list is the space reserved for
notes on the above list. Then a new task list is declared, then notes, then
tasks, and so on and so forth. Generally each new task heading would signify
a new blog post, talking about the tasks and the notes, so keep that in mind.</p>
<p>These were requested by Kan, a player on our server. Enjoy!</p>
<h1 id="tasks---part-1">Tasks - Part 1<a href="#tasks---part-1" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li>Made a backup of the repository as it stood on 2016-10-13 in the event
anything breaks too badly during this.</li>
<li>Removed all existing submodules from the <code>git</code> repository. Committed the
removal.</li>
<li>Ran the previous backup script to make sure that 10/13 was backed up. This
included new additions to git annex.</li>
<li>Forced git annex to drop the old SHA256E key-value backend files that were
made obsolete by the conversion to SHA512E key-value backend.</li>
</ul>
<p><strong>Notes 1:</strong> During this time, and while watching the way the version 1.0
backup script ran, I noticed there is a significant performance penalty for
moving the location of the local mirror. Borg uses the entire path as the file
name, so any deviation in the path spec causes it to treat the files as brand
new. Note that this does not cause any issues with de-duplication, but the
process of adding these files causes a massive performance hit. This made me
start thinking about including the local mirror in the git annex so that as
long as the annex was kept in tact in regards to metadata, the paths would
remain the same as all additions to Borg would take place from the same root
directory.</p>
<p><em>The problem with this would be the fact that annex keeps everything as
symlinks. As such, I am looking into the unlock feature of version six
repositories.</em></p>
<p><strong>Notes 2:</strong> Dropping unused from a local area goes -much- faster than
dropping from remote. Who knew, right?</p>
<h1 id="tasks---part-2">Tasks - Part 2<a href="#tasks---part-2" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li><code>git-Annex</code> drop completed, but Finder isn&rsquo;t showing a reduction in used
drive space, but I think this is more an error on the side of finder than
something with git annex, as <code>du -h</code> showed the directory was down to the
size it should have been. Once I manage to get this finder thing figured out,
I&rsquo;ll move on to the next part.</li>
<li>Finder is taking too bloody long to figure its shit out, so I moved on to
the next step in cleaning up the repository. I&rsquo;m rewriting the commit history
to completely remove files I don&rsquo;t need from the actual <code>git</code> repo. In theory
this shouldn&rsquo;t touch <code>git-annex</code> at all, but that remains to be seen.</li>
<li>Ran BFG Repo Cleaner on the following directories and files:
<ul>
<li>collegi.web</li>
<li>collegi.pack</li>
<li>collegi.git</li>
<li>.DS_Store</li>
<li>.gitmodules</li>
<li>collegi.logs (Just for a moment, and we made backups.)</li>
<li>collegi.configs</li>
</ul>
</li>
<li>Ran filter branch to purge any empty commits left after the above.</li>
<li>Expired original ref-logs, repacked archive.</li>
</ul>
<p><strong>Notes 3:</strong> At this point we had gone from 230 commits to 102 commits. We were
also left with the original envisioning of what this repo would be, which was
a simple git annex to push files to Backblaze b2 from the Borg repository. Now
to verify that all of our data is still 100% ok.</p>
<h1 id="tasks---part-3">Tasks - Part 3<a href="#tasks---part-3" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li>Ran <code>git fsck</code></li>
<li>Ran <code>git annex fsck</code></li>
</ul>
<p><strong>Notes 4:</strong> Wow this is going to take a long fucking time. Who woulda thunk
it.</p>
<p><strong>Notes 5:</strong> So apparently the current version of <code>git-annex</code> is using the old
mixed hashing method, which is a format that &ldquo;we would like to stop using&rdquo;
according to the wiki. Might need to migrate. Need to figure out how.</p>
<p><strong>Notes 6:</strong> From the wiki: &ldquo;Initial benchmarks suggest that going from
<code>xX/yY/KEY/OBJ</code> to <code>xX/yY/OBJ</code> directories would improve speed 3x.&rdquo; It&rsquo;s worth
migrating.</p>
<h1 id="tasks---part-4">Tasks - Part 4<a href="#tasks---part-4" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li>Run <code>git annex uninit</code></li>
<li>Reading through the <code>git-annex-init</code> man page to see what else we should
change now since we&rsquo;re already migrating. Post Uninit we&rsquo;re going to have to
run a full borg data consistancy check.</li>
</ul>
<p><strong>Notes 7:</strong> Ugh. The document I found was actually an theoretical one, and
while it is true that <code>git-annex</code> does use the new hashing format in bare
repositories there is no actual way to move to the new one in a regular repo.
So I am running an <code>uninit</code> for basically no reason. The only good thing about
this that I can think of is that I will be able to reform the final <code>git-annex</code>
repo in a much saner fashion. The bad news is that I have lost the log files,
unless <code>git-annex</code> is going to bring those back for me. I am annoyed.</p>
<p><strong>Notes 8:</strong> Good news! I just remembered that I had made a <code>rsyn</code>ced backup
of the repository before I started fucking with it. So I didn&rsquo;t actually lose
the log files, I just went ahead and pulled them out of the <code>git-annex</code>
backup.</p>
<h1 id="tasks---part-5">Tasks - Part 5<a href="#tasks---part-5" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li>After the git annex had uninitialized, I decided that if I was going to do
this whole damn thing over again I was going to do it right.</li>
<li>Started a new <code>borg</code> repository in new-collegi. Pulled out contents from the
original <code>borg</code> repository, using backups to restore any files that got hit in
the above clusterfuck, then recompressed with maximum LZMA compression.</li>
<li>During this period I also standardized how the <code>borg create</code> paths would
work. The server would exist within a collegi.mirror directory, and the entire
directory would be added to <code>borg</code> upon each run of the backup script. This
effectively means we never have to worry about the LZMA penalty discussed
below again after the first re-add, unless we do major server restructuring,
because paths will remain stable between commits.</li>
</ul>
<p><strong>Notes 9:</strong> The initial speed penalty for using LZMA is absolutely jaw
dropping. One <code>borg create</code> took eight hours to complete. Eight. However, I
quickly noticed that due to Borg&rsquo;s de-duplication mechanism, the add times got
faster the more data I added, and gzip-9 to lzma-9 did actually yield some
improvement. It also reduces the incentive for me to do this fucking disaster
again, because of how much it absolutely fucking sucks.</p>
<p><strong>Notes 10:</strong> As an example of what I mean by the above, the initial adding of
1.8.9 took six hours with LZMA-9. When the map was changed from NewSeed over to
Collegi, it took another four hours just to update the paths and what not, even
though the data hadn&rsquo;t updated, just the paths have changed. (This is indicated
by the fact that the total repository size barely increased, all the size that
changed could be explained by new metadata.) However, when the paths are kept
the same, adding 100GB of data takes 13 to 15 minutes. So, the benefit of
LZMA-9 is worth the initial startup, imho.</p>
<p><strong>Notes 11:</strong> <code>borg extract</code>ing from the GZIP-9 archives takes about 40
minutes, and that&rsquo;s from highly de-duplicated and GZIP-9 archives. What this
means is that pulling from an lzma-9 is probably going to take about an hour,
depending on just how de-duplicated the archive is (as in, how many different
chunk files contain parts needed to reassemble the original content).</p>
<p><strong>Notes 12:</strong> Have hit the series of backups where things have moved into the
Users path, and I&rsquo;m restructuring them. It made me think about how I will handle
the mirror directory in the future. I think I am going to do a few new things
with respect to the new setup. The mirror directory will be a part of the
<code>git-annex</code> repository, so there will be a new folder inside it called
<code>collegi.mirror</code> or something similar, and then I can move the new backup
script to be ran from the root directory, which will be beneficial. That way
everything is neatly packaged. the issue becomes mirroring this, because
uploading that much constantly changing data to backblaze would be literally
stupid, and not at all within our budget. What I will likely do is initialize
a &ldquo;bare repository&rdquo; on my time machine drive, and mirror the entirity of the
<code>git-annex</code> repository to that.</p>
<h1 id="mandatory-break-notes">Mandatory Break Notes<a href="#mandatory-break-notes" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li>You need to run borg info to make sure the latest creation thingy is the
proper size, and a borg check might not be a bad idea either as you fell
asleep and closed the mac during work on the repo.</li>
<li>Cleaned the time machine volume of the repeated backups of the new
repository because it doesn&rsquo;t make any sense to have 20 versions of it.</li>
<li>Moved the repo to the time machine drive as temporary storage using rsync.</li>
</ul>
<h1 id="tasks---part-6">Tasks - Part 6<a href="#tasks---part-6" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li>Restarted the transfer process starting on the 8th of October</li>
</ul>
<p><strong>Notes 13:</strong> Not a huge shock but running some of these commands across USB
2.0 can add anywhere from 10 to 30 minutes. Doing them cross device gets even
worse, with some transactions taking almost an hour.</p>
<p><strong>Notes 14:</strong> I&rsquo;ve been going back and forth on what filesystem I would like
to deploy since I am redoing the collegi drive as a whole. Now the interesting
thing to note here is that by the time I get this thing fully ready to deploy,
the drive I have here may not be the drive it ends up on, but this is as good
of a testbed as any. I&rsquo;m really thinking I will go with apfs. Most of the
gripes I have with it are easily resolved through borg and git annex.</p>
<p><strong>Notes 15:</strong> In a highly amusing turn of events, it is bigger in lzma 9 than
it was with gzip 9. weird.</p>
<p><strong>Notes 16:</strong> While it would likely be prudent to go back to the previous
compression method, the benefits that I have made to the directory structure
while redoing the borg repository are worth the few extra gigabytes of overhead
especially concerning with Backblaze B2 it barely costs a penny.</p>
<h1 id="tasks---part-7">Tasks - Part 7<a href="#tasks---part-7" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li>Use JHFSX for the new drive. I would have really liked to use APFS but I am
still worried about the data loss considering there is almost a year till it
will ship. JHFSX is reasonable enough for right now, while still being safe to
unplug.</li>
<li>I went round and round on using encryption on the new drive. did it.</li>
<li>using rsync to bring the data to its final resting location.</li>
<li>OK started setting things up</li>
<li>Defined gitlab as the metadata backup again</li>
<li>created a bare repository on skaia</li>
<li>set up prefered content so skaia requires everything in the main repo</li>
<li>set the main repo to require a &ndash;force to drop content via preferred content</li>
<li>Set the backend to SHA512E</li>
<li>began the long process of adding the data to the git-annex</li>
<li>Set up bin directory to not be tracked by git-annex but instead by git</li>
<li>added backblaze remote, not encrypted, with a proper prefix</li>
<li>started to sync to backblaze</li>
<li>noticed an issue with how the sync was going to gitlab, will correct.
<ul>
<li>corrected the issue</li>
</ul>
</li>
</ul>
]]></content></item><item><title>Collegi Pixelmon - Backup System Part 2</title><link>https://mapletree.moe/posts/collegi-backup-part-2/</link><pubDate>Thu, 13 Oct 2016 12:00:00 -0500</pubDate><author>bakayuki</author><guid>https://mapletree.moe/posts/collegi-backup-part-2/</guid><description>&amp;lt;no value&amp;gt;</description><content type="text/html" mode="escaped"><![CDATA[<p><strong>EDIT (2026/04/25):</strong> <em>Collegi has been discontinued for quite a while now, the
below information is still broadly useful, however, so it is maintained.
However, I have switched from borg to another software called Kopia.</em></p>
<h1 id="collegi-minecraft-server-series">Collegi Minecraft Server Series<a href="#collegi-minecraft-server-series" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li><a href="/posts/collegi-backup-system">Collegi Pixelmon Server Backup</a></li>
<li>Collegi Backup System: Part 2 <strong>(You are here.)</strong></li>
<li><a href="/posts/collegi-backup-work-notes">Collegi Backup Work Notes</a></li>
</ul>
<p>What was originally intended to be a one off blog post may become my new source
of material for the coming weeks. After utilizing <a href="https://github.com/borgbackup/borg" title="BorgBackup">BorgBackup</a> and
<a href="https://git-annex.branchable.com/" title="Git-Annex">git-annex</a> to backup what has now grown to almost <a href="https://twitter.com/Zyradyl/status/786205897810780160" title="Zyradyl's Twitter">2.5 Terabytes</a> of
data, I began to wonder what other ways I could put git-annex to use for us here
at <a href="https://collegi.enjin.com" title="Collegi Pixelmon Main Website">Collegi</a>. We already use various <a href="https://gitlab.com/" title="GitLab">GitLab</a> repositories to manage
different facets of the project, and I began to wonder if there wouldn&rsquo;t be some
way to use git-annex to completely unify those repositories and distribute their
information as needed.</p>
<p>This started as a brief foray into <a href="https://medium.com/@porteneuve/mastering-git-submodules-34c65e940407#.24xm3mdlt" title="Mastering Git Submodules">git submodules</a> which, while allowing me
to consolidate data <strong>locally</strong>, does nothing in helping me to properly
redistribute that data to various locations. The only way that it would be
possible to do such a thing would be to take all the various git repositories
that Collegi utilizes, which currently is sitting at <a href="https://gitlab.com/groups/collegi" title="GitLab: Collegi Group">six total</a>, including
the git-annex metadata repository (which isn&rsquo;t publicly visible), and merge them
into one master repository through the use of <a href="https://medium.com/@porteneuve/mastering-git-subtrees-943d29a798ec#.r5p4ozyfm" title="Mastering Git Subtrees">git subtrees</a>. This would
allow me to still have multiple repositories for ease of project management, but
all those repositories would be pulled down, daily, to a local &ldquo;master&rdquo;
git-annex repository and merged into it.</p>
<p>Once this was done, the use of git annex&rsquo;s <a href="https://git-annex.branchable.com/git-annex-preferred-content/" title="Git Annex: Preferred Content Manual Page">preferred content</a> system would
allow me to decide what data needed to be sent to which remote. This would let
me back up some information to one remote, and other information to another.
As an added bonus, the use of git subtrees would even allow me to push changes
back upstream, and all of it would be centralized.</p>
<p>In the future, this would allow us to push very specific data to specific team
members, who would then modify the data, which would be pulled back down on the
next git-annex sync, we would see changes needing to be pushed upstream had been
made, unlock those files, then use git subtree to push them back to their
remotes. That&rsquo;s the theory at least. As far as I am aware, either no one has
done this before, no one who has done this before has lived to tell the tale, or
no one who has done this before has blogged about their experiences in doing so.</p>
<p>That&rsquo;s where this blog comes in. I&rsquo;m currently in the process of making a
complete copy of the current root repository, which is still using git
submodules, and from there I can begin experimenting. Whether or not this works
remains to be seen, but it coincides neatly with a rewrite of the
<a href="https://gitlab.com/collegi/collegi-backup-automation" title="GitLab: Collegi Group - Backup Automation">backup script</a> to update it to Google Shell Style Guidelines, which means
I can build the script around the new repository layout, and while doing so I
should be able to head off any unforeseen issues.</p>
<p>It&rsquo;s very likely that I am going to finish writing 2.0 of the script before
doing any of this crazy shit, but this post helps me to organize my thoughts.
Besides, it just means 3.0 will be that much more exciting when it drops.</p>
<p>Stay tuned for more of my antics and adventures with making this absurd system
take shape, and turn into the omnipresent repository of every single facet of
a Minecraft community.</p>
]]></content></item><item><title>The Collegi Pixelmon Server Backup System</title><link>https://mapletree.moe/posts/collegi-backup-system/</link><pubDate>Sat, 01 Oct 2016 22:30:00 -0500</pubDate><author>bakayuki</author><guid>https://mapletree.moe/posts/collegi-backup-system/</guid><description>&amp;lt;no value&amp;gt;</description><content type="text/html" mode="escaped"><![CDATA[<p><strong>EDIT (2026/04/25):</strong> <em>Collegi has been discontinued for quite a while now, the
below information is still broadly useful, however, so it is maintained.
However, I have switched from borg to another software called Kopia.</em></p>
<h1 id="collegi-minecraft-server-series">Collegi Minecraft Server Series<a href="#collegi-minecraft-server-series" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li>Collegi Pixelmon Server Backup <strong>(You are here.)</strong></li>
<li><a href="/posts/collegi-backup-part-2">Collegi Backup System: Part 2</a></li>
<li><a href="/posts/collegi-backup-work-notes">Collegi Backup Work Notes</a></li>
</ul>
<p>Wow, time flies. It has been almost a year since I last updated this blog,
including fixing some of the issues that Jekyll 3.0 introduced in my formatting.
Luckily, that could be fixed by just adding a few spaces. In the past year,
quite a bit has happened, but nothing quite so exciting as becoming a co-owner
and the head developer of a new Minecraft community called <a href="https://collegi.enjin.com" title="Collegi Pixelmon Main Website">Collegi</a>. Collegi
is a <a href="https://pixelmonmod.com/" title="Pixelmon Mod Main Website">Pixelmon</a> server, which means we have Pokemon right inside Minecraft.
However, we strive to make the server Minecraft with Pokemon, instead of Pokemon
in Minecraft. It&rsquo;s a small difference, but one that we happen to find very
important. We want the survival aspect of the game to be front and centre.</p>
<p>The server has become absolutely massive, with each downloaded snapshot running
about 100GB in size. (Note, that throughout this article I will be using the
SI standard GB, which is 10<sup>9</sup>, versus the Gibibyte which is 2<sup>30</sup>, how hard
drive manufacturers were allowed to change the value of a gigabyte is something
I will never understand.)</p>
<p>Now, with a 500GB flash drive on my MBP, I don&rsquo;t really have the room to save
all of those snapshots, especially considering we have snapshots going back six
months, across three different major versions of Minecraft. In fact, completely
expanded, the current backup amount at the time of writing is 1.11TB.</p>
<p>So, I began to search for a method of performing backups. I had some rather
strict requirements for these backups, that lead to the formulation of the
system I am going to discuss in this article.</p>
<h1 id="requirements">Requirements<a href="#requirements" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<ul>
<li>Incremental FTP</li>
<li>Deduplication</li>
<li>Compression, and the ability to modify compression levels on the fly.</li>
<li>Checksumming to silently detect corruption.</li>
<li>Encryption</li>
<li>Tools need to be actively maintained and ubiquitous.</li>
<li>Able to sync repository with a remote source.</li>
<li>Cheap</li>
<li>Open source wherever possible.</li>
<li>Easy to access archived versions.</li>
<li>Must be able to be automated.
<ul>
<li>If not in setup, then in how it runs later.</li>
</ul>
</li>
</ul>
<h1 id="step-one---getting-the-data-off-the-server">Step One - Getting the Data off the Server<a href="#step-one---getting-the-data-off-the-server" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<p>We use a lovely company called <a href="https://www.bisecthosting.com/" title="BisectHosting">BisectHosting</a> to run our server. They
provide an extremely barebones budget package that gives us a large amount of
our most important specification: RAM. We can live without fancy support tickets
or SSD access if they offer us cheap RAM, which they do. Beyond that, however,
they also offer unlimited disk space, as long as that disk space goes towards
the server itself, so no keeping huge numbers of backups on the server.</p>
<p>Now, they did offer a built in backup solution, but it only keeps the past seven
days available in a rolling fashion, and I really really like to keep backups.</p>
<p>The only real gripe I have about BisectHosting is that they only allow the use
of FTP for accessing data on the Budget Server tier. Worse, they don&rsquo;t even use
FTP over TLS, so the authentication is in plain text. However, I just change my
password weekly and it seems to work alright.</p>
<p>The most important part of getting the data off the server is only getting the
new data, or the data that has changed. This requires using an FTP Client that
is able to sanely detect new data. Checksums aren&rsquo;t available, but modification
date and file size work just as well.</p>
<p>There were a large number of clients that I tried out over time. <a href="https://filezilla-project.org/" title="Filezilla Project">Filezilla</a>
was the first of those. It seemed to work alright for a time, except that when
you have a large amount of identical files (We have 15,824 files at the time of
this writing) it hangs. Now, it does come back eventually, but it&rsquo;s still not
the best of features to have a client that hangs.</p>
<p>The next one I tried was a Mac favourite known as <a href="https://cyberduck.io/" title="Cyberduck Website">Cyberduck</a>. I really liked
the interface for Cyberduck, but the first nail in its coffin was the inability
to perform a modification time comparison and a file size comparison during the
same remote to host sync. That meant it took two syncs to grab everything up to
date, and even then it didn&rsquo;t always seem to take. During the time that I was
using Cyberduck, we had to restore from backup for some reason that is currently
eluding me, but when we did so we noticed that some recent changes on the map
hadn&rsquo;t synced properly. Combine all of the above with the fact that from time to
time it would hang on downloads (I&rsquo;m assuming from the absurd number of files)
and that wasn&rsquo;t going to work.</p>
<p>The final GUI client that I tried was called <a href="https://www.panic.com/transmit/" title="Transmit Website">Transmit</a>. I really, really
enjoyed using Transmit. It is a very polished interface, but first off it
isn&rsquo;t free, or open source, so that invalidated two of the requirements.
However, if it worked well enough, I was willing to overlook the issues. Problem
was, it didn&rsquo;t work well. I forget what happened at the moment, but I know that
it experienced similar hanging to Filezilla.</p>
<p>Regardless, Transmit was the last GUI based client that I tried. It took me a
bit to realize, but if I used a GUI client there was a very minimal chance that
I would be able to automate the download.</p>
<p>That left command line tools, which after I found <a href="https://lftp.yar.ru/" title="LFTP Homepage">LFTP</a> I kicked myself for
not looking into first. In addition to being an open source tool, LFTP has the
ability to perform multithreaded downloads, which isn&rsquo;t common in command line
clients. Furthermore, it was able to compare both modification time and file
size simultaneously, reducing the sync operations needed back to one. It is
actively maintained, available in <a href="https://brew.sh/" title="Homebrew Website">Homebrew</a> (though, at the time of writing
it has been moved into the boneyard), written in C, and very easily scriptable.
You can call commands that would normally have to be ran from inside the FTP
client directly from the command line invokation of LFTP. It handled our data
quantity flawlessly, and easily worked through the large amount of files, though
it can take quite a while to parse our biggest directories. At the time of
writing, that directory is the map data repository for our main world, which has
12,567 items clocking in at 88.15GB. It takes between two and five minutes for
LFTP to parse the directory, which considering all the other benefits is fine
by me.</p>
<p>Our remote to local command utilizes the LFTP mirror function, and from within
the client, looks like this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">mirror -nvpe -P <span class="m">5</span> / ~/Development/Collegi/
</span></span></code></pre></div><h1 id="step-two---convert-the-data-to-an-archive-repository">Step Two - Convert the Data to an Archive Repository<a href="#step-two---convert-the-data-to-an-archive-repository" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<p>When you are talking about a server that a full backup runs 100GB, and you want
to perform daily backups at minimum, it becomes absurd to think that you could
run a full backup every day. However, the notion of completely incremental
backups is far too fragile. If a single incremental backup is corrupted, every
backup after it is invalid. More than that, to access the data that was on the
server at the time the incremental was taken would require replaying every
incremental up to that point.</p>
<p>The first solution I tried for this problem was to use <a href="https://en.wikipedia.org/wiki/ZFS" title="ZFS on Wikipedia">ZFS</a>. ZFS solves
almost every problem that we have by turning on deduplication and compression,
running it on top of Apple&rsquo;s <a href="https://en.wikipedia.org/wiki/FileVault" title="FileVault on Wikipedia">FileVault</a>, and utilizing <a href="https://docs.oracle.com/cd/E23824_01/html/821-1448/gbciq.html" title="Oracle's Documentation on ZFS Snapshots">snapshots</a>. The
snapshots are complete moments in time and can be mounted, and they only take
up as much space as the unique data for that snapshot. Using ZFS Snapshots, the
1.10TB of data we had at that time was reduced to 127GB on disk. Perfect. The
problem becomes, however, offsite replication.</p>
<p>Now, it is true that by having a copy of the data on the server, one on my
MacBook, and one on an external drive here at the house, the 3-2-1 Backup
rule is satisfied. However, three backups of the data is not sufficient for a
server that contains over six months of work. It&rsquo;s reasonable that something
cataclysmic could happen and we&rsquo;d be shit out of luck. We needed another offsite
location. The only such location that offers ZFS snapshot support is
<a href="https://rsync.net/" title="Rsync.Net Homepage">Rsync.net</a> which 100% violates the &ldquo;Cheap&rdquo; requirement mentioned above.
That&rsquo;s not a knock on their service, Rsync.net provides an incredible service,
but for our particular use case it just wasn&rsquo;t appropriate.</p>
<p>So the hunt began for a deduplicating, compression based, encrypted backup
solution that stored the repository in standard files on a standard filesystem.
The final contenders were:</p>
<ul>
<li>Using plain old <a href="https://git-scm.com/" title="Git SCM">Git</a></li>
<li><a href="https://bup.github.io/" title="Bup: It Backs things Up!">BUP</a> (As a side note, this client has the most adorable name for a
backup utility that I have ever seen. I love it.)</li>
<li><a href="https://attic-backup.org/" title="Attic Backup">Attic Backup</a></li>
<li><a href="https://github.com/borgbackup/borg" title="BorgBackup">BorgBackup</a></li>
<li><a href="https://git-annex.branchable.com/" title="Git-Annex">git-annex</a></li>
</ul>
<p>I was leaning very, very heavily toward BUP until I discovered BorgBackup. My
primary concerns with BUP was that it did not seem to be under active
development, and after over five years it still had not reached a stable 1.0.
Git would have been useful, but just like ZFS it would inevitably require a
&ldquo;Smart Server&rdquo; versus the presentation of just a dumb file-system.</p>
<p>BorgBackup sold me almost immediately. It allowed you to mount snapshots and
view the filesystem as it was at that time, it offers multiple levels of
compression ranging from fast and decent to slow and incredible, and it has
checksumming on top of HMAC encryption. It&rsquo;s worth noting at this time that
nothing on the server is really so urgent as to require encryption, as most of
the authentication is handled by Mojang, but I still prefer to encrypt things
wherever possible.</p>
<p>It was under active development, it&rsquo;s developers were active in the community
(I ended up speaking with the lead developer on twitter), and it was progressing
in a sane and stable fashion. As an added bonus, the release of 1.1 was to
provide the ability to repack already stored data, allowing us to potentially
add a heavier compression algorithm in the future and convert already stored
data over to it.</p>
<p>The only downside to Borg was that at first glance it seemed to require a Smart
server, just like git would.</p>
<p>Regardless, the system would work for now. If worst came to worst, I could
utilize something like <a href="https://rclone.org/" title="Rclone">rclone</a> to handle uploading to an offsite location.</p>
<p>When everything was said and done, we had reduced the size of our 1.11TB backup
into a sane, usable 127GB.</p>
<p>The current command that is used looks like this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">borg create --chunker-params<span class="o">=</span>10,23,16,4095 --compression zlib,9 --stats <span class="se">\
</span></span></span><span class="line"><span class="cl">            --progress /Volumes/Collegi/collegi.repo::1.10.2-09292016 .
</span></span></code></pre></div><h1 id="step-three---offsite-replication">Step Three - Offsite Replication<a href="#step-three---offsite-replication" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<p>I could easily spend a very long time here discussing how I chose the cloud
provider I would inevitably use for this setup, but it really comes down to
the fact that I quite like the company, and their cloud offering has a very
complete API specification, and is dirt cheap. We went with <a href="https://www.backblaze.com/b2/cloud-storage.html" title="BackBlaze Cloud Storage">BackBlaze B2</a>.
I could, and probably will, easily write a whole separate post on how enthralled
I am with BackBlaze as a company, but more than that their $0.005/GB/Month price
is literally unbeatable. Even <a href="/posts/collegi-backup-work-notes">Amazon Glacier</a> runs for $0.007/GB/Month and
they don&rsquo;t offer live restoration. It&rsquo;s cold storage as opposed to BackBlaze&rsquo;s
live storage.</p>
<p>The problem became this: How do I get the Borg repository to fully sync to B2,
but do so in such a way that if the local repository ever became damaged I could
pull back only the data that had been lost. This is what the
<a href="https://borgbackup.readthedocs.io/en/stable/faq.html#can-i-copy-or-synchronize-my-repo-to-another-location" title="Borg Documentation: Can I sync my Repository to another Location?">documentation for Borg</a> means when it mentions you should really think
about if mirroring best meets your needs, and for us it didn&rsquo;t.</p>
<p>Again though, B2 is just a storage provider, not a smart server. So how do I set
things up in this way? The answer became to use another tool that was almost
used for backup in the first place, Git-Annex. The only reason git-annex wasn&rsquo;t
used for backup to begin with is that it doesn&rsquo;t allow us to retain versioning
information. It just manages large files through git, which wouldn&rsquo;t work.
What it would do, however, and do quite well, is to act as a layer between our
BorgBackup repository and the cloud.</p>
<p>So, I stored the entire borg repository into git annex. Once this was done, I
used a <a href="https://github.com/encryptio/git-annex-remote-b2" title="Git-Annex B2 Backend">plugin</a> for git-annex to add support for a B2 content backend. Then,
the metadata information for the git repository gets synced to <a href="https://gitlab.com/" title="GitLab">GitLab</a>, and
the content is uploaded to B2.</p>
<h1 id="conclusion">Conclusion<a href="#conclusion" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<p>The end result of this is that our 100GB server, as it stands at any day, is
mirrored in four separate locations. One on the host itself, one on the MBP
hard drive, one in the Borg Repository, and one on the BackBlaze B2 Cloud. More
than that though, we have a system that is easily automated via a simple shell
script, which after completing the initial setup (sending 20,000+ files to
Backblaze B2 can take a while), I will demonstrate here.</p>
<p>Thank you so much for reading, I look forward to sharing more about the inner
workings of the Collegi Infrastructure as time permits.</p>
<h1 id="video">Video<a href="#video" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
      stroke-linecap="round" stroke-linejoin="round" class="feather">
      <path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path>
      <line x1="8" y1="12" x2="16" y2="12"></line>
   </svg></a></h1>
<p>I just recently completed an asciinema of the process. See below. Also note
that you can copy and paste commands from inside the video itself. Go ahead, try
it!</p>
<p><strong>EDIT(2026/04/25):</strong> <em>Video has been lost to the ages.</em></p>
]]></content></item></channel></rss>