<?xml version="1.0"?>
<?xml-stylesheet href="/transform" type="text/xsl"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:bibo="http://purl.org/ontology/bibo/" xmlns:bs="http://purl.org/ontology/bibo/status/" xmlns:ci="https://vocab.methodandstructure.com/content-inventory#" xmlns:dct="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xhv="http://www.w3.org/1999/xhtml/vocab#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" lang="en" prefix="bibo: http://purl.org/ontology/bibo/ bs: http://purl.org/ontology/bibo/status/ ci: https://vocab.methodandstructure.com/content-inventory# dct: http://purl.org/dc/terms/ foaf: http://xmlns.com/foaf/0.1/ rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# xhv: http://www.w3.org/1999/xhtml/vocab# xsd: http://www.w3.org/2001/XMLSchema#" vocab="http://www.w3.org/1999/xhtml/vocab#" xml:lang="en">
  <head>
    <title property="dct:title">Schadenfreude Bait</title>
    <base href="https://doriantaylor.com/schadenfreude-bait"/>
    <link href="document-stats#EQRiyd6S0csgOC72H6JMyJ" rev="ci:document"/>
    <link href="elsewhere" rel="alternate bookmark" title="Elsewhere"/>
    <link href="this-site" rel="alternate index" title="This Site"/>
    <link href="http://purl.org/ontology/bibo/status/published" rel="bibo:status"/>
    <link href="" rel="ci:canonical" title="Schadenfreude Bait"/>
    <link href="lexicon/#EzqXIsriaILFcWjXdS7FbI" rel="dct:audience" title="Software Developer"/>
    <link href="person/dorian-taylor#me" rel="dct:creator" title="Dorian Taylor"/>
    <link href="person/dorian-taylor" rel="meta" title="Who I Am"/>
    <link about="./" href="3f36c30c-6096-454a-8a22-c062100ae41f" rel="alternate" type="application/atom+xml"/>
    <link about="./" href="f07f5044-01bc-472d-9079-9b07771b731c" rel="alternate" type="application/atom+xml"/>
    <link about="./" href="this-site" rel="alternate"/>
    <link about="./" href="elsewhere" rel="alternate"/>
    <link about="./" href="e341ca62-0387-4cea-b69a-cdabc7656871" rel="alternate" type="application/atom+xml"/>
    <link about="verso/" href="3f36c30c-6096-454a-8a22-c062100ae41f" rel="alternate" type="application/atom+xml"/>
    <link about="verso/" href="this-site" rel="alternate"/>
    <link about="verso/" href="elsewhere" rel="alternate"/>
    <meta content="schadenfreude-bait" datatype="xsd:token" property="ci:canonical-slug"/>
    <meta content="If you are blissfully unaware of the ins and outs of Linux system maintenance and its many failure modes, you can ignore this piece. Otherwise, put on your sanctimony hat." name="description" property="dct:abstract"/>
    <meta content="2011-01-25T18:37:15+00:00" datatype="xsd:dateTime" property="dct:created"/>
    <meta content="schadenfreude-bait" property="dct:identifier"/>
    <meta content="2011-01-25T20:43:54+00:00" datatype="xsd:dateTime" property="dct:issued"/>
    <meta content="2011-01-25T18:41:09+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2011-01-25T20:00:39+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2011-01-25T20:38:57+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2011-01-25T20:45:32+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2022-05-31T04:18:52+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2022-05-31T15:10:50+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta about="person/dorian-taylor#me" content="Dorian Taylor" name="author" property="foaf:name"/>
    <meta content="summary" name="twitter:card"/>
    <meta content="@doriantaylor" name="twitter:site"/>
    <meta content="Schadenfreude Bait" name="twitter:title"/>
    <meta content="If you are blissfully unaware of the ins and outs of Linux system maintenance and its many failure modes, you can ignore this piece. Otherwise, put on your sanctimony hat." name="twitter:description"/>
    <object>
      <nav>
        <ul>
          <li>
            <a href="document-stats#EQRiyd6S0csgOC72H6JMyJ" rev="ci:document" typeof="qb:Observation">
              <span>urn:uuid:4118b277-a4b4-472c-980e-0bbd87e89332</span>
            </a>
          </li>
        </ul>
      </nav>
    </object>
  </head>
  <body about="" id="EaYM8CnKSJ_rZEppPJPp_K" typeof="bibo:Article">
    <section id="EpoBDhQY1gBq2Sp2dKu8gJ">
      <p>On or around 5 January 2011, the file system on the big <acronym title="Redundant Array of Independent Disks">RAID</acronym> array&#x2014;where I keep all my stuff&#x2014;failed. The controller and disks, which I bought for the express purpose of avoiding such a situation, were all safe; it appears that the failure was at the software level. The extent of the damage had an interesting pattern: many files that had been created between about May and September were either corrupt or missing. My suspicion is that one of the times I fatfooted the power strip that year, the filesystem became inconsistent, and the inconsistency lay undetected until the filesystem hit its maximum mount count on a reboot earlier this month.</p>
      <p>This, folks, is why the nerds say that <a href="http://en.wikipedia.org/wiki/Fault-tolerant_design" title="Fault-tolerant design &#x2014; Wikipedia" rel="dct:references">fault tolerance</a> is no replacement for a <a href="http://en.wikipedia.org/wiki/Backup" title="Backup &#x2014; Wikipedia" rel="dct:references">backup</a>. About that backup: July 9th. Ouch. Luckily, due to a remarkably tumultuous back half of 2010, the very same that apparently prevented me from taking a more recent backup, I didn't really have anything important in the period from where the backup left off and the file corruption ended. Gone for good are:</p>
      <ul>
        <li>About a half dozen photos from the summer (bummer)</li>
        <li>Copies of about ten blog comments (that I could probably go fetch again)</li>
        <li>A big chunk of <a href="./" rel="dct:references" title="Make Things. Make Sense.">this website</a> (which thankfully, you know, has a copy online)</li>
        <li>A non-trivial chunk of client work (which by complete fluke I had copied elsewhere)</li>
        <li>A brand new 2.5" external hard drive which I dropped on a concrete floor while trying to fix this mess (ou&#xA2;h)</li>
        <li>Aaand a bunch of crap I downloaded that I don't really care about.</li>
      </ul>
      <p>Effectively what this little excursion bought me was a whole lot of annoyance but no major catastrophe. After a couple weeks of fussing and limping along with my remaining gear, I decided to man up and <strong>Just Fix It&#x2122;</strong>, which, at the time of this writing is what I have been doing virtually non-stop for the past <em>four days</em>.</p>
      <aside role="note" id="EzLQeFI1XB6nOMRd2EA6aK">
        <p>Thanks to <a href="http://people.redhat.com/heinzm/" title="Heinz Mauelshagen" rel="dct:references">Heinz Mauelshagen</a> for assuaging my paranoia around his project, <kbd><a href="http://www.linuxmanpages.com/man8/dmraid.8.php" title="DMRAID" rel="dct:references">dmraid</a></kbd>.</p>
      </aside>
    </section>
    <section id="EeU1fAQE3JKyz5oOaWMzLL">
      <h2>Don't Be Clever</h2>
      <p>I probably would have taken a lot less time if I hadn't done this:</p>
      <blockquote id="ENzaiiuwaZVtV4NGjNRpuI">
        <pre>find /broken -mtime -183 -type f -print0 | xargs -0 \
    tar cv | gzip -c &gt; possibly-corrupt-files.tar.gz</pre>
      </blockquote>
      <p>What this says is to find all files that had been modified in the past 183 days (since July 9), feeding their names into tar and compressing the results which I store somewhere safe while I recreate the file system. Of course, <samp>xargs</samp> has an (ostensibly arbitrary) internal limit to the amount of values it takes as input before it runs its subprogram again. I knew about that. What I didn't know was that you can't just concatenate tar files end to end and have them work as one. The ensuing surgery took me about 10 hours, and once I figured out what to do it went like this:</p>
      <blockquote id="EHfk9hbeHM_KWjMv7_gUGL">
        <pre>dd if=woops.tar bs=512 count=$WHATEVER | tar xv -R</pre>
      </blockquote>
      <p>It turns out <kbd>tar</kbd> plugs a chunk of nulls at the end of each run to signal end-of-file, which means I couldn't just unpack the archive I had made and instead had to go rummaging through it like a bin diver. Luckily I figured out that the <kbd>-R</kbd> flag dumps out the block number of each file and that all I had to do when the command hit the end was round that number up to the nearest 20 512-byte blocks (10240 bytes) and run <kbd>dd</kbd> again with the new offset. <strong>33 times</strong>. If there was a better way to address this, I'd love to know, for when I hopefully have to never do this again.</p>
      <p>This is not the first time I have been screwed by the vagaries of <kbd>xargs</kbd>. It is an example of a <a href="http://en.wikipedia.org/wiki/Leaky_abstraction" title="Leaky abstraction &#x2014; Wikipedia" rel="dct:references">leaky abstraction</a>. A semantically identical (in terms of what I meant to do) command would go like this:</p>
      <blockquote id="E5ILudIOai5WACb5eVMr1I">
        <pre>find /broken -mtime -183 -type f | tar cv -T - |\
    gzip -c &gt; possibly-corrupt-files.tar.gz</pre>
      </blockquote>
      <p>Here the <kbd>-T</kbd> flag specifies to look for the list of files in a file, which is conveniently being piped in from <kbd>find</kbd>.</p>
      <aside role="note" id="EUVqJWm1xsLug_vfsZCB0L">
        <p>Thanks to <a href="http://twitter.com/randomfrequency" title="Vincent Janelle (randomfrequency) on Twitter" rel="dct:references">Vince Janelle</a> for putting me on the right track to figuring this out.</p>
      </aside>
    </section>
    <section id="ExhSthFeW4E0PWyg2IGBcJ">
      <h2>Silver Lining</h2>
      <p>The upshot of this little incursion is that it motivated me to do a few things that I had been putting off for <em>years</em>. For instance, I have really wanted to try <a href="http://www.openafs.org/" title="OpenAFS" rel="dct:references"><acronym title="Andrew File System">AFS</acronym></a> for some time for a confluence of reasons. Number one of those is to have exactly one logical place where all the stuff I care about lives, exactly one target to back up. Since I use more than one computer, putting it all on a huge mirrored disk array on my server makes sense (when it isn't flaking out), and then shunting it from there. Reason number two is that <a href="http://samba.org/" title="Samba - opening windows to a wider world" rel="dct:references">Samba</a>, which is the easy brain-dead way to achieve this result, was routinely inconveniencing me, so it invariably had to go. Reason the third is that installing <acronym title="Andrew File System">AFS</acronym> gives me an excuse to finally install and get some serious play with the byzantine authentication and authorization cadre of <a href="http://www.openldap.org/" title="" rel="dct:references"><acronym title="Lightweight Directory Access Protocol">LDAP</acronym></a>, <a href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules" title="Pluggable Authentication Modules &#x2014; Wikipedia" rel="dct:references"><acronym title="Pluggable Authentication Modules">PAM</acronym></a>, <a href="http://asg.web.cmu.edu/sasl/" title="SASL: Simple Authentication and Security Layer" rel="dct:references"><acronym title="Simple Authentication and Security Layer">SASL</acronym></a> and <a href="http://web.mit.edu/Kerberos/" title="Kerberos: The Network Authentication Protocol" rel="dct:references">Kerberos</a>.</p>
      <p>As I write, the last of the backup is being ever so gingerly copied into its new home on a fresh <acronym title="Andrew File System">AFS</acronym> cell. It has some peculiarities that I can already tell will take some getting used to.</p>
      <dl>
        <dt>This is overkill for a home network.</dt>
        <dd>You bet your doughy, cargo-pants-wearing ass it is. However there is scarcely more work to do after the initial installation (actually less), and it is no less effective because the network is small.</dd>
        <dt>Why don't you just use one laptop and <a rel="dct:references" href="https://www.dropbox.com/" title="Dropbox - Home - Online backup, file sync, and sharing made easy.">Dropbox</a> everything?</dt>
        <dd>I have been working with the basic logical infrastructure companies like Dropbox provide for about 12 years. I have a few network-accessible places offsite to which I can and do back data up. Moreover I think there is a contingent of data that belongs chiefly within my four walls. I'm not anti-cloud, I just like having my own cloud.</dd>
      </dl>
      <p>I will no doubt have something to say about this configuration in the future. I will almost certainly appreciate the centralized authorization and single sign-on I get as a bonus. Who knows though, it might anger me and I'll turf it next week.</p>
    </section>
  </body>
</html>
