<?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>ALTERthought Blogs &#187; Linux</title>
	<atom:link href="http://alterlabs.com/category/technologies/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://alterlabs.com</link>
	<description>Results through imagination</description>
	<lastBuildDate>Tue, 13 Apr 2010 19:19:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Use Linux to Recover a Corrupted Windows Drive</title>
		<link>http://alterlabs.com/technologies/java/use-linux-to-recover-a-corrupted-windows-drive/</link>
		<comments>http://alterlabs.com/technologies/java/use-linux-to-recover-a-corrupted-windows-drive/#comments</comments>
		<pubDate>Mon, 17 Apr 2006 19:24:32 +0000</pubDate>
		<dc:creator>don</dc:creator>
				<category><![CDATA[How-Tos]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://alterlabs.com/howtos/use-linux-to-recover-a-corrupted-windows-drive/</guid>
		<description><![CDATA[This entry was originally posted on an earlier incarnation of this blog. It still seems to have some merit, so I have re-posted it. 
So I was the unfortunate victim a harddrive hardware failure. Repeated WindowsXP CHKDSK runs did nothing to fix the problem and I came to the painful realization that I needed a [...]]]></description>
			<content:encoded><![CDATA[<p><em>This entry was originally posted on an earlier incarnation of this blog. It still seems to have some merit, so I have re-posted it. </em></p>
<p>So I was the unfortunate victim a harddrive hardware failure. Repeated WindowsXP CHKDSK runs did nothing to fix the problem and I came to the painful realization that I needed a new drive. Bad sectors you see. I contacted Dell, and since my laptop is under warranty, they shipped me an identical 30g drive.</p>
<p>OK, so now the dilemma: How to best recover? My critical data was backed up and current, but the thought of reinstalling 2 years worth of applications, development tools, setting, etc. brought me to tears.</p>
<p>Enter <strong>dd</strong>. The Un*x/Linux dd (&#8216;direct dump&#8217;? idunno) command can take raw data dumps from one file to another, and given that all devices in Unix are represented as files, from device to device. To put it another way, it is basically a lowlevel copy utility capable of backing up entire devices.</p>
<p>Here are the steps I followed to recover my system:</p>
<ol>
<li>Formated the new drive (A) using Windows install disks. This low-level formatting remaps bad sectors and prepares the disk.</li>
<li>Installed drive A in my laptop as the internal drive.</li>
<li>Configured my laptop BIOS to boot from CDROM.</li>
<li>Installed the old/busted drive(B) into an external USB case, and plugged the USB drive into a free USB port on the laptop.</li>
<li>Booted the laptop with a Linux installation CDROM Disk 1 (RedHat WS, but it does not really matter which distribution/release)</li>
<li>At the &#8216;what do you want install prompt&#8217;, I ran &#8216;linux rescue&#8217; to load a mini kernel into RAM; which drops me into a shell.</li>
<li>Run the following command<br />
<blockquote><p><code>dd if=/dev/sda1 of=/dev/hda1 bs=1024 conv=noerror</code></p></blockquote>
</li>
<li>Came back the next day and rebooted my laptop in to Windows (woo-hoo!), logged in, and _<strong>immediately</strong>_ ran the full CHKDSK on the drive.</li>
<li><strong>kaPOW</strong>! We are in business.</li>
</ol>
<p>A few notes on the above command invocation.</p>
<ul>
<li>The basic dd form is <code>dd if={infile} of={outfile} bs={blocksize}</code></li>
<li>In Linux, devices are accessible as files.</li>
<li>Our infile (if) in this case is drive A, which mapped to the first IDE device of <em>/dev/hda1</em></li>
<li>Our outfile (of) in this case is drive B, the external USB drive. Linux distros map USB storage devices as SCSI devices, which is why we use <em>/dev/sda1</em> to access the USB drive.</li>
<li>We specify a blocksize (bs) of 1024. I am a little unclear here as to what repesents an optimal blocksize. I errored on the size of small.</li>
<li>The <strong><em>conv=noerror</em></strong> option tells dd to ignore any I/O errors. This is critical, since we know we will have some, after all, our drive is shot.</li>
<li>Here is <a href="http://man.splitbrain.org/dd">link</a> to the man page for dd.</li>
</ul>
<p>That&#8217;s it! Good luck!</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/linux" rel="tag">linux</a>, <a href="http://technorati.com/tag/dd" rel="tag"> dd</a>, <a href="http://technorati.com/tag/drive+recovery" rel="tag"> drive recovery</a>, <a href="http://technorati.com/tag/corrupted+hardrive" rel="tag"> corrupted hardrive</a></p>
   ]]></content:encoded>
			<wfw:commentRss>http://alterlabs.com/technologies/java/use-linux-to-recover-a-corrupted-windows-drive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
