<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Adventures of Systems Boy! &#187; NIX</title>
	<atom:link href="http://systemsboy.com/category/nix/feed" rel="self" type="application/rss+xml" />
	<link>http://systemsboy.com</link>
	<description>Big, Honkin' Systems Stuff</description>
	<lastBuildDate>Sun, 20 May 2012 16:20:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Drives Die</title>
		<link>http://systemsboy.com/2009/06/drives-die.html</link>
		<comments>http://systemsboy.com/2009/06/drives-die.html#comments</comments>
		<pubDate>Mon, 29 Jun 2009 14:00:48 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[NIX]]></category>
		<category><![CDATA[Systems]]></category>

		<guid isPermaLink="false">http://systemsboy.com/?p=1853</guid>
		<description><![CDATA[So we had yet another calamity in the Systems Boy household last week: A hard drive failure in a four year old, 15&#8243; PowerBook. Oddly, a workmate had the exact same thing happen to him within days of our catastrophe. In fact, there&#8217;s been all manner of hardware failure in recent days. I know that [...]]]></description>
			<content:encoded><![CDATA[<p>So we had yet another <a href="http://systemsboy.com/2009/05/finder-burn-folders-data-loss-and-recovery.html" target="_self">calamity</a> in the Systems Boy household last week: A <a href="http://en.wikipedia.org/wiki/Hard_disk_failure" target="_blank">hard drive failure</a> in a four year old, <a href="http://www.everymac.com/systems/apple/powerbook_g4/stats/powerbook_g4_1.67_15.html" target="_blank">15&#8243; PowerBook</a>. Oddly, a workmate had the exact same thing happen to him within days of our catastrophe. In fact, there&#8217;s been all manner of hardware failure in recent days. I know that drives are prone to dying after a number of years, but geez! It sure seems like lately there&#8217;s been a steady shit stream aimed squarely at the tech fan. Makes me ponder the more cosmic aspect of this biz.</p>
<p><em>[Gazes dreamily off into space for a moment. Then abruptly snaps to.]</em></p>
<p>The trigger for this failure, ironically, was our attempt to make a backup. (Oh, technology gods, thou art a riot!) See, our original goal was to update the OS to Leopard, but with all the <a href="http://systemsboy.com/2009/05/more-data-recovery.html" target="_self">craziness</a> going on these days we decided to <a href="http://systemsboy.com/2006/02/scripts-part-4-cloning-%E2%80%94-whats-the-big-deal.html" target="_self">clone</a> the drive before we proceeded with said update. But in the course of cloning, it would appear in retrospect, we hit a bad block and triggered the first of what would be many, many disk errors. Unable to pull a backup, we began our descent into drive repair hell in our latest heroic attempt to salvage that ever-important thing contained on and lost from drives: the data.</p>
<p><strong>File-Level Attempts</strong><br />
Our first try was with <a href="http://en.wikipedia.org/wiki/Disk_Utility" target="_blank">Disk Utility</a>, which consistently reported, in all red text, that it could neither verify nor repair the file system. Right. On to attempt number two.</p>
<p><a href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fwww.alsoft.com%2FDiskWarrior%2Findex.html&amp;ei=BKg2SqPELIa0sgP10uS2Bw&amp;usg=AFQjCNERX-bu4ennrC_psGf5yQ_gVBxQaA&amp;sig2=Xfgf2g9elzuPJ3zoST-CDw" target="_blank">Disk Warrior</a> is my go-to utility for any sort of file system damage that Disk Utility is unable to repair. I&#8217;ve rarely seen a disk that one of these two apps couldn&#8217;t fix. Today would be one of those rare days. After mounting the drive on a known good system using Target Disk Mode, we let Disk Warrior perform its initial scan of the drive. What we found was decidedly ugly. Disk Warrior told us that it was unable to replace the borked directory with its shiny new, replacement directory because of a &#8220;disk malfunction.&#8221;</p>
<p>That&#8217;s when we knew the drive was fried.</p>
<div id="attachment_1902" class="wp-caption aligncenter" style="width: 335px"><a href="http://systemsboy.com/wp-content/uploads/2009/06/disk-warrior-report.png"><img class="size-medium wp-image-1902" title="disk-warrior-report" src="http://systemsboy.com/wp-content/uploads/2009/06/disk-warrior-report-325x530.png" alt="Disk Warrior Report: Bad News" width="325" height="530" /></a><p class="wp-caption-text">Disk Warrior Report: Bad News</p></div>
<p>When a hard drive has problems, 99% of the time those problems are <a href="http://www.alsoft.com/DiskWarrior/details4.html" target="_blank">directory</a> related. That is, the hard drive contains data about the files on disk — where they belong, how many there are, how the disk is partitioned and so on. And usually, when there is a problem with a drive, it is because this information has been corrupted somehow. These days there are numerous utilities that can easily and accurately repair these sorts of problems, Apple&#8217;s included Disk Utility among them. Sometimes the damage is too extensive, though, so we turn to something a bit more drastic, like Disk Warrior. Disk Warrior forgoes the repair, and instead scans the disk and creates a brand-spankin&#8217; new directory, replacing the broken one with its new one once you&#8217;ve made sure everything is cool, and perhaps made a backup. Now, when Disk Warrior is unable to do this it&#8217;s indicative of a much more serious problem. When this happens it is very likely that the drive hardware is beginning to fail.</p>
<p>Time for a new drive.</p>
<p>What Disk Warrior does in these instances is it shows you the best picture it can muster of the drive&#8217;s contents in a read-only preview, and then advises you to backup as much as you can before total failure. So that&#8217;s what we did. You&#8217;re never sure how much time you have in these situations, so we went through folder by folder trying to locate and backup the most important files first. With each successive copy the drive became slower and slower. Luckily, we were able to pull the most recent, most important files. Most everything else was backed up or able to be easily reconstructed.</p>
<p><strong>Block-Level Attempts</strong><br />
Once we had gotten the most important stuff we decided to see what else we could get. I tried running some <code>rsync</code> commands and got some stuff that way, but not much, and it was taking forever. Once I&#8217;d given up trying things at the file level, I decided to make my last ditch effort with a well-worn but powerful little UNIX command called, simply, <code>dd</code>. (No, it does not stand for &#8220;Drives Die,&#8221; though maybe it should.)</p>
<p><a href="http://en.wikipedia.org/wiki/Dd_%28Unix%29" target="_blank">The <code>dd</code> command</a> reads data from a disk at the block level and copies it from standard input to standard output which can then be written to a file of your choosing. I use <code>dd</code> by running it on the <code>/dev</code> entry of the drive in question and writing the output to a disk image file (DMG):</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:100%;">sudo dd bs=512 if=/dev/disk3s3 of=/Volumes/Work/LastDitch-DD-01.dmg conv=noerror,sync</span></code></pre>
</div>
<p>The good thing about dd is that you can instruct it to skip damaged sections of the disk. That&#8217;s what the &#8220;<code>noerror</code>&#8221; option is for. The downside to <code>dd</code> is that it wants to read the entire disk, and that makes it very slow. In this instance I was not able to rescue any data, mainly because, as I soon discovered from my <code>dd</code> runs, the disk was just too far gone. I did learn some <a href="http://www.crazytrain.com/dd.html" target="_blank">interesting strategies</a> for using <code>dd</code> to recover data though.</p>
<p>The first thing you can try if <code>dd</code> is running slowly is to increase the block size. This is how much data <code>dd</code> will consider before moving to the next read. The default is 512 bytes. I&#8217;ve read upping that to 51200 will sometimes yield speedier results:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:100%;">sudo dd bs=51200 if=/dev/disk3s3 of=/Volumes/Work/LastDitch-DD-02.dmg conv=noerror,sync</span></code></pre>
</div>
<p>In my case it did not, primarily, I believe, because there was a problem in the beginning of the drive, and <code>dd</code> was having trouble moving past that spot. So another thing you can tell <code>dd</code> to do is to skip a certain portion of the drive, say the first 2 GBs:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:100%;">sudo dd bs=51200 if=/dev/disk3s3 skip=2000000 of=/Volumes/Work/LastDitch-DD-03.dmg conv=noerror,sync</span></code></pre>
</div>
<p>Finally, you can also tell <code>dd</code> to only write in 1 GB chunks, using the <code>count</code> option:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:100%;">sudo dd bs=51200 if=/dev/disk3s3 count=1000000 skip=2000000 of=/Volumes/Work/LastDitch-DD-03.dmg conv=noerror,sync</span></code></pre>
</div>
<p>I was getting some good results after having skipped the first 2 GBs — apparently they were really damaged — so I decided to write a script that would skip the first 2 GBs and then begin writing out 1 GB chunks of data. It would&#8217;ve looked something like this:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:100%;">sudo dd bs=51200 if=/dev/disk3s3 count=1000000 skip=2000000 of=/Volumes/Work/LastDitch-DD-Chunck-01.dmg conv=noerror,sync
sudo dd bs=51200 if=/dev/disk3s3 count=1000000 skip=3000000 of=/Volumes/Work/LastDitch-DD-Chunck-02.dmg conv=noerror,sync
sudo dd bs=51200 if=/dev/disk3s3 count=1000000 skip=4000000 of=/Volumes/Work/LastDitch-DD-Chunck-03.dmg conv=noerror,sync
...</span></code></pre>
</div>
<p>Etc, etc, up to the 40 GBs needed to scour the drive. I never got to write the script, though, because the last <code>dd</code> command seized up and the drive began making the clicking, knocking and whirring sounds of its agonized and tortured death. It was quickly dying. We could do no more.</p>
<p>At this point, mainly for my own edification, I decided to see what could be done outside the confines of my home office. I decided to get a quote from Drive Savers.</p>
<p><strong>Hardware-Level Attempt</strong><br />
<a href="http://www.drivesaversdatarecovery.com/" target="_blank">Drive Savers</a>, perhaps wisely, does not list prices for their services on their website. To get an estimate you have to give them a call. When I called them I was greeted by a very friendly and helpful service person — yes, <em>person</em> — which was really nice. The last thing you want to deal with when you&#8217;re having a mechanical failure is a machine. The person on the other end of the line asked me a few basic questions to gauge what state the drive was currently in, things like what attempts I had made to rescue the data, would the drive mount, and the like. After entering this info into her systems she directed me the &#8220;<a href="http://www.drivesaversdatarecovery.com/company-info/recovery-tips/" target="_blank">Tips, Techniques and Solutions</a>&#8221; page on their website (very useful — love the drive sound audio samples), stressing above all that in order to have the best chance of recovery at this point the drive should not be powered on again. She also offered up some information about the company and what they do: For one, they started with Mac data recovery and are an all-Mac shop, which surprised me a little. She also pointed me to information on the Drive Savers <a href="http://www.drivesaversdatarecovery.com/certification/clean-recovery/" target="_blank">clean room</a>, a vital part of data recovery at the hardware level. She then took my email and contact info and gave me both a written and verbal estimate of how much I could expect to spend should I decide to go ahead and have Drive Savers attempt to save my data (I don&#8217;t think they&#8217;ll actually save the drive). All in all it was a very pleasant and informative experience. Normally I am loathe to use the phone for business, but Drive Savers really seems to know what they&#8217;re doing, at least when it comes to pre-sales customer service, and that counts for a lot in my book.</p>
<p>This is, of course, all prep for the fact that, if you do want to make the attempt at data recovery, you&#8217;ll be expected to drop a significant amount of money. This is hardly surprising. Those clean rooms don&#8217;t look particularly cheap to build or maintain. And if data recovery at the hardware level is anything like it is at the software level, it is a laborious and time consuming process. I was given a range of prices ($500-$2700 dollars) and told that the cheapest I could expect to get away with — the economy plan, which isn&#8217;t as fast as some of the other, more expensive plans — was $500 dollars. But it was likely I&#8217;d pay somewhere closer to the upper third of the range, more like $1500 to $2000 dollars. It all depended, of course, on how much data Drive Savers could recover.</p>
<p>I didn&#8217;t really find these prices particularly surprising. I&#8217;d long heard how much such a recovery could cost. That it would be pricey. I was glad that I was not in a situation that required me to fork out this amount of money. I&#8217;m glad such a service exists for the odd catastrophe, though I hope never to have to use it. Drive Savers&#8217; website offers advice on keeping backups:</p>
<blockquote><p><em>&#8220;<strong>Backup strategies:</strong><br />
* Invest in redundant backup systems<br />
* Establish a structured backup procedure to make copies of all critical data files, using software compatible with the operating system and applications<br />
* Periodically test the backups to verify that data, especially databases and other critical files, are being backed up properly<br />
* Keep at least one verified copy of critical data offsite&#8221;</em></p></blockquote>
<p>Sage advice, all. Take it from those who know all too well.</p>
<p><strong>The Belly of the Beast</strong><br />
Once we&#8217;d decided not to use a hardware data recovery service the only thing left to do was spec out, buy and install a new hard drive. This wasn&#8217;t terribly difficult, but as is so often the case, there was the odd snag or two.</p>
<p>Before we even bought a drive, I wanted to see how hard it would be to open the PowerBook for servicing. If it was going to be a bear — and some PowerBooks are certainly easier to crack than others — I&#8217;d let the fine technicians at Tekserve do the job. So I went in search of manuals and instructions for this particular model of PowerBook. Without too much trouble I was able to locate, at Apple&#8217;s site, the manual for our <a href="http://manuals.info.apple.com/en_US/PowerBookG4_15inch1.67-1.5GHzUserGuide.pdf" target="_blank">1.67 MHz, 15&#8243; Aluminum PowerBook</a>. It contained no instructions for hard drive replacement, which is generally a sign that Apple would rather you not attempt the repair yourself. That got me a little worried.</p>
<p>Finally, however, I found instructions — <a href="http://www.ifixit.com/Guide/Device/PowerBook_G4_Aluminum_15%22_1.67_GHz" target="_blank">great instructions</a>, no less — at the venerable — awesome, actually <a href="http://www.ifixit.com/" target="_blank">iFixit.com</a>. iFixit, for those of you who don&#8217;t know, provides step-by-step, illustrated guides on taking apart and performing repairs on Apple hardware. For free. They&#8217;re amazing. I feel guilty not buying anything from their site. Oh yeah, they also sell parts, tools and service as well. I love them. And from what I could see, the repair would be tedious — lots of screws — and would require a trip to the hardware store — blasted tiny hex screws! — but it would be doable. Still, taking things one step at a time, I thought I&#8217;d perform the teardown before buying the drive. Just in case.</p>
<p>And perform I did. Using iFixit&#8217;s excellent guide, I was able to crack the PowerBook in short order. I was ready to buy a drive.</p>
<p><strong>Buying a Drive</strong><br />
There are two things SysAdmins typically are, particularly when it comes to technology: cheap and lazy. Hunting for a replacement drive brought both of these qualities in my personality to bear. I was looking for the cheapest replacement I could find, at the location closest to my house, a SysAdmin&#8217;s dream hunt. The closest proper computer tech shop to me is <a href="http://tekserve.com" target="_blank">Tekserve</a>, with <a href="http://bestbuy.com" target="_blank">Best Buy</a> a close second. Tekserve doesn&#8217;t list what bare drives they carry, if any. But Best Buy seems to have the goods. But Best Buy is still a good half hour train ride, so I did some physical recon at my nearest Radio Shack, which happens to be right around the corner. They informed me that, though they did not have any bare drives in stock, they did have portable USB drive on sale. Drives from which I could pull and the internal component and install it in the now drive-less PowerBook. In fact, they had a 160 GB <a href="http://go.iomega.com/en-us/products/external-hard-drive-portable/prestige-portable-series/prestige/" target="_blank">Iomega Prestige</a> for less than a bare drive would have run me at Best Buy — a mere $75 clams post-sales-tax. Not bad. I took it.</p>
<p>I&#8217;d like to pause here and see if anyone can guess why this didn&#8217;t work out for me. You have pretty much all the data you need in this article to figure it out. But don&#8217;t feel bad if you can&#8217;t. The good lord knows I surely didn&#8217;t. I&#8217;ll wait a minute&#8230; Pretend there&#8217;s Jeopardy countdown music playing&#8230; Aaand&#8230;</p>
<p>Okay. Did you guess it?</p>
<p>I got the drive home, popped it out of its case and went to put it in the open PowerBook. But it didn&#8217;t fit. (Have you guessed it yet?) Here&#8217;s the thing: PowerBooks use 2.5&#8243; <em>ATA</em> drives (Parallel ATA, or PATA), but drives in today&#8217;s externals are all now <em>SATA</em> (Serial ATA) drives. Blast!</p>
<p>Oh well. At least it was cheap.</p>
<p>Another quick look at the web revealed that all the bare drives at Best Buy were SATA as well. Blast again!</p>
<p>The nearest <a href="http://www.jr.com/western-digital/pe/WD_WD1600BEVSRT/" target="_blank">ATA drive</a> I could find was at <a href="http://www.jr.com/">J&amp;R</a>, which is all the way downtown, almost at the very tippy-tip of Manhattan — far. So that&#8217;s where we went.</p>
<p>Once we got back, we installed the drive and — the very first thing to go right all day — it worked. Perfectly. Things were finally looking up.</p>
<p>Once we had installed the drive it was simply a matter of formatting it, installing the latest version of Leopard (which is all we ever wanted to do in the first place) and copying over the rescued and reconstructed data. Oh, did I mention that the reason the client wanted Leopard was for Time Machine? Yup. Backups. Great timing. So we set up Time Machine as well. All that went exceedingly smoothly and our repair is, at last, complete. Whew! What an ordeal!</p>
<p>But, man, did I ever learn a lot.</p>
<p><strong>The Life and Death of Hard Drives</strong><br />
So yes, drives die. How they die, though, is almost as important as how they lived, and certainly as interesting. It&#8217;s somewhat comforting to know that this drive, while quite dead indeed, did not die in vain. Rarely have I had the opportunity to learn so much about practical drive recovery. I have that PowerBook drive — specifically its death, in fact — to thank for my lesson.</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2009/06/drives-die.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>More Data Recovery</title>
		<link>http://systemsboy.com/2009/05/more-data-recovery.html</link>
		<comments>http://systemsboy.com/2009/05/more-data-recovery.html#comments</comments>
		<pubDate>Sun, 17 May 2009 14:00:13 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[NIX]]></category>

		<guid isPermaLink="false">http://systemsboy.com/?p=1702</guid>
		<description><![CDATA[It&#8217;s been a bad couple of weeks for data loss in the Systems Boy household. Fortunately, it&#8217;s been a fairly good week for data recovery, so we&#8217;ve mostly broken even, minus the time lost recovering data, of course. Most recently, something seems to have taken a large (by which I mean everything) bite out of [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a bad couple of weeks for <a href="http://systemsboy.com/2009/05/finder-burn-folders-data-loss-and-recovery.html">data loss</a> in the Systems Boy household. Fortunately, it&#8217;s been a fairly good week for <a href="http://www.prosofteng.com/products/data_rescue.php" target="_blank">data recovery</a>, so we&#8217;ve mostly broken even, minus the time lost recovering data, of course.</p>
<p>Most recently, something seems to have taken a large (by which I mean everything) bite out of a very important CSS file. See, we tend to use <a href="http://systemsboy.com/2009/04/coda-and-espresso.html">Coda</a> to build sites at our house, and we tend to work over the network as the most expedient means to that end. Now, working on a website over the network is not without its perils, as I&#8217;m sure you&#8217;re aware. Particularly if you&#8217;re working wirelessly, and particularly if you&#8217;re working on a server of unknown reliability. So, a very awesome someone I know (okay, yes! I have a girlfriend!) was doing exactly that when all of a sudden her CSS file appeared to be completely empty. Mind you, she was not working on the file. She merely had it open while she worked on another document in another tab. But after switching to the CSS tab, the CSS file — which she&#8217;d been working on obsessively for about a week — appeared to be empty.</p>
<p>Now I&#8217;ve had the same thing happen to me after a network dropout — or, more likely, a server disconnect — and the solution in my case was to simply shut down and restart Coda. Mine was largely a cosmetic issue brought on, I assume, by Coda&#8217;s inability to reconnect to the documents after a disconnect. So I told her to simply restart Coda, confident that the problem would correct itself. But it didn&#8217;t. Even after restarting Coda, still no CSS joy. The file was there, but it was completely empty!</p>
<p>This is the point at which <a href="http://en.wikipedia.org/wiki/Panic" target="_blank">panic</a> generally sets in. (And no, that is not a reference to the <a href="http://www.panic.com/" target="_blank">makers of Coda</a>.)</p>
<div id="attachment_1708" class="wp-caption aligncenter" style="width: 410px"><a href="http://systemsboy.com/wp-content/uploads/2009/05/the_scream2.jpg"><img class="size-full wp-image-1708" title="the_scream2" src="http://systemsboy.com/wp-content/uploads/2009/05/the_scream2.jpg" alt="Panic" width="400" height="513" /></a><p class="wp-caption-text">Panic</p></div>
<p>If there&#8217;s anything I&#8217;ve learned in my near-ten years of professional systems work, it&#8217;s that data is rarely ever completely wiped out in a single stroke. And if there&#8217;s anything else I&#8217;ve learned, it&#8217;s not to panic. So I coolly, calmly set about the task of recovering the file while my exhausted and infuriated sweetheart went to bed.</p>
<p>The first thing I did was to check the server to see if any backups had been made. I know that her provider, and some of the software she uses, make automatic backups from time to time. So I downloaded anything and everything I could find from the server that might prove useful, including a backup of the entire site for safekeeping. I soon discovered that there was nothing even remotely recent enough to contain the missing CSS file. So I started looking in the local home account, first by <code>grep</code>ping for anything with &#8220;css&#8221; in the name. Some Coda cache files came up, some of which were fairly recent, but none failed to yield the data I was searching for. I searched <code>/tmp</code> as well, to no avail.</p>
<p>Finally, after a couple of hours of downloading and <code>grep</code>ping and searching and hoping, I was about ready to give up. As a last ditch effort I decided to use the <code>find</code> command on the entire local hard drive:<br />
<code>find / -name *.css*</code></p>
<p>This command will search the entire file system for any file whose name contains the string &#8220;.css.&#8221; And it turned out to be the winner. The command yielded a ton of useless results, many of which came from application documentation. But in the end a Coda cache file turned up in:<br />
<code>/private/var/tmp/501</code></p>
<p>Of all places!</p>
<p>Moreover, this file had a time stamp very near the time of the disappearing data. So I made a copy of it (okay, I made, like, four copies of it) and uploaded it to the server. The next day my sweetie confirmed: I&#8217;d found the file! The day was saved!</p>
<p>So remember, people: Stay calm, and always try <code>find</code> before giving up the ghost. And for poops sake, make a backup!</p>
<p>Whew! That was close!</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2009/05/more-data-recovery.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Note To Self: Restart autofs</title>
		<link>http://systemsboy.com/2008/09/note-to-self-restart-autofs.html</link>
		<comments>http://systemsboy.com/2008/09/note-to-self-restart-autofs.html#comments</comments>
		<pubDate>Mon, 15 Sep 2008 21:20:20 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Leopard]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[NIX]]></category>

		<guid isPermaLink="false">http://systemsboy.com/?p=454</guid>
		<description><![CDATA[I just looked all over Hell&#8217;s half acre for this (okay, I performed a perfunctory Google search) and I couldn&#8217;t find a definitive answer. Now I know and I just wanted to make a quick note of it for posterity. In the olden days (i.e., a few months ago), in order to get any mounted [...]]]></description>
			<content:encoded><![CDATA[<p>I just looked all over Hell&#8217;s half acre for this (okay, I performed a perfunctory Google search) and I couldn&#8217;t find a definitive answer. Now I know and I just wanted to make a quick note of it for posterity. In the olden days (i.e., a few months ago), in order to get any mounted to shares to re-mount, we would restart <code>automount</code> thusly:</p>
<div id="code"><code>sudo killall -HUP automount</code></div>
<p>This no longer works. Now we must restart <code>autofs</code>. To restart <code>autofs</code> on Mac, do this:</p>
<div id="code"><code>sudo killall -HUP autofsd</code></div>
<p>To be additionally thorough, though this should not be necessary, you could also restart <code>automount</code>, which now looks slightly different (note the &#8220;d&#8221;, which is new):</p>
<div id="code"><code>sudo killall -HUP automountd</code></div>
<p>None of this is surprising, but then again, if you&#8217;re not sure you&#8217;re doing it right (like you run the command and nothing happens and you want to be sure you&#8217;re doing the right thing) it helps to have it written down somewhere.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2008/09/note-to-self-restart-autofs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Default Shell Hell</title>
		<link>http://systemsboy.com/2008/09/default-shell-hell.html</link>
		<comments>http://systemsboy.com/2008/09/default-shell-hell.html#comments</comments>
		<pubDate>Tue, 09 Sep 2008 08:36:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Lab]]></category>
		<category><![CDATA[NIX]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Systems]]></category>

		<guid isPermaLink="false">http://systemsboy.com/?p=623</guid>
		<description><![CDATA[There&#8217;s a common occurrence in the world of systems administration. Once I describe it you&#8217;ll probably all nod you&#8217;re heads knowingly and go, &#8220;Yeah, that happens to me all the time.&#8221; It happened to me recently, in fact. I was attempting to set a Linux system to authenticate via a freshly-built LDAP server — something [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a common occurrence in the world of systems administration. Once I describe it you&#8217;ll probably all nod you&#8217;re heads knowingly and go, &#8220;Yeah, that happens to me all the time.&#8221; It happened to me recently, in fact.</p>
<p>I was attempting to set a Linux system to authenticate via a freshly-built LDAP server — something I&#8217;ve done many, many times — and it just wasn&#8217;t working. I could authenticate and log in fine via the shell, but no matter what I tried, whenever I would attempt to log in to Gnome, I&#8217;d get an error message saying that my session was ended after less than 10 seconds, that maybe my home account was wonky or I was out of disk space, and that I could read some error messages about the problem  in a log called <span style="font-family: courier new;">.xsession-errors</span> in my home account.</p>
<p>Of course, certain that my home account was fine and that I had plenty of disk space, the first thing I checked was the <span style="font-family: courier new;">.xsession-errors</span> log, which yielded little useful information, and which information led me on a complete and utter wild goose chase. From everything I could glean from this rather sparse log, there seemed to be a problem with Gnome or X11 not recognizing the user. I showed the error to some UNIX-savvy co-workers, one of whom demonstrated that, when booting into run-level 3, logging in and <span style="font-style: italic;">then</span> starting X, login worked fine, thus proving my hypothesis. So began several days of research into Linux run-levels, Gnome, X11, PAM, NSS Switch and LDAP authentication on Linux. All of which was exceptionally informative, but which, of course, failed to yield a positive result.</p>
<p>The final, desperate measure was to scour every forum I could, and try every possible fix therein. And, lo and behold, there, at the bottom of <a href="http://www.fedoraforum.org/forum/archive/index.php/t-62201.html">some obscure post</a> on some unknown Linux forum (okay, maybe not <span style="font-style: italic;">that</span> unknown), was my answer: set the default shell. Could it be so simple?</p>
<p>But wait, wasn&#8217;t the default shell set on my server already?</p>
<p>I checked my server, and sure enough, because of a typo in my Record Descriptor header, the default shell had not been set for my users. Seems X11/Gnome needs this to be explicitly specified in an LDAP environment, because in said environment it is (for some reason that remains beyond me) unable to read the system default.</p>
<p>Setting the default shell for users on my LDAP server (yes, it is a Mac OS X Server) did the trick, and I can now log in normally to Linux over LDAP.</p>
<p>So, after days of researching a problem the solution all boiled down to one, dumb, overlooked setting on my server, a fact I found referenced only at the bottom of some strange and obscure internet forum. Sound familiar? What, pray tell then, should we call this phenomenon? We really need a term for it. Or a perhaps an axiom? Maybe a law or a razor or a constant. Something like:</p>
<blockquote><p><em>&#8220;For every seemingly complex OS problem there is almost always an astoundingly simple solution which can usually be found at the bottom of one of the more obscure internet forums.&#8221;</em></p></blockquote>
<p>A corollary of which might go something like:</p>
<blockquote><p><em>&#8220;Always check the bottoms of forums first.&#8221;</em></p></blockquote>
<p>We&#8217;ll call it Systems Boy&#8217;s Razor. Yeah, that should do nicely.</p>
<p>If anyone has any better suggestions here, I&#8217;m always open. Feel free to let &#8216;em rip in the comments. Otherwise, check your default shells, people. Or at least make sure you have them set.</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2008/09/default-shell-hell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NetBoot Part 4</title>
		<link>http://systemsboy.com/2008/03/netboot-part-4.html</link>
		<comments>http://systemsboy.com/2008/03/netboot-part-4.html#comments</comments>
		<pubDate>Mon, 31 Mar 2008 21:11:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Lab]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[NetBoot]]></category>
		<category><![CDATA[NIX]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2008/03/netboot-part-4/</guid>
		<description><![CDATA[So this is going great. I have a really solid Base OS Install, and a whole buttload of packages now. Packages that set everything from network settings to custom and specialized users. I can build a typical system in about 45 minutes, and I can do most of the building from my office (or any [...]]]></description>
			<content:encoded><![CDATA[<p>So <a href="http://systemsboy.com/2008/02/netboot-part-i.html">this</a> is going great. I have a really solid <a href="http://systemsboy.com/2008/02/netboot-part-2.html">Base OS Install</a>, and a whole <a href="http://systemsboy.com/2008/03/netboot-part-3.html">buttload</a> of packages now. Packages that set everything from network settings to custom and specialized users. I can build a typical system in about 45 minutes, and I can do most of the building from my office (or any other computer in the lab that has ARD installed).</p>
<p>I&#8217;m also getting fairly adept at making packages. A good many of my packages are just scripts that make settings to the system, so I&#8217;m getting pretty handy with the <span style="font-family:courier new;">bash</span> and quite intimate with <span style="font-family:courier new;">dscl</span>. But, perhaps most importantly, I&#8217;m learning how to make all sorts of settings in Leopard via the command-line that I never knew how to do.</p>
<p>The toughest one so far has been file sharing. In our lab we share all our Work partitions to the entire internal network over AFP and SMB. In the past we used SharePoints to modify the NetInfo database to do so, but this functionality has all been moved over to Directory Services. To complicate matters, SAMBA no longer relies simply on standard SMB configuration files in standard locations, and the starting and stopping of the SMB daemon is handled completely by <span style="font-family: courier new;">launchd</span>. So figuring this all out has been a headache. But I think I&#8217;ve got it!</p>
<p><strong>Setting Up AFP</strong><br />
Our first step in this process is setting up the share point for AFP (AppleFileshareProtocol) sharing. This wasn&#8217;t terribly difficult to figure out, especially now that I&#8217;ve been using Directory Services to create new users. To create an AFP share in Leopard, you use <span style="font-family:courier new;">dscl</span>. Once you grok the syntax of <span style="font-family:courier new;">dscl</span> it&#8217;s fairly easy to use. It basically goes like this:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">command node -action Data/Source value</span></pre>
</div>
<p>The &#8220;Data Source&#8221; is the thing you&#8217;re actually operating on. I like to think of it as a plist entry in the database — like a hierarchically structured file — which it basically is, or sometimes I envision the old-style NetInfo structures. To get the needed values for my new share, I used <span style="font-family:courier new;">dscl</span> to look at a test share I&#8217;d created in the Sharing Preferences:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">dscl . -read SharePoints/TEST</span></pre>
</div>
<p>The output looked like this:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">dsAttrTypeNative:afp_guestaccess: 1
dsAttrTypeNative:afp_name: TEST
dsAttrTypeNative:afp_shared: 1
dsAttrTypeNative:directory_path: /Volumes/TEST
dsAttrTypeNative:ftp_name: TEST
dsAttrTypeNative:sharepoint_group_id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX
dsAttrTypeNative:smb_createmask: 644
dsAttrTypeNative:smb_directorymask: 755
dsAttrTypeNative:smb_guestaccess: 1
dsAttrTypeNative:smb_name: TEST
dsAttrTypeNative:smb_shared: 1
AppleMetaNodeLocation: /Local/Default
RecordName: TEST
RecordType: dsRecTypeStandard:SharePoints</span></pre>
</div>
<p>Okay. So I needed to use <span style="font-family:courier new;">dscl</span> to create a record in the SharePoints data source with all these values. Fortunately, the &#8220;<span style="font-family:courier new;">sharepoint_group_id</span>&#8221; is not required for the share to work, because I&#8217;m not yet sure how to generate that number. But create the share with all the other values and you should be okay:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style=";font-family:courier new;font-size:100%;">sudo dscl . -create SharePoints/my-share
sudo dscl . -create SharePoints/my-share afp_guestaccess 1
sudo dscl . -create SharePoints/my-share afp_name My-Share
sudo dscl . -create SharePoints/my-share afp_shared 1
sudo dscl . -create SharePoints/my-share directory_path /Volumes/HardDrive
sudo dscl . -create SharePoints/my-share ftp_name my-share
sudo dscl . -create SharePoints/my-share smb_createmask 644
sudo dscl . -create SharePoints/my-share smb_directorymask 755
sudo dscl . -create SharePoints/my-share smb_guestaccess 1
sudo dscl . -create SharePoints/my-share smb_name my-share
sudo dscl . -create SharePoints/my-share smb_shared 1</span></pre>
</div>
<p>This series of commands will create a share called &#8220;My-Share&#8221; out of the drive called &#8220;HardDrive.&#8221;</p>
<p>After modifying the Directory Services database, it&#8217;s always smart to restart it:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">sudo killall DirectoryService</span></pre>
</div>
<p>And we need to make sure AFP is running by starting the daemon and reloading the associated Launch Daemons:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">sudo </span><span style="font-family:courier new;">AppleFileServer</span><span style="font-family:courier new;">
</span><span style="font-family:courier new;">sudo </span><span style="font-family:courier new;">launchctl unload /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist</span><span style="font-family:courier new;">
</span><span style="font-family:courier new;">sudo </span><span style="font-family:courier new;">launchctl load -F /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist</span></pre>
</div>
<p>Not the easiest process, but not too bad. SMB was much tougher to figure out.</p>
<p><strong>Setting Up SMB</strong><br />
Setting up SMB works similarly, but everything is in a completely different and not-necessarily standard place. To wit, Leopard has two different <span style="font-family:courier new;">smb.conf</span> files: one that&#8217;s auto-generated (and which you should not touch) in <span style="font-family:courier new;">/var/db</span>, and one in the standard <span style="font-family:courier new;">/etc</span> location. Fortunately, it turned out, I didn&#8217;t have to modify either of these. But still, it led to some confusion. The way SMB is managed in Leopard is rather roundabout and interdependent. Information about SMB share is stored in flat files — one per share — in <span style="font-family:courier new;">/var/samba/shares</span>. So, to create our &#8220;my-share&#8221; share, we need a file named for the share (but all lower-case):</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">sudo touch /var/samba/shares/my-share</span></pre>
</div>
<p>And in that file we need some basic SMB info to describe the share:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto; font-family: courier new;"><span style="font-size:85%;">#VERSION 3<br />
path=/Volumes/HardDrive<br />
comment=HardDrive<br />
usershare_acl=S-1-1-0:F<br />
guest ok=yes<br />
directory mask=755<br />
create mask=644</span></div>
<p>Next — and this was the tough part to figure out — we need to modify one, single, very important preference file that basically informs Launch Services that SMB should now be running:</p>
<div style="border: 1px solid #999999; width: 100%; height: auto;"><span style="font-family:courier new;">sudo </span><span style="font-family:courier new;">defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server &#8220;EnabledServices&#8221; &#8216;(disk)&#8217;</span></div>
<p>This command modifies the file <span style="font-family:courier new;">com.apple.smb.server.plist</span> in our <span style="font-family:courier new;">/Library/Preferences/SystemConfiguration</span> folder. That file is watched by <span style="font-family: courier new;">launchd</span> such that when it is modified thusly, <span style="font-family: courier new;">launchd</span> knows to start and run the <span style="font-family:courier new;">smbd</span> daemon in the appropriate fashion. Still, for good measure, I like to reload the LaunchDaemon for the SMB server by hand. Don&#8217;t need to, but it&#8217;s a nice idea:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">sudo </span><span style="font-family:courier new;">launchctl unload /System/Library/LaunchDaemons/com.apple.smb.server.preferences.plist
</span><span style="font-family:courier new;">sudo </span><span style="font-family:courier new;">launchctl load -F /System/Library/LaunchDaemons/com.apple.smb.server.preferences.plist</span></pre>
</div>
<p>That&#8217;s pretty much it! There are a few oddities: For one, the new share will not initially appear in the Sharing Preferences pane, nor will the Finder show it as a Shared Folder when you open the window.</p>
<div style="text-align: center;"><a href="http://bp0.blogger.com/_SsIcI-sERQQ/R_FUtRPckSI/AAAAAAAAAZA/dQ2k-ZAUEBA/s1600-h/SharedFolder.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img id="BLOGGER_PHOTO_ID_5184017782779187490" style="cursor: pointer;" src="http://bp0.blogger.com/_SsIcI-sERQQ/R_FUtRPckSI/AAAAAAAAAZA/dQ2k-ZAUEBA/s400/SharedFolder.png" border="0" alt="" /></a></div>
<div style="text-align: center;">Shared Folder: This Won&#8217;t Show Without a Reboot<br />
(click image for larger view)<span style="font-size:85%;"><br />
</span></div>
<p>But the share will be active, and all will be right with the world after a simple reboot. (Isn&#8217;t it always!) Also, if you haven&#8217;t done it already, you may have to set permissions on your share using <span style="font-family:courier new;">chmod</span> in order for anyone to see it.</p>
<p>I was kind of surprised at how hard it was to set up file sharing via the command-line. But I&#8217;m glad I stuck with it and figured it out. It&#8217;s good knowledge to have.</p>
<p>Hopefully someone else will find it useful as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2008/03/netboot-part-4.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Remote Management Commands in Leopard</title>
		<link>http://systemsboy.com/2007/11/remote-management-commands-in-leopard.html</link>
		<comments>http://systemsboy.com/2007/11/remote-management-commands-in-leopard.html#comments</comments>
		<pubDate>Tue, 20 Nov 2007 16:33:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Leopard]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[NIX]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2007/11/remote-management-commands-in-leopard/</guid>
		<description><![CDATA[A while ago I wrote about the networksetup command, which provides a command-line interface to network preferences, as well as the systemsetup command, which provides command-line control over additional system-level preferences. In the past those commands were stored in the labyrinthian: /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support Yes, inside the ARDAgent. Perfect. Finally Apple has put those commands in a [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago <a href="http://systemsboy.com/2006/06/remote-network-and-more-management-via.html">I wrote about</a> the <span class="Apple-style-span"  style="font-family:'courier new';">networksetup</span> command, which provides a command-line interface to network preferences, as well as the <span class="Apple-style-span"  style="font-family:'courier new';">systemsetup</span> command, which provides command-line control over additional system-level preferences. In the past those commands were stored in the labyrinthian:
<div>
<div style="border: 1px solid rgb(153, 153, 153); overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Support</span></span></code></pre>
</div>
<div></div>
<div>Yes, <span class="Apple-style-span" style="font-style: italic;">inside</span> the ARDAgent. Perfect.</div>
<p>Finally Apple has put those commands in a location the shell recognizes as a command path. In Leopard they reside in the far more sensible:
<div>
<div style="border: 1px solid rgb(153, 153, 153); overflow: auto; width: 100%; height: auto;">
<pre><span class="Apple-style-span"  style="font-family:'courier new';">/usr/sbin</span></pre>
</div>
<div></div>
</div>
</div>
<div></div>
<div>Now all you have to do to call them is&#8230; Well&#8230; Call them.</div>
<p>Really now. Was that so hard?</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2007/11/remote-management-commands-in-leopard.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apple Remote Desktop Copy Problems</title>
		<link>http://systemsboy.com/2007/10/apple-remote-desktop-copy-problems.html</link>
		<comments>http://systemsboy.com/2007/10/apple-remote-desktop-copy-problems.html#comments</comments>
		<pubDate>Fri, 12 Oct 2007 16:39:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[NIX]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2007/10/apple-remote-desktop-copy-problems/</guid>
		<description><![CDATA[Prosaic title, I know. But it&#8217;s true. Every now and then, copying to remote systems via Apple Remote Desktop fails inexplicably. Fortunately, the solution is a simple one: restart the ARD Agent, conveniently named ARDAgent. Said command will look something like this: sudo killall -HUP ARDAgent Ironically, you can also send the command to the [...]]]></description>
			<content:encoded><![CDATA[<p>Prosaic title, I know. But it&#8217;s true. Every now and then, copying to remote systems via Apple Remote Desktop fails inexplicably. Fortunately, the solution is a simple one: restart the ARD Agent, conveniently named <span style="font-family:courier new;">ARDAgent</span>. Said command will look something like this:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:100%;"><span style="font-family:courier new;">sudo killall -HUP ARDAgent</span></span></code></pre>
</div>
<p>Ironically, you can also send the command to the offending system via ARD itself. Just be sure you remove the <span style="font-family:courier new;">sudo</span> and send it as root.</p>
<div style="text-align: center;"><a href="http://bp3.blogger.com/_SsIcI-sERQQ/Rw-k1dHVDPI/AAAAAAAAAN0/XGhYWlfjB6w/s1600-h/RestartARDviaARD.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img id="BLOGGER_PHOTO_ID_5120492539598933234" style="cursor: pointer;" src="http://bp3.blogger.com/_SsIcI-sERQQ/Rw-k1dHVDPI/AAAAAAAAAN0/XGhYWlfjB6w/s400/RestartARDviaARD.png" border="0" alt="" /></a><br />
Restarting ARD Via ARD<br />
(click image for larger view)</p>
<div style="text-align: left;">That&#8217;s it! Just another helpful tip from your friendly neighborhood Systems Boy.</p>
<p>Please resume your normal activities.</p></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2007/10/apple-remote-desktop-copy-problems.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>External Network Unification Part 5: Almost There</title>
		<link>http://systemsboy.com/2007/06/external-network-unification-part-5-almost-there.html</link>
		<comments>http://systemsboy.com/2007/06/external-network-unification-part-5-almost-there.html#comments</comments>
		<pubDate>Thu, 28 Jun 2007 15:29:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[ExternalNetworkUnification]]></category>
		<category><![CDATA[Lab]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[NIX]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Systems]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2007/06/external-network-unification-part-5-almost-there/</guid>
		<description><![CDATA[It&#8217;s been quite some time since I&#8217;ve been able to post anything of any substance. This has a lot to do with the fact that I&#8217;ve been super busy relocating our department and participating in the gut renovation of our lab. This has been an immensely stressful process, but in the end I find that [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been quite some time since I&#8217;ve been able to post anything of any substance. This has a lot to do with the fact that I&#8217;ve been super busy relocating our department and participating in the gut renovation of our lab. This has been an immensely stressful process, but in the end I find that I&#8217;ve learned so much from it, I simply can&#8217;t complain. I&#8217;m coming out a far better SysAdmin than I was going in. And that&#8217;s a remarkably valuable thing to both me and my employers.</p>
<p>But moving and planning the physical aspects of the new lab has only been a portion of what I&#8217;ve been working on. This renovation has been the perfect opportunity to rebuild our network infrastructure, and part of said rebuilding has resulted in the near completion of our <a href="http://systemsboy.com/category/ExternalNetworkUnification">authentication unification project</a>. At this point we&#8217;ve gone from <a href="http://systemsboy.com/2006/05/external-network-unification-part-2.html">eight different authentication servers</a> — that is, anytime we created a new user, we had to do so on eight different systems — all the way on down to two. Which means that now, anytime we create a new user, we do so on two machines.</p>
<p>Our goal is to get it down to one, hopefully before the Fall semester begins. Our mail server is proving to be the most difficult machine to get working with LDAP authentication, mainly because it authenticates mail users through the wonders of some weird combination of authd, Courier and PAM, and we&#8217;ve yet to crack the magical code that gets these all working in tandem via LDAP. Aside from Mail, though, everything is done. So I thought I&#8217;d take a bit of my hard-earned vacation and loosely describe to you how it&#8217;s all working.</p>
<p>Before I start I&#8217;d like to just acknowledge all the help I&#8217;ve had from my fellow SysAdmins in the department. I had a huge amount of assistance on the *NIX server side of things, as well as with network infrastructure and even some last-minute PHP finagling without which this project would have taken significantly longer. In fact, all I really had to do was build the authentication servers and clearly articulate what I wanted. I&#8217;m extremely grateful to everyone who helped out.</p>
<p>The little bit of network infrastructure I mentioned is our DMZ. We now have a proper — and more importantly, properly secured — DMZ on which to place an authentication server. I won&#8217;t go into too much detail here, but suffice to say, having a secure DMZ gives us all kinds of options for authentication between internal and external networks, and makes me feel a whole lot better about using <a href="http://www.apple.com/server/macosx/">Mac OS X Server</a> as our authentication system for both networks.</p>
<p>Yes, we are using Mac OS X Server to authenticate our entire network. The reason is because Mac OS X Server is the most mature and usable implementation of LDAP for user authentication available on the market today. Is it perfect? No. Is it completely secure? Probably not. Is there anything that even comes remotely close to being able to handle the complexities of user management and database redundancy across platforms with such remarkable ease-of-use? Nope. Nothing. We tried building our own custom LDAP server, which would have been excruciating, and would have taken forever. We tried <a href="http://www.redhat.com/directory_server/">Red Hat&#8217;s Directory Server</a>, which looks like it will eventually turn into something to match Mac OS X Server, but which just wasn&#8217;t yet up to snuff. Nothing matched Mac OS X Server, which did everything we wanted it to, right out of the box and with a minimum of fuss. In fact, once the user database is built, building a Mac OS X master or replica authentication server is a complete and total breeze. At the time of our building and testing it was really the only practical option.</p>
<p>So, here in a nutshell, is what we have:</p>
<p><span style="font-weight: bold;">Internal Network</span><br />All authentication originates from the internal network. Passwords can only be changed from the internal network at this time, which is by design. Systems on the internal network include:
<ul>
<li>Master Authentication Server<br />Hosts authentication for&#8230; Well&#8230; Everything, really. This is essentially the same server we used all last year for all our <a href="http://systemsboy.com/category/ThreePlatformsOneServer">internal authentication</a> needs for Mac, Linux and Windows workstations. It&#8217;s now being used to push authentication to the external network as well.</li>
<li>Internal Replica Authentication Server<br />This provides replication of the Master. Should the master fail, the Replica is intended to pick up services (though this doesn&#8217;t always work perfectly).</li>
<li>File Servers<br />We have two file servers on the internal network — a Mac and a Linux box — both of which authenticate directly against the Master.</li>
<li>Workstations<br />We have about 30 Mac, Windows and Linux machines all authenticating to the Master.</li>
</ul>
<p><span style="font-weight: bold;">DMZ</span><br />The DMZ sits between the Big Bad Internet (BBI) and the internal network. It has its own firewall that is fairly strict about what can get in from the BBI. All DMZ authentication originates from the internal network, but is provided by a single server which sits on the DMZ. Systems on the DMZ include:
<ul>
<li>External Authentication Server<br />This server is also a replica of our Master, but it&#8217;s not intended as a failsafe. Rather, it provides authentication services to the entire DMZ. It gets its user database, of course, from the Master. But for other systems to bind to an LDAP server, its role must either be &#8220;Master&#8221; or &#8220;Replica.&#8221; Setting the role to &#8220;Connected to a Directory Server&#8221; won&#8217;t work. In addition to sitting on our DMZ, which is properly firewalled against the harsh realities of the Big Bad Internet (BBI), this system also makes use of its own strict local firewall for an extra added layer of security. Also, all replication communication between Replica (DMZ) and Master (Internal) is encrypted.</li>
<li>Data Server<br />In addition to unifying authentication, we&#8217;ve also consolidated data storage and access wherever possible. In the past, for instance, movies streamed from the Quicktime Server were stored on that machine&#8217;s local drive. Web sites were stored on our web server. So, building a web site that used Quicktime Streaming required users to log into two separate machines — the Web Server and the Quicktime Streaming Server. Now we&#8217;re storing all user-generated content on a separate, dedicated machine — our Data Server — and sharing that machine out to the various servers via NFS. Centralizing this data store means users have only to log on to one server for anything they ever want to do. And also that only that server needs to authenticate users. And yes, that server authenticates them via LDAP on our External Authentication Server. All neat and tidy. Internal and external home account data is still segregated, however — users still have separate internal and external data storage. Though, if we could figure out how to do it securely, this could change.</li>
<li>Quicktime Streaming Server<br />This machine also uses its own local firewall. It gets its user database from our External Authentication Server over secure channels using the &#8220;Connected to a Directory System&#8221; as its role currently. Ultimately, however, because of the Data Server, this machine will not need to authenticate users. We are leaving the ability open temporarily to accommodate legacy users.</li>
<li>Drupal CMS<br />Our new Community site is built on the Drupal engine. We&#8217;re using the LDAP module to authenticate to the External Authentication Server. Drupal&#8217;s LDAP module is simple and easy to set up, as is the Drupal system as a whole. So far we&#8217;re very happy with it.</li>
<li>Computer Reservations System<br />This is a custom web app built long ago by a former student. We&#8217;ve (and by &#8220;we&#8221; I mean my colleague) basically hacked the PHP code to authenticate<br />
via LDAP rather than MySQL.</li>
<li>Mail Server<br />Currently not authenticating to the External Authentication Server. We&#8217;re working on this and hope to have it working by the beginning of the school year.</li>
</ul>
<p><span style="font-weight: bold;">The Future<br /></span>Yes, there&#8217;s more we want to do. It&#8217;s always amazing how, once you&#8217;ve completed something, you immediately start seeing ways to make it better.<span style="font-weight: bold;"><br /></span>
<ul>
<li>More Redundancy<br />Ultimately, in addition to the Replica, I would also like to automate a clone of the Master&#8217;s boot drive to an external firewire drive as sort of an ultimate safety. Should anything ever go wrong with the Master, I simply plug the firewire clone into virtually any Mac system on the internal network and I&#8217;m back on my feet. It might also be wise to have some sort of failsafe for external authentication as well.</li>
<li>More Security<br />while our setup is fairly secure right now, there are a few areas I&#8217;d like to beef up even more when I get a chance. In particular, our CMS connection is not as secure as I&#8217;d like it to be. And ultimately I&#8217;d like to harden every machine on the DMZ to the best of my ability.</li>
<li>More Unification<br />Anything else we can unify — and at this point that&#8217;s mostly internal and external data — I&#8217;m open to considering. It&#8217;s going to be really interesting for me to look critically at what we&#8217;ve done so far and find the flaws and refine the system. But I&#8217;ll constantly be looking at ways to simplify our current setup even further without compromising security. The easier our network is to use, the more useful it becomes. We&#8217;ve come a long way, but I&#8217;m sure we can find even better ways to do things.</li>
<li>More Services<br />Now that we have an infrastructure in place for user creation, we can add services freely to our network without the worry of creating users for said services. New services need only the ability to authenticate via LDAP. We&#8217;re already planning an equipment checkout system, and possibly some calendaring systems.</li>
</ul>
<p>So, I&#8217;ve just finalized the master authentication server. It&#8217;s done. Built. Finished. Kaput. The rest of our servers are still in various states of finality, and we have until September to lock them down. But right now, unified authentication is, for all intents and purposes (and with the exception of mail), working. And we couldn&#8217;t be happier. The ultimate test will be, of course, letting users loose on this new infrastructure. I&#8217;m betting they&#8217;ll like it almost as much as we do. At least the ones who know the old system. New users will be none the wiser. Ain&#8217;t that always the way?</p>
<p>*Sigh*</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2007/06/external-network-unification-part-5-almost-there.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Scripts Part 7: Contextual Menus with Automator</title>
		<link>http://systemsboy.com/2007/03/scripts-part-7-contextual-menus-with-automator.html</link>
		<comments>http://systemsboy.com/2007/03/scripts-part-7-contextual-menus-with-automator.html#comments</comments>
		<pubDate>Sat, 31 Mar 2007 19:00:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[NIX]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[ScriptSharing]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2007/03/scripts-part-7-contextual-menus-with-automator/</guid>
		<description><![CDATA[Recently, for some odd reason, there has been a spate of solutions to the problem of creating new files in the Finder via a contextual menu. One involves a contextual menu plugin called NuFile. Another involves installing Big Cats Scripts and linking it to an Applescript. But honestly — and I&#8217;m surprised someone else didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, for some odd reason, there has been a <a href="http://www.tuaw.com/2007/03/28/last-post-ever-about-creating-new-files-from-finder/">spate</a> of <a href="http://www.tuaw.com/2007/03/26/quicksilver-tip-for-switchers-make-new-file/">solutions</a> to the problem of creating <a href="http://www.coldpizzasoftware.com/documentpalette/">new files in the Finder</a> via a contextual menu. One involves a contextual menu plugin called <a href="http://growlichat.com/NuFile.php">NuFile</a>. Another involves installing <a href="http://ranchero.com/bigcat/">Big Cats Scripts</a> and linking it to an <a href="http://daringfireball.net/2007/03/new_text_files_contextual_menu">Applescript</a>. But honestly — and I&#8217;m surprised someone else didn&#8217;t think of this first — when faced with simple contextual menu tasks, these days my first thought is to look to <a href="http://www.apple.com/macosx/features/automator/">Automator</a>.</p>
<p>And by golly, that&#8217;s just what I did. Here are a few Automator workflows that do, more or less what the afore-linked methods do. To me, the advantage of the Automator approach is that you don&#8217;t need to install anything. It&#8217;s all baked in. Which means you don&#8217;t ever need to update anything either. Nice. Simple. And, yeah, kind of the whole point of Automator.</p>
<p>So here you go. Maybe someone will find this useful, if for nothing other than as an exercise in creating contextual menu functionality with Automator. Or skinning a cat multiple ways. Or something. To use this, download the .zip file, unzip it and place it in:<br />
<span style="font-size:100%;"><span style="font-family:courier new;">~/Library/Workflows/Applications/Finder</span></span></p>
<p><a href="http://systemsboy.com/archive/NewTextFile.zip">NewTextFile Workflow</a></p>
<p>It should become active immediately.</p>
<p>Also, here are a couple variants. One will create a text file, and then open it in TextWrangler (if you have TextWrangler, and if you don&#8217;t, go <a href="http://www.barebones.com/products/textwrangler/">get it now</a>); the other creates a Word document, and opens it in Word. I&#8217;m far to lazy to completely duplicate the functionality of NuFile. But if you examine these workflows, you can at least see now how that would be possible (in fact, fairly easy) to accomplish.</p>
<p><a href="http://systemsboy.com/archive/NewTextFile-Variants.zip">NewTextFile Workflow Variants</a></p>
<p>I actually think it would be great if Apple made it drop dead simple to create true contextual menus for the Finder. Fortunately, Automator gets us pretty close.</p>
<p>Oh, yeah, and since this is technically script writing, and since I haven&#8217;t posted to that series in some time, we&#8217;re gonna go ahead and call this a <a href="http://systemsboy.com/category/ScriptSharing">Script Sharing</a> post. Deal with it.</p>
<p>Right. Good night.</p>
<p><span style="font-weight: bold;">UPDATE<span style="font-size:78%;"></span>: </span><span style="font-size:78%;"><span style="font-style: italic;">Revised March 31, 2007, 3:00 PM</span></span><br />
<a href="http://yellow-camp.com/blog/">Stephan Cleaves</a> has added yet another <a href="http://yellow-camp.com/2007/03/30/new-file-in-a-finder-window/">implementation</a> of this idea. He&#8217;s using a combination of Automator and AppleScript. I certainly think his implementation is better than mine in a few ways. Certainly more full-featured. It will prompt for a file name, for instance, and takes pains not to overwrite a preexisting file with the same name. Nice. But we&#8217;re taking very different approaches to the same idea (his version places a file in the front-most Finder window, my version places it in the right-clicked folder), and he was confused by my approach. After speaking to him via comments on his blog, I realized that some clarification as to how my workflow is actually constructed might be in order.</p>
<p>Basically, my workflow takes the folder selected in the Finder as input and assigns that input to the variable <span style="font-family:courier new;">&#8220;$@&#8221;</span>. That variable and the <span style="font-family:courier new;">for</span> loop in my workflow are automatically generated by Automator when you select “as arguments” from the “Pass input:” field in the “Do Shell Script” action. It’s how you get the context (the selected folder) passed to the script. Apparently Automator takes <span style="font-family:courier new;">“$@”</span> as the variable for “the folder you just selected” whenever there’s no input from a previous action. This was something I learned while fiddling around with all of this, and it&#8217;s really my favorite part. The coolest thing for me here, really, was figuring out how to pass the context — i.e. the right-clicked folder — to an Automator &#8220;Do Shell Script&#8221; action. This opens up worlds of potential.</p>
<p>Finally, as I said, the <span style="font-family:courier new;">for</span> loop in the action is auto-generated by Automator. The workflow will work almost as well with the simple script:<br />
<span style="font-family:courier new;">touch “$@/NewText.txt”</span></p>
<p>Using the <span style="font-family:courier new;">for</span> loop, however, allows you to create a new text file in multiple folders by selecting said folders and running the workflow.</p>
<p>It&#8217;s really kind of amazing how many ways there are to do this. Wow. Fun stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2007/03/scripts-part-7-contextual-menus-with-automator.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Replica Reset Voodoo (That Works!)</title>
		<link>http://systemsboy.com/2007/02/replica-reset-voodoo-that-works.html</link>
		<comments>http://systemsboy.com/2007/02/replica-reset-voodoo-that-works.html#comments</comments>
		<pubDate>Sat, 10 Feb 2007 20:23:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Lab]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[NIX]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2007/02/replica-reset-voodoo-that-works/</guid>
		<description><![CDATA[So today, after downgrading my master server to 10.4.7, I kept getting an error on my replica. So I decided to reset the replica by demoting it to a &#8220;Standalone&#8221; role, and then re-promoting it to the &#8220;Replica&#8221; role. But even after doing this, the error message persisted. The message was telling me to check [...]]]></description>
			<content:encoded><![CDATA[<p>So today, after <a href="http://systemsboy.com/2007/02/mac-os-x-server-1048-breaks-windows.html">downgrading my master server to 10.4.7</a>, I kept getting an error on my replica. So I decided to reset the replica by demoting it to a &#8220;Standalone&#8221; role, and then re-promoting it to the &#8220;Replica&#8221; role. But even after doing this, the error message persisted. The message was telling me to check the logs at:</p>
<p><span style="font-family:courier new;">/var/run/openldap-slurp/replica</span></p>
<p>and doing so did reveal errors like:</p>
<p><span style="font-family:courier new;">ERROR: Type or value exists: modify/add: memberUid: value #0 already exists</span></p>
<p>The solution was to again demote the replica to standalone status and then archive all the files in:</p>
<p><span style="font-family:courier new;">/var/run/openldap-slurp/replica</span></p>
<p>to anywhere else. I put them in a folder called &#8220;old.&#8221; Just get &#8216;em out of the way. Once this was done I was able to promote my replica without receiving error messages.</p>
<p>Yay! That wasn&#8217;t too bad.</p>
<p>Oh, and you may be asking yourself how I knew to do this. Well, to be honest, I don&#8217;t really remember. I just know that at some point in the past there was a problem I&#8217;d had with a replica and it was caused by stale files. So, since my ultimate goal was to start from scratch, I just got everything out of the way. And lo and behold. It worked. Sorry for the voodoo explanation, though. I wish I could be more explicit. Hell, I wish I fully understood what I was dealing with. But I don&#8217;t. And, though it pains me to say this, I don&#8217;t have time to figure it out.</p>
<p>But y&#8217;know? I&#8217;ll take the cure even if I don&#8217;t know what caused the disease.</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2007/02/replica-reset-voodoo-that-works.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/43 queries in 0.054 seconds using disk: basic
Object Caching 599/694 objects using disk: basic

Served from: systemsboy.com @ 2012-05-22 19:03:09 -->
