<?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>Code Commit &#187; Linux</title>
	<atom:link href="http://www.codecommit.com/blog/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codecommit.com/blog</link>
	<description>(permanently in beta)</description>
	<lastBuildDate>Mon, 07 Jun 2010 07:00:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<atom:link rel='hub' href='http://www.codecommit.com/blog/?pushpress=hub'/>
		<item>
		<title>Interface &quot;Wow&quot; Factor</title>
		<link>http://www.codecommit.com/blog/linux/interface-wow-factor</link>
		<comments>http://www.codecommit.com/blog/linux/interface-wow-factor#comments</comments>
		<pubDate>Sat, 08 Mar 2008 03:50:52 +0000</pubDate>
		<dc:creator>Daniel Spiewak</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.codecommit.com/blog/linux/interface-wow-factor</guid>
		<description><![CDATA[I&#8217;ve been using Firefox 3.0 since b1 on my main development machine under Windows Vista and to be honest, I&#8217;ve been floored by all of the improvements the Firefox team has managed to squeeze into this release.&#160; For starters, performance is improved easily 10 fold over 2.0, especially when dealing with scads of tabs.&#160; That [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Firefox 3.0 since b1 on my main development machine under Windows Vista and to be honest, I&#8217;ve been floored by all of the improvements the Firefox team has managed to squeeze into this release.&nbsp; For starters, performance is improved easily 10 fold over 2.0, especially when dealing with scads of tabs.&nbsp; That alone makes the upgrade worthwhile in my book.&nbsp; </p>
<p>Even beyond that though, the entire application just has a more polished &#8220;feel&#8221; about it.&nbsp;&nbsp; Beta 3 saw the introduction of an improved theme on all platforms.&nbsp; This new theme was most noticeable on Mac, where it made Firefox suddenly jump from a MacPorts-style outsider to running right alongside the &#8220;iApps&#8221; in terms of style.&nbsp; The improvement on Vista was a little more subtle, but none-the-less impressive:</p>
<p align="center">&nbsp;<img height="136" alt="image" src="http://www.codecommit.com/blog/wp-content/uploads/2008/03/image.png" width="252" border="0"> </p>
<p>It looks a little weird when you first examine it, but after using this UI for a while I&#8217;ve come to really appreciate it&#8217;s simple devotion to usability patterns.&nbsp; I&#8217;ve followed with passing interest the Firefox development cycle since v0.5, so I knew that they were spending a <em>lot</em> of time polishing the UI.&nbsp; I was actually one of those aware of new &#8220;keyhole&#8221; look long before beta1, so when it arrived I was somewhat non-plussed.&nbsp; Oh it&#8217;s certainly slick and a vastly more usable (and more attractive) UI than it&#8217;s super-power competitor, IE7.&nbsp; But let&#8217;s face it, slick only gets you so far these days.&nbsp; Windows Vista has about the slickest look of any operating system, and just look at how much people malign it.</p>
<p>Returning to Firefox though, I&#8217;ve been extremely happy with how well &#8220;put together&#8221; the whole app seems.&nbsp; It&#8217;s really become a coherant power application with a flair for the indulgent user.&nbsp; It&#8217;s come a long way since those early releases on Windows.&nbsp; I didn&#8217;t realize just how far it had come though until I installed 3.0b3 on my Ubuntu Linux virtual machine (click for larger shot).</p>
<p align="center"><a href="http://www.codecommit.com/blog/wp-content/uploads/2008/03/firefox-wow.png"><img height="148" alt="image" src="http://www.codecommit.com/blog/wp-content/uploads/2008/03/image2.png" width="378" border="0"></a> </p>
<p>My first reaction was, &#8220;Impressive, they finally managed to make it look like a real Gnome2 application.&#8221;&nbsp; Then I looked down.</p>
<p align="center"><img height="236" alt="firefox-wow-thumb" src="http://www.codecommit.com/blog/wp-content/uploads/2008/03/firefox-wow-thumb.png" width="520" border="0"> </p>
<p>I nearly wept when I saw these controls.&nbsp; GTK Linux has been without a browser which could do this literally since the beginning of time.&nbsp; I was certainly aware that the team was working on this, but I had no idea that it had been activated in 3.0.&nbsp; Native controls in HTML are incredibly important to the user perception of how well the browser integrates with the platform.</p>
<p>That&#8217;s what it really all comes down to: user perception.&nbsp; <a href="http://www.codinghorror.com/blog/">Jeff Atwood</a> harps on about this constantly, but just because it&#8217;s oft-repeated doesn&#8217;t make it less true.&nbsp; It doesn&#8217;t matter what your application can do, just what your users <em>think</em> it can do.&nbsp; It&#8217;s all an elaborate illusion anyway, we just have to realize how complete that illusion really is.&nbsp; If a user looks at your application and thinks, &#8220;Wow!&nbsp; I don&#8217;t know what it is, but it looks powerful,&#8221; then you have succeeded as a developer.&nbsp; Your application could do nothing more than print &#8220;Hello, World!&#8221; an infinite number of times; so long as it is impressive <em>looking</em>, it will be a success (think iPhoto 1.0).&nbsp; Likewise, your application may desalinate water and hold the key to world peace, but if it looks wimpy, users will never give it a chance.</p>
<p>Now by &#8220;impressive looking&#8221; I certainly don&#8217;t mean just flashy.&nbsp; Anyone can Photoshop a <em>fancy</em> interface with lickable buttons and endlessly translucent animations, but that doesn&#8217;t mean the interface will &#8220;feel powerful&#8221;.&nbsp; The really important test is in those critical first seconds as the user makes his first few clicks through the application.&nbsp; The user needs to instantly understand the core functionality of the application and why it is better than the competition.&nbsp; Their eyes need to be draw to the critical areas and they need to be comfortable resting there for long periods at a time.&nbsp; They should feel an immediate sense of cooperation and team-spirit in the application.&nbsp; Things should progress as quickly as they can think (but no faster) and transition smoothly from state A to state B.&nbsp; Oh, and the application should look good.</p>
<p>Firefox on Gnome2 isn&#8217;t particularly flashy; it isn&#8217;t very lickable, and there&#8217;s no translucency.&nbsp; It does make a statement however, one which is immediate and unmistakably readable by the user: <strong>I can do whatever you need me to, and you&#8217;re going to like the way I do it.</strong></p>
<p>Wow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecommit.com/blog/linux/interface-wow-factor/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>One Wild Week with Ubuntu Linux</title>
		<link>http://www.codecommit.com/blog/eclipse/one-wild-week-with-ubuntu-linux</link>
		<comments>http://www.codecommit.com/blog/eclipse/one-wild-week-with-ubuntu-linux#comments</comments>
		<pubDate>Mon, 29 Oct 2007 07:01:35 +0000</pubDate>
		<dc:creator>Daniel Spiewak</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.codecommit.com/blog/eclipse/one-wild-week-with-ubuntu-linux</guid>
		<description><![CDATA[As I mentioned in my last post, I managed to erase my hard drive and ruin my productivity for a week all in one fell swoop.&#160; Since I didn&#8217;t have a Vista install disk handy, I had to make do with Ubuntu Linux for over a week while I waited for Microsoft to send me [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned in my <a href="http://www.codecommit.com/blog/scripts/142">last post</a>, I managed to erase my hard drive and ruin my productivity for a week all in one fell swoop.&nbsp; Since I didn&#8217;t have a Vista install disk handy, I had to make do with Ubuntu Linux for over a week while I waited for Microsoft to send me a replacement.&nbsp; Obviously life doesn&#8217;t just pause and wait for my computer to catch up, so I was literally forced to use Linux on a daily basis for exactly the same things that I would normally use Windows.&nbsp; This gave me quite a unique opportunity: A chance to test out an alternate OS under identical circumstances to its competitor.</p>
<h3></h3>
<h3>Compiz</h3>
<p>The first thing on my list to try was enabling Compiz.&nbsp; Yes, I know it&#8217;s mostly eye-candy, but there&#8217;s also some very useful stuff in there.&nbsp; 3D compositing is extremely useful in a WS if for no other reason than the UI always feels sprightly and responsive, rather than a constant frustrating shade of low-performance.&nbsp; For example, if you drag a window in vanilla Gnome, there&#8217;s repaint lag.&nbsp; Imperceptible though it may be on most modern systems, it&#8217;s still there.&nbsp; If you drag a Window with Compiz enabled, the lag virtually goes away.&nbsp; Also, if a window stops responding, Compiz drops its color saturation (similar to Vista&#8217;s white overlay), whereas on a non-composited WS, the app would just freeze and stop painting.&nbsp; Other Compiz treats like subtle shadows (which really help the eye to differentiate windows quickly), a slicker workspace switcher and a really nice expose clone all combine to produce a very competitive environment for those of us coming from the likes of Vista and Leopard.</p>
<p>The downside is it&#8217;s very difficult to get working.&nbsp; As with all things Linux: if you want it done right, you have to do it yourself.&nbsp; Actually, with Linux it&#8217;s more like: If you want it done, you have to do it yourself without documentation.&nbsp; One of Ubuntu Gutsy Gibbon&#8217;s big selling points is that it&#8217;s so easy to get working out of the box.&nbsp; One of the hot new features being pushed by Canonical is that Compiz is now enabled by default on installations.&nbsp; This is supposed to mean that you don&#8217;t have to do anything to get it working.&nbsp; Unfortunately, it <em>didn&#8217;t</em> work out of the box for me (I have an ATI video card).&nbsp; The error message I got when trying to configure the &#8220;Desktop Effects&#8221; was utterly unhelpful, and I had to actually figure out for myself that I needed to manually install xserver-xgl (no documentation, no &#8220;helpful hints&#8221;, nothing).&nbsp; Even then, it still took a manual kick-in-the-pants to actually get Compiz running for the first time.&nbsp; And <em>even then</em> things still weren&#8217;t a hundred percent.&nbsp; Setting changes took a logout/login to apply (without any notice).&nbsp; Key combos conflicted and didn&#8217;t work half the time.&nbsp; All in all, it was a mess.</p>
<p>The second thing was to try to get Eclipse, jEdit and gnome-terminal into a usable state so that I could actually do real work with them.&nbsp; Fortunately, gnome-terminal is quite amenable to the effort.&nbsp; I daresay it&#8217;s probably the most polished app on the whole OS; everyone should be using it!&nbsp; So 30 seconds after I opened up gnome-terminal for the first time, I had disabled that oh-so-annoying terminal bell, set the colors to something a bit easier on the eyes and appended ~/.bin to my PATH.&nbsp; I figured the next easiest would probably be Eclipse.&nbsp; After all, Linux GTK is supposed to be SWT&#8217;s second most stable WS, and Eclipse itself has been running on Linux practically from version 1.0.&nbsp; Unfortunately, it wasn&#8217;t quite so simple&#8230;</p>
<h3></h3>
<h3>Eclipse</h3>
<p>Oh I didn&#8217;t have any real trouble getting Eclipse to <em>start</em> on my Linux system, but starting was about all it could do for a while.&nbsp; For one thing, it took me nearly three hours to get all of the Europa plugins I use installed again.&nbsp; Granted, it might have something to do with the major fall release coinciding with the day I was trying to configure my setup, but OSU&#8217;s servers are faster than that.&nbsp; I&#8217;m guessing there was something weird going on within the update manager that doesn&#8217;t normally happen on Windows (it usually takes me about 10 minutes to configure a fresh Eclipse install).&nbsp; Once I had gotten everything installed, I tried to open up my old workspaces.&nbsp; It was about this point that I started to run into trouble.</p>
<p>Everyone should know better than to try to open up a workspace from another system unmodified on a completely different one; especially when crossing OSes.&nbsp; That&#8217;s not to say that I haven&#8217;t successfully performed such a procedure in the past, but I didn&#8217;t want to take any chances with another three hour wait.&nbsp; I did the &#8220;right thing&#8221; and deleted the .metadata directory and open the workspace afresh.&nbsp; First thing, I used the handy &#8220;Import Preferences&#8221; wizard to grab all of my saved syntax highlighting, font sizes and classpath variables from a previously exported .epf file.&nbsp; I sucked the preferences into my workspace, looked around, and everything seemed dandy.&nbsp; </p>
<p>At least, it did until I hit the &#8220;User Libraries&#8221; preference pane.&nbsp; Here, Eclipse gave me an error (something about absolute paths and IClasspath) and <em>refused to show the pane.&nbsp; </em>This was a situation where something was wrong with the underlying preference for the user libraries and Eclipse wasn&#8217;t even allowing me to dig in and fix it!&nbsp; After messing around with the internal structure of the .metadata directory for an hour or so, trying to erase just that particular preference set, I gave up in disgust, deleted the .metadata directory and started again.</p>
<p>This time, I ran the .epf file through <em>sed</em> (one of the many advantages of once again having a Linux shell at my disposal) and got rid of all the &#8220;C:&#8221; instances throughout the file.&nbsp; Eclipse seemed to like this a lot better, and actually deigned to <em>show me</em> the preference pane this time, without the annoying error.&nbsp; I was able to change all of the paths for the libraries, and once again things compiled nicely.</p>
<p>Unfortunately, not every user is going to have the know-how to do what I did.&nbsp; I hate to sound immodest, but I do have a bit more Eclipse experience than the average Joe trying to switch his environment from Windows to Linux (a common occurrence these days).&nbsp; If a problem arising from a <em>common operation</em> leaves me scratching my head for over an hour, it&#8217;s probably something which should be addressed.&nbsp; This sort of complete blocker of a problem which necessitates manual hacking of auto-generated files is really a big no-no.&nbsp; I may have gotten it working in the end, but the point is that it wasn&#8217;t easy.&nbsp; All it happened to be was yet another source of stress to load onto my already bursting <a href="http://en.wikipedia.org/wiki/Stress_ball">plyurethane sphere</a>.</p>
<h3>Tools and the Environment</h3>
<p>Ironically, configuring jEdit was a walk in the park, especially compared to Eclipse.&nbsp; All I needed to do was download the .deb package from jedit.org, provide my user password, copy over my modified JAR (some things just can&#8217;t be fixed in the preferences) and away I went.&nbsp; Ten minutes later I had all my favorite plugins installed and I was developing with pleasure random bash scripts on remote servers.&nbsp; It still took a little Linux foo to get the warm start working, but compared to what I had been through with the Eclipse setup, it was a walk in the park.</p>
<p>After this, there were no more &#8220;big things&#8221; to get setup.&nbsp; I had more-or-less everything I needed to be productive once more, so I turned my attention to the smaller things (yes, I do count 3D compisiting as a &#8220;big thing&#8221;).&nbsp; My first task was to disable the track pad and enable center button scrolling on my ThinkPad.&nbsp; As it turns out, center button scrolling is as easy as telling xserver to emulate a 3-button mouse.&nbsp; Unfortunately, it seems that disabling the track pad was a bit more complex.&nbsp; I discovered (to my surprise) that there is actually no way to do this in Linux itself.&nbsp; I had to go into the BIOS and completely deactivate the device, just to keep it from randomly firing when I brushed it with my palm.</p>
<p>Here I also started to look into things like fonts.&nbsp; Unfortunately, even installing the Windows fonts package didn&#8217;t improve the situation.&nbsp; Linux has an excellent renderer if all you want to display is Monospace 10pt (which it renders quite nicely), but anything else looks terrible at low sizes and &#8220;not quite relaxing&#8221; when larger.&nbsp; Unfortunately, fonts are like the wind: sometimes pleasant, sometimes annoying as hell, always unfixable.&nbsp; </p>
<p>So I decided to set my sights on a more attainable goal and focused on the mouse acceleration curve.&nbsp; Windows Vista has a very nice feature which adaptively adjusts the mouse curve based on speed, making the mouse more precise at low speeds and more responsive at high speeds.&nbsp; This leads to a general feeling of greater ease in mousing.&nbsp; You don&#8217;t really notice what a difference this makes until you try to wrestle the mouse from point A to point B on a system which doesn&#8217;t have such a nice curvature.</p>
<p>Anyway, adjusting the mouse curve seems like a pretty normal thing to want to do, right?&nbsp; Linux is supposed to be an incredibly configurable operating system, so I figured I shouldn&#8217;t have a problem.&nbsp; Well as it turns out, there is <em>no way</em> to do this in xserver.&nbsp; I couldn&#8217;t find any tool, any how-to anywhere which gave instruction on how to rectify this glaring lack of control.&nbsp; After wasting quite a bit of time Googling around and browsing &#8220;man xorg.conf&#8221;, I threw in the towel and decided to put up with the sore mouse-finger for a week.</p>
<h3>Conclusion</h3>
<p>Linux is great.&nbsp; (what, not the conclusion you were expecting?)&nbsp; I absolutely love Linux&#8217;s terminal, startup times (roughly 3x faster than Vista) and file systems (with ReiserFS managing /home, my perceived FS speeds were in the range of 2x better than NTFS on the same drive).&nbsp; Unfortunately, Linux just doesn&#8217;t have what it takes to be a desktop operating system for the average user.&nbsp; What I mean by this is it just takes too much manual tweaking and fussing to get things to work right.&nbsp; As a developer, I may have the <em>ability</em> to fix little glitches that arise in my environment, but that doesn&#8217;t mean I have the time or inclination.&nbsp; I want something that works&#8230;now; and I don&#8217;t want to lose hair over whether or not the graphical environment is even going to start on the next boot.&nbsp; I guess it&#8217;s back to Vista for me!&nbsp; *sigh*</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecommit.com/blog/eclipse/one-wild-week-with-ubuntu-linux/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>How to Reimage Your Drive and Lose Your OS</title>
		<link>http://www.codecommit.com/blog/scripts/142</link>
		<comments>http://www.codecommit.com/blog/scripts/142#comments</comments>
		<pubDate>Mon, 22 Oct 2007 07:00:37 +0000</pubDate>
		<dc:creator>Daniel Spiewak</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.codecommit.com/blog/scripts/142</guid>
		<description><![CDATA[&#8230;in five easy steps.
So basically, I royally screwed my computer this weekend.  For those of you who didn&#8217;t know, Ubuntu 7.1 (Gutsy Gibbon) came out last Thursday, and I decided that I just had to try it.  I had just written an impassioned review of why Linux isn&#8217;t the superior OS for developers, [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230;in five easy steps.</p>
<p>So basically, I royally screwed my computer this weekend.  For those of you who didn&#8217;t know, Ubuntu 7.1 (Gutsy Gibbon) came out last Thursday, and I decided that I just had to try it.  I had just written an impassioned review of why Linux <i>isn&#8217;t</i> the superior OS for developers, but I figured that maybe this time it would be different.  A lot of my headaches with Linux step from the fact that you have to spend so much time mucking about in its uncharted guts just to get your mouse (insert peripheral here) working.  In short, it&#8217;s not a very user friendly OS.  And even as a developer, I want an OS that stays out of my way and does what I ask, <i>when</i> I ask of it.</p>
<p>Naturally, I remembered how much pain I experienced the last time I tried to wipe my OS and replace it with Linux.  I was back on XP then, and it took a full three days to get everything back to productive levels.  Even then, things were never the same.  Since I try to never repeat the same mistake twice (leaving more time for new and exciting mistakes) I decided to take some precautions first.</p>
<h3>Linux Drive Imaging 101</h3>
<p>So for those of you who didn&#8217;t know, it&#8217;s possible to save the data on a hard drive bit-by-bit into a file on another machine or hard drive.  Once this file is in place, it&#8217;s also possible to <i>restore</i> the data on the drive bit-by-bit (otherwise the process wouldn&#8217;t be very useful) and achieve exactly the same state as immediately prior to sucking the image off of the drive.  Colleges use this technique often for lab machines, allowing them to be altered at will without affecting the next student&#8217;s work.  There are other applications, but it&#8217;s a long and dull list which would really detract from the focus of this post.</p>
<p>Being an enterprising computer user savvy in various forms of Linux voodoo, I decided to attack this problem myself.  Now, I&#8217;ve actually built software to accomplish just this task in the past, so I figured it would be a cakewalk.  After about 5 seconds of deliberation, I settled on the GNU Linux utility <i>dd</i> as the foundation for my scheme.  <i>dd</i> is naturally cheaper than commercial offerings like Ghost or Alteris, and it also has the significant advantage of being installed on just about every Linux system, including live CDs such as Knoppix or the Ubuntu installer.  This will work to our advantage.</p>
<p><i>dd </i>is just about the simplest command in the GNU suite.  All it does is read one file bit-by-bit and spit the output into another file.  If either an input file or an output file is unspecified, stdout or stdin will be used instead.  Thus, <i>dd</i> can be useful when chained in an array of pipes.  At its simplest form, <i>dd</i> just passes bits from stdin to stdout, functioning as a pipe:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"></td><td class="code"><pre class="bash"><span style="color: #800080;">cat</span> <span style="color: #800080;">file</span>.txt | <span style="color: #800080;">dd</span> &gt; <span style="color: #800080;">file</span>.txt   <span style="color: #999999;"># how useless can we get?</span></pre></td></tr></table></div>

<p>Of course, what we&#8217;re trying to do here is actually get data off of a hard drive and squirt it into a file.  Does this actually help us?  Linux 101: everything is a file.  And when I say everything, I mean disks, peripherals, PCI devices, network devices, <i>everything</i>.  This means that if we really wanted to, we could use <i>dd</i> to copy the entire contents of our hard drive and send it to our printer!  (though I&#8217;m not entirely sure why we would want to)  More usefully, this means that it&#8217;s trivial to copy data from a drive into a file since the drive is really a file to begin with.  And what is <i>dd</i> but a fancy way to copy bits from one file to another?</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"></td><td class="code"><pre class="bash"><span style="color: #800080;">dd</span> <span style="color: #857d1f;">if=</span>/dev/sda <span style="color: #857d1f;">of=</span>my-drive.img    <span style="color: #999999;"># image the first sata/scsi drive into </span><span style="color: #cb0710;">&quot;my-drive.img&quot;</span></pre></td></tr></table></div>

<p>Grand!  The problem here is that when the smoke clears several hours later (<i>dd</i> is unfortunately quite slow), we will have an image file roughly twice the size of the hard drive itself.  (oh, caveat time.  You should not try to do this while the computer is booted.  Such a command should be run from a live CD onto an external drive or a duel-boot OS)  The reason this file is so huge is that data is represented exactly the same both on the disk, and in the image file.  Files of course are themselves represented in a disk in a certain way, and thus there&#8217;s a great deal of overhead here.  An entire file system is being packaged within a file, bit-by-bit, and then itself being packed onto another, possibly completely dissimilar file system.  Naturally there&#8217;s going to be quite a bit of inefficiency.</p>
<p>The nice thing about most file systems is when you read the data bit-by-bit from the drive, you will notice large blocks of repeated values or patterns.  Anyone who knows anything about compression will tell you that this is a sure sign of high compressibility.  Sure enough, if you pipe <i>dd</i> through <i>bzip2</i>, the resultant file will be almost exactly the size of the data on the disk.  So even if you have a 250 GB hard drive, if you&#8217;ve only used 30 GB, the resulting .img.bz2 will only be 30 GB (more or less).  This is really nice; and while not as efficient as some systems like Ghost, this image size should do nicely for our needs.  The problem here is that the bzip compression algorithm is insanely slow on compression.  It&#8217;s quite fast to <i>de</i>compress a file, but its use would extend the imaging process for a 60 GB drive from roughly 4 hours to well over 12.</p>
<p>A good compromise in this situation would be to use <i>gzip</i> instead.  Gzip, while not as efficient a compression algorithm, is much faster on compression than bzip.  It&#8217;s quite a bit slower to decompress, but not inordinately so.  Gzip&#8217;s other problem is that it&#8217;s nowhere near as efficient a compression algorithm as bzip.  30 GB of data on a 60 GB disk will compress down to a roughly 45 GB image file using gzip.  That&#8217;s 15 GB more than bzip2, but well worth it in terms of compression speed in my book.</p>
<p>Using the magic of bash command piping, we can accomplish the drive imaging in a single command:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"></td><td class="code"><pre class="bash"><span style="color: #800080;">dd</span> <span style="color: #857d1f;">if=</span>/dev/sda | <span style="color: #800080;">gzip</span> &gt; image-`<span style="color: #800080;">date</span> +%m%d%y`.img.gz</pre></td></tr></table></div>

<p>This will produce a file with a name like &#8220;image-101907.img.gz&#8221;, depending on the current date.  To push the image back onto the drive, we use a little more bash piping:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"></td><td class="code"><pre class="bash"><span style="color: #800080;">zcat</span> image-*.img.gz | <span style="color: #800080;">dd</span> <span style="color: #857d1f;">of=</span>/dev/sda</pre></td></tr></table></div>

<p>All I needed to do was use these two commands, imaging onto an NFS share on my server and I could backup my full OS image at will.  It&#8217;s incredibly simple, and simple plans always work&#8230;right?</p>
<h3>Take Warning Dear Friends</h3>
<p>Unfortunately (for me), I didn&#8217;t account for the fact that hard drives inevitably fail, usually at the worst possible moment.  I imaged my Windows Vista installation, then proceeded to install Ubuntu 7.10.  Everything went smoothly in the install, but when it came to the tasks I perform on a daily basis, the stability just wasn&#8217;t up to snuff.  After about six hours of fiddling with settings, kernel recompilations and undocumented package requirements (hint, if Compiz doesn&#8217;t work with your ATI card out of the box, manually <i>apt-get install</i> the xserver-xgl package) I decided to revert back to Windows.  The frustration just wasn&#8217;t worth it (more about this in a future post).</p>
<p>So I booted my computer back into the live CD, NFS mounted the server, imaged the Linux install (just in case) and started the reimaging process only to discover that the server&#8217;s 1 TB hard drive had corrupted the image file.  I was quite literally horrified.  Fortunately I had anticipated something like this when creating the image, so I had <i>cp</i>&#8216;d the image file over onto a separate RAID array prior to overwriting the drive.  I juggled the NFS mounts and tried imaging from that file only to discover that it was incomplete!  It seems that the image file had been corrupted on the disk <i>as it was created</i>, meaning that it wasn&#8217;t a valid image file when I copied it to the separate drive.</p>
<p>Needless to say, I was quite upset.  I don&#8217;t even have a DVD copy of Windows Vista (it was preinstalled on my computer), so I have to shell out $15 and wait a week for Microsoft to ship me a replacement disk.  In the mean time, I can&#8217;t just do without my computer, so I fired up <i>dd</i> again and pushed the Linux image back onto my drive.  Of course, not being the OS I really wanted, it worked perfectly&#8230;</p>
<p>All of my data was backed up, so I haven&#8217;t <i>really</i> lost anything but the time and frustration of having to do a clean reinstall of Windows on my system (a significantly more challenging task than an install of Linux).  The moral of the story is: if you have data which you&#8217;re really going to need, even if it&#8217;s only a few hours down the road, make <i>absolutely sure</i> that it&#8217;s on a stable drive.  What&#8217;s more, if you do store it redundantly (as I attempted to), compare checksums to make sure the redundant copy actually worked.  If you only spend a few minutes verifying the correctness and integrity of your critical backups, little red flags should be triggered mentally.  In short, don&#8217;t try this at home &#8211; I wish that I hadn&#8217;t.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecommit.com/blog/scripts/142/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
