<?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>Some stuff &#187; hard disk recovery</title>
	<atom:link href="http://blog.yhuang.org/?feed=rss2&#038;tag=hard-disk-recovery" rel="self" type="application/rss+xml" />
	<link>https://blog.yhuang.org</link>
	<description>here.</description>
	<lastBuildDate>Wed, 27 Aug 2025 08:50:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Useful information (Appendix)</title>
		<link>https://blog.yhuang.org/?p=47</link>
		<comments>https://blog.yhuang.org/?p=47#comments</comments>
		<pubDate>Mon, 08 Jan 2007 03:24:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Appendix]]></category>
		<category><![CDATA[ddrescue]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[ext]]></category>
		<category><![CDATA[ext2 file system]]></category>
		<category><![CDATA[ext2 partition]]></category>
		<category><![CDATA[ext2 partitions]]></category>
		<category><![CDATA[external usb drive]]></category>
		<category><![CDATA[hard disk recovery]]></category>
		<category><![CDATA[recovery]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=47</guid>
		<description><![CDATA[This is part of the hard disk recovery documentation. Appendix. Here are all the tools that made an arguably irreplaceable contribution in the recovery: Knoppix CD ddrescue DiskProbe fsstat (part of Knoppix) ext2 Installable File System (use with caution, as it may crap on your ext2 partition) Mount Image Pro vdk nfi chkdsk (part of [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the hard disk recovery documentation.</p>
<p>Appendix.</p>
<p>Here are all the tools that made an arguably irreplaceable contribution in the recovery:</p>
<ul>
<li><a href="http://www.knoppix.org/">Knoppix CD</a></li>
<li><a href="http://ftp.gnu.org/gnu/ddrescue/">ddrescue</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=49AE8576-9BB9-4126-9761-BA8011FABF38&#038;displaylang=en">DiskProbe</a></li>
<li>fsstat (part of Knoppix)</li>
<li><a href="http://www.fs-driver.org/download.html">ext2 Installable File System</a> (use with caution, as it may crap on your ext2 partition)</li>
<li><a href="http://www.mountimage.com/download-computer-forensics-software.php">Mount Image Pro</a></li>
<li><a href="http://chitchat.at.infoseek.co.jp/vmware/vdk.html">vdk</a></li>
<li><a href="http://support.microsoft.com/kb/253066">nfi</a></li>
<li>chkdsk (part of Windows XP)</li>
<li>ntbackup (part of Windows XP)</li>
<li><a href="http://www.elcomsoft.com/aefsdr.html">Advanced EFS Data Recovery</a></li>
</ul>
<p><span id="more-47"></span><br />
Here are some additional links that I looked at, with more information:</p>
<ul>
<li><a href="http://geeksaresexy.blogspot.com/2005/12/hard-drive-recovery-utilities-when-you.html">Hard disk recovery utilities</a></li>
<li><a href="http://www.ngine.de/index.jsp?pageid=4176">Installing XP on external USB drive</a></li>
<li><a href="http://www.pcinspector.de/file_recovery/uk/faq.htm">&#8220;PC Inspector&#8221; recovery software</a></li>
<li><a href="http://www.stellarinfo.com/">&#8220;Stellar&#8221; recovery software</a></li>
<li><a href="http://geschonneck.com/security/forensics/">Forensics tools</a></li>
<li><a href="http://freshmeat.net/projects/addrescue/?branch_id=52446&#038;release_id=243389">ddrescue documentation</a> and <a href="http://serverfault.com/questions/4906/using-dd-for-disk-cloning">discussion</a></li>
<li><a href="http://www.kernel.org/pub/dist/knoppix-dvd/knoppix-cheatcodes.txt">Knoppix boot options</a></li>
<li><a href="http://www.linuxquestions.org/questions/showthread.php?t=485322">Tips on NTFS recovery from ddrescue image and log</a></li>
<li><a href="http://www.ntfs.com/ntfs.htm">NTFS file system description</a></li>
<li><a href="http://www.linux-ntfs.org/content/view/104/43/">More technical information about NTFS</a></li>
<li><a href="http://www.science.unitn.it/~fiorella/guidelinux/tlk/node95.html">Ext2 file system description</a> (I only found the section entitled &#8220;The ext2 Group Descriptor&#8221; to be helpful. I put little trust in the correctness of the rest.)</li>
<li><a href="http://oss.oracle.com/projects/ocfs2/dist/documentation/disklayout.pdf">Disk layout of ext2 and ocfs2</a> (The data structures and the example of what the Group Descriptor Table were useful. The rest like the &#8220;first data block&#8221; value is different from what is observed &#8212; although the examples use a block size of 1KB, which may make a difference.)</li>
</ul>
<p>For the record, here are the two external disks I have with their ext2 partitions&#8217; Superblocks shown:</p>
<p>100GB disk, just one ext2 partition, starts at sector 63.<br />
<img src="wp-content/uploads/images/sector1.png"/></p>
<p>160GB disk, there is a 20GB FAT32 partition, and the second ext2 partition starts at sector 41945715. This is the partition whose backup superblocks are all off by +1KB (but are otherwise correct), and hence has an illegal formatting.<br />
<img src="wp-content/uploads/images/sector2.png"/></p>
<p>And here are the ddrescue log files, from the <a href="wp-content/uploads/rescue1.log">first run</a> and the <a href="wp-content/uploads/rescue2.log">second run</a>.</p>
<p>Back to <a href="http://scripts.mit.edu/~zong/wpress/?p=35">the beginning</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=47</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Today I can go no farther (part 6)</title>
		<link>https://blog.yhuang.org/?p=46</link>
		<comments>https://blog.yhuang.org/?p=46#comments</comments>
		<pubDate>Sun, 31 Dec 2006 03:53:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[certificate store]]></category>
		<category><![CDATA[ddrescue]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[external storage device]]></category>
		<category><![CDATA[hard disk recovery]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[logical conclusion]]></category>
		<category><![CDATA[recovery]]></category>
		<category><![CDATA[Seagate]]></category>
		<category><![CDATA[seagate drive]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=46</guid>
		<description><![CDATA[This is part of the hard disk recovery documentation. Part 6. Today I can go no farther (so I stopped) The last days of this project are spent on two tiring tasks that do not gain me very much, but must be done to carry this project to its logical conclusion. One of these is [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the hard disk recovery documentation.</p>
<p>Part 6.</p>
<p><font color="#770033"><br />
Today I can go no farther (so I stopped)</p>
<p>The last days of this project are spent on two tiring tasks that do not gain me very much, but must be done to carry this project to its logical conclusion. One of these is to decrypt a few very small, but important NTFS-encrypted files. The other is to wring the last readable bits out of the broken Seagate drive by splitting all the error regions to isolate the unreadable regions as much as possible. These can proceed in parallel.</font><br />
<span id="more-46"></span><br />
<font color="#770033">I set Knoppix to slave away on the broken Seagate drive using ddrescue again. This ended up taking more than one day constantly running and made the disk really hot. I had to manually intervene from time to time just so this will get somewhere. This is where I wished ddrescue was smarter about skipping around unreadable regions.</p>
<p>The other task was more interesting from a learning perspective. When a file is to be encrypted by NTFS, it generates a file-specific symmetric &#8220;file encryption key&#8221; and stores the key with the file. Of course the key isn&#8217;t stored in plaintext but is encrypted using the user&#8217;s public key and is only decodeable by the user&#8217;s private key. Normally the user should export the private key into a .pfx certificate file and store it on a smart card or USB pen drive or something, and more importantly, remove it from the certificate store on Windows. I did make a copy of the private key off the computer. I could just re-import the certificate, and then decrypting the data would be trivial. But the external storage device that holds the private key isn&#8217;t with me during the break, unfortunately. On the other hand, I didn&#8217;t bother to remove the private key from the computer either, because I wasn&#8217;t really serious about this particular piece of data, just toying around with the NTFS encryption feature, mostly.</p>
<p>That made the encrypted file potentially recoverable without delay. Windows doesn&#8217;t store the user&#8217;s private key in plaintext either, of course. From what I understand, the user&#8217;s private key is encrypted somehow with user&#8217;s password hash, then maybe it is encrypted again with a master key belonging to the system. Somehow, the system&#8217;s master key is the weak link. I think it is stored in the SAM database of the system registry, which is in %SYSTEMROOT%\system32\config, though I may be mistaken on this point. The user&#8217;s various keys are stored in %USERPROFILE%\Application Data\Microsoft\Protect and %USERPROFILE%\Application Data\Microsoft\Crypto. Here is <a href="http://www.beginningtoseethelight.org/efsrecovery/index.php">another explanation</a> of this.</p>
<p>To make a long story short, if all of these files are available, and the user&#8217;s password is known, then it is possible to recover the encrypted files directly from the drive without an explicitly exported private key (hence encryption with these files around is ultimately pointless).</p>
<p>I ended up using the <a href="http://www.elcomsoft.com/aefsdr.html">Elcomsoft Advanced EFS Data Recovery</a> tool (AEFSDR). They have a trial version, too. Unfortunately it&#8217;s crippleware, unlike Mount Image Pro. All I can say is, if you really want to decrypt files, you find a way around the &#8220;cripple&#8221; in crippleware. Enough said.</p>
<p>For the record, AEFSDR is pretty good and fast. However, I am also not completely satisfied by it. I haven&#8217;t found any bugs, but the problem with it is its incompleteness. I don&#8217;t know what file system access method it uses, but it cannot see any removable drives, including removable USB drives or any mounted virtual disks (e.g. by Mount Image Pro). This is severely limiting, because encrypted files are not easily copied (Windows says Permission Denied), and I basically ran into a wall because of this. Please, AEFSDR, go work on this some more. You are selling a <b>recovery</b> tool, so your users are most likely in desperate straits with limited resources&#8230; they don&#8217;t want to deal with your programming kludges.</p>
<p>The way around it is to use NTBACKUP (part of Windows), which can archive encrypted files to a backup image, and then you can restore these files onto a permanent physical disk. After also copying the security related files from Windows to a permanent physical disk, AEFSDR decrypts all files successfully.</p>
<p>RELOADING THE DDRESCUE IMAGE</p>
<p>After I got as much as I am ever going to get out of the Seagate disk using ddrescue (I got another few tens of megabytes out of the disk), I retraced the steps on the new image. This time, the image loads as a valid NTFS partition and Windows will read it (apparently the last few bits recovered was pretty important). However, the Windows directory is still not readable, although almost all other directories are directly readable. NFI also works on the image &#8212; this is very good, as it means I can finally profile what I lost down to the last sector. I also ran chkdsk on it again &#8212; fewer errors to correct this time, but hopefully fewer zero-filled data issues to deal with at the end of the day. This chkdsk&#8217;d image is now the gold recovery image. I backed it up immediately.</p>
<p>That is the end of it. The story has a happy ending, but what a giant waste of time. Back up your data.</font></p>
<p>Lessons today:</p>
<ul>
<li>AEFSDR is nice. But I wouldn&#8217;t buy it, either.</li>
<li>Remove your private keys from the computer.</li>
<li>Near total data recovery is very possible from an apparently dead drive, but a delicate procedure needs to be followed.</li>
<li>The right tools are very important, and a complete disk recovery toolchain simply does not exist &#8212; you are left to find your own pieces.</li>
</ul>
<p>On to <a href="http://scripts.mit.edu/~zong/wpress/?p=47">the Appendix</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=46</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>I rammed my head against the wall, and all was clear (part 4)</title>
		<link>https://blog.yhuang.org/?p=44</link>
		<comments>https://blog.yhuang.org/?p=44#comments</comments>
		<pubDate>Wed, 27 Dec 2006 21:23:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[contiguous blocks]]></category>
		<category><![CDATA[contiguous groups]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[ext2 filesystem]]></category>
		<category><![CDATA[hard disk recovery]]></category>
		<category><![CDATA[recovery]]></category>
		<category><![CDATA[Superblock]]></category>
		<category><![CDATA[system parameters]]></category>
		<category><![CDATA[Table]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=44</guid>
		<description><![CDATA[This is part of the hard disk recovery documentation. Part 4. I rammed my head against the wall (of absurdity that is ext2), and all was clear The obvious need to fork off another hard disk recovery project from a hard disk recovery project was just too pathetic to think about so I kicked this [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the hard disk recovery documentation.</p>
<p>Part 4.</p>
<p><font color="#770033"><br />
I rammed my head against the wall (of absurdity that is ext2), and all was clear</p>
<p>The obvious need to fork off <b>another</b> hard disk recovery project from a hard disk recovery project was just too pathetic to think about so I kicked this aside for a day. Today I started back from the beginning, this time researching the ext2 filesystem. The documentation (that is within reach of Google) for this file system is just poor. Whoever is responsible for documenting this part of Linux should be flogged, or at least made to go home and do it over. Yeah, I can go look at the source code (which I did), but I&#8217;m sorry, that does not constitute proper documentation.<br />
</font><br />
<span id="more-44"></span><br />
<font color="#770033"><br />
What I gathered:</p>
<p>The ext2 physical structure consists of a basic unit called a block, whose size in bytes can be set at formatting time. Contiguous blocks are organized into groups, and contiguous groups make up the partition. The groups are of equal size, each containing by default 32768 blocks (on my partition a block is 4KB, so I guess a group is 128MB). </p>
<p>The next part is where I depart from the random <b>wrong</b> stuff strewn around the internet. I know they are wrong because I actually looked at the disk, but it caused me a lot of headache. The first group (Group 0) contains a 1KB filler, which some people like to call the &#8220;boot block&#8221; for unknown reasons (so far as I can tell, it doesn&#8217;t boot anything and it isn&#8217;t a block in size), followed by the 1KB Superblock (also not a block in size), which is like a filesystem header.  It carries a bunch of file system parameters, and an identifying two-byte sequence called the &#8220;magic number.&#8221;  At 4KB (for my block size) into Group 0 begins the Group Descriptor Table, which is also a filesystem header.  The Group Descriptor Table contains 32-byte entries, one entry for each group on the disk, and each entry telling the location of the block bitmap (i.e. allocation table for blocks) and the inode bitmap (i.e. allocation table for inodes) belonging to that group.</p>
<p>The subsequent groups all have the same Group Descriptor Table at the same position in the group as in Group 0, and <b>some</b> of the groups also have a copy of the 1KB Superblock at its front (not at the 1KB position). The last part is important. The first two Superblocks are <b>not</b> 32768 blocks apart.</p>
<p>That is the gist of it. I didn&#8217;t bother with the block and inode allocation strategies because those aren&#8217;t important to me.</p>
<p>So when Knoppix said the Group Descriptor Table was corrupt, it means one or more of entries are pointing to the wrong places. Also when it says could not find the Superblock due to a &#8220;bad magic number,&#8221; it most likely means the Superblock copies in other groups are all overwritten, or, not where they are expected to be found, so they or the Group Descriptor Tables can&#8217;t be used to correct the Group 0 ones.</p>
<p>To find out what happened exactly, a disk editor was needed. I used to know a pretty good one for DOS, but I lost it. However, <a href="http://www.microsoft.com/downloads/details.aspx?familyid=49AE8576-9BB9-4126-9761-BA8011FABF38&#038;displaylang=en">Windows Support Tools for Advanced Users</a> has a Windows tool (used to be in the NT resource kit) called DiskProbe (dskprobe.exe) that does the trick. It&#8217;s a bit annoying that disk positions must be counted in units of sectors (512 B), but oh well. Also the Linux tool called fsstat was used, which dumps information read from the Superblock and Group Descriptor Table out one group at a time, whatever they contain (corrupt or not).</p>
<p>What I found, from fsstat, and from comparing with another disk formatted similarly with ext2, is all the Superblock copies in the groups that should have them are there, but offset by 1KB. How this happened I do not know. Seems like a bug of mkfs to me (it has to be mkfs because where the Superblock is supposed to be resides prior data). As for the source of the problem, the Group Descriptor Table stored in Group 0 has one entry in which 4 bytes were overwritten with 0x7FFFFFFF. How <b>that</b> happened I also do not know for sure, but it is almost certainly the fault of ext2ifs, since that is the only thing to touch the partition between it working and not working. But as 4 bytes appears to be the extent of the corruption, and the backup Group Descriptor Tables are perfectly good (they just can&#8217;t be found by silly Knoppix), I just copied four bytes by hand in DiskProbe, and bam, the ext2 file system was mountable again by Knoppix.</p>
<p>The absurdity is that not only did a presumably illegal ext2 file system get written onto the disk, but also none of the ext2 fs check tools were able to find where the correct Superblocks were, even though they were just 1KB away, and furthermore, gpart, the Linux program that is supposed to guess what partitions are on the disk, could not even identify this partition as ext2, despite the Group 0 Superblock being intact and all the other structures being obviously ext2. Whoever wrote these parts of Linux should be flogged, or at least made to go home and write documentation instead.</font></p>
<p>Lessons today:</p>
<ul>
<li>The backup littering &#8220;strategy&#8221; of ext2 is only better than nothing&#8230; it is way too simple-minded and needs way too much hand-holding.</li>
<li>Not one piece of software can be trusted to do the right thing.</li>
</ul>
<p>On to <a href="http://scripts.mit.edu/~zong/wpress/?p=45">Part 5</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=44</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Today I became suspicious of everything (part 3)</title>
		<link>https://blog.yhuang.org/?p=38</link>
		<comments>https://blog.yhuang.org/?p=38#comments</comments>
		<pubDate>Mon, 25 Dec 2006 17:06:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bad sectors]]></category>
		<category><![CDATA[ddrescue]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[everything]]></category>
		<category><![CDATA[hard disk recovery]]></category>
		<category><![CDATA[image rescue]]></category>
		<category><![CDATA[MiB]]></category>
		<category><![CDATA[perpendicular recording technology]]></category>
		<category><![CDATA[rescue image]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=38</guid>
		<description><![CDATA[This is part of the hard disk recovery documentation. Part 3. Today I became suspicious of (the ext2ifs driver, the mkfs command, the USB enclosure, and basically) everything On Christmas morning Santa Claus had not granted my wish: ddrescue was still running, but the image file had not been timestamped any more recently than when [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the hard disk recovery documentation.</p>
<p>Part 3.</p>
<p><font color="#770033"><br />
Today I became suspicious of (the ext2ifs driver, the mkfs command, the USB enclosure, and basically) everything</p>
<p>On Christmas morning Santa Claus had not granted my wish: ddrescue was still running, but the image file had not been timestamped any more recently than when I left it, and the damaged drive had spun down by itself.  dmesg revealed a syslog message &#8220;too many IO errors&#8221; or something like that, which had caused Linux to give up on reading from the damaged drive.  I was very frustrated because, well let&#8217;s see, I had expected the disk imaging to make good progress, but instead&#8230; I must suffer a reboot and the induced indefinite re-churning of the drive, with even more data loss!  What.</font><br />
<span id="more-38"></span><br />
<font color="#770033">Attempting to reboot, I got impatient and tried the Dell Diagnostic partition again.  To my dismay, the Dell Diagnostic partition had become unreadable, a sure sign that the disk&#8217;s failures were worsening, adding more urgency to the recovery mission.  With no viable second option, I booted Knoppix again and resigned myself to the disk churning.  Finally I was in again and started ddrescue back up at about 4000MB, to skip the errors at 3200MB.</p>
<p>  /media/sda2#  ddrescue -B -n -i4000M /dev/hda rescue.image rescue.log</p>
<table align="right" width="300" border="1" cellpadding="10" style="margin: 2 2 2 2; background: #FFFFFF; border-collapse: collapse; border-style: dashed; border-color: #365873;">
<tr>
<td>
At some point I had to get a replacement hard drive. 80GB seemed to be the right price point, and somehow I narrowed it down to just two &#8220;choices&#8221;: a Seagate Momentous 5400.3 (with Perpendicular Recording Technology) believe it or not, and another one by Fujitsu, so it wasn&#8217;t much of a choice.  The Seagate had already received reviews noting bad sectors (!) and I really did not want another one of those.  I also rang Dell to see if the parts would be interchangeable (mostly on the question of the CD drive).  Unfortunately, Dell would not give me a straight answer, but after insisting on getting my personal information, they told me &#8220;your warranty has expired,&#8221; &#8220;but you have unlimited lifetime phone support,&#8221; which turned out to be a person on the other end putting me on hold for minutes at a time every time I asked a question to go read a manual and coming back with some inane suggestion.  For example, I was told to repeat things I said I already tried, in particular to go into the Dell Diagnostic partition which of course was already dead.  His eventual diagnosis was, &#8220;it has been determined that, sir, you have a hardware problem, not a software problem, and due to your warranty has already expired, you may get a new drive from anywhere, just make sure to get a 40GB IDE disk&#8221; (presumably to match the original).  So I wrote off the wasted hour on that call as sunk cost, and went ahead with the Fujitsu drive.
</td>
</tr>
</table>
<p>It continued to stick briefly at roughly 1GB intervals of data transfered, sometimes less.  Sometimes I would manually interrupt the process and re-start it at a later point.  This ddrescue allows with no problem because it uses its log intelligently, to patch together various chunks of recovered data, such that validly transferred data was never reread and interruptions were not costly to the recovered image.  Wishing to avoid a repeat of the inextricable-3200MB-error from Sunday night, I interrupted ddrescue whenever it seemed to be stuck long.  I noted the following sticking-points:</p>
<p>  3277MiB<br />
  9798MiB<br />
  10415MiB<br />
  10917MiB<br />
  11906MiB<br />
  13885MiB<br />
  24499MiB<br />
  25890MiB<br />
  27394MiB<br />
  27851MiB<br />
  31280MiB<br />
  32799MiB<br />
  33748MiB<br />
  35065MiB<br />
  36954MiB</p>
<p>The data corruption pattern covers the entire disk &#8212; so far as there is any physical correspondence &#8212; but affects only a small percentage of disk&#8217;s data.  In fact, the recovery to error ratio was at least 100:1.  I eventually transferred about 38GB of raw bits out of the 40GB disk.</p>
<p>By the way, the -n option demands &#8220;no error splitting&#8221; meaning that a 64K-chunk of data with any read problems is marked as wholly erroneous (or &#8220;/&#8221; in the log file&#8230; good data is &#8220;+&#8221; in the log file).  After the runs with -n, I did a run with error splitting on a small portion on the disk, forcing ddrescue to analyze only the 64K-chunks with errors on the original run.  With this method, I recovered yet more data (&#8220;/&#8221; became mostly &#8220;+&#8221; and some &#8220;-&#8221;).</p>
<p>TRYING THE RAW IMAGE UNDER WINDOWS</p>
<p>Before attacking more chunks with error-splitting, I decided to examine the current state of the disk image.  There would be no point to try very hard on the bad parts if the useful files were already contained in the &#8220;+&#8221; regions.  Just from the log file, I was pleased to find the first 5K intact (this includes the first sector holding the MBR and partition table), then many errors in the front of the drive which were in the Dell Diagnostic partition, followed by several hundred MB intact, which would include the boot sector of the NTFS partition and the front of its master file table hopefully.  A chunk of the end of the drive was also intact, which should contain the backup NTFS boot sector.  Things were looking much better.</p>
<p>So I next planned to mount the image under Windows, since many NTFS analysis tools run only on Windows.  To do this, I needed a filesystem driver to read ext2 under Windows.  There are a few, but the <a href="http://www.fs-driver.org/">&#8220;ext2 Installable File System for Windows&#8221;</a> or ext2ifs boasts Kernel-mode extension of the Windows file system that &#8220;<i>is indeed comparable to Windows NT&#8217;s native file system drivers</i>&#8220;.  Not really, as the implementation is missing some behavior one would expect from Windows but it does behave in such a way that most of the usual higher-level filesystem manipulations can be done directly on the ext2 volume, including getting real drive letters and the ability to perform file manipulation directly (without requiring a specialized file manager).</p>
<p>First I wanted to make a copy of the image file, for two reasons: <u>to have a copy to work with without endangering the recovered data</u>, and to put the original back into ddrescue to churn away at erroneous chunks according to which chunks turn out to be important.  In retrospect I could have made this copy under Linux, but since I had ext2 already mounted in Windows, I just made the copy under Windows.  While it was doing this copying, guess what, the source drive (the external USB drive) became unreadable.  Uh&#8230;&#8230;</p>
<p>I took the drive with the 38GB of good data back into Knoppix Linux, and Linux could not mount it either.  Uh&#8230;&#8230;</p>
<p>  # dmesg | tail</p>
<p>&#8220;Corrupt group descriptor: bad block for inode bitmap&#8221; etc. etc.  Uh&#8230;&#8230;</p>
<p>What did the ext2ifs driver do? There is not a single reason it should have touched the group descriptor table.</p>
<p>  # e2fsck /dev/sda2</p>
<p>&#8220;e2fsck: Bad magic number in super-block while trying to open /dev/sda2<br />
The superblock could not be read or does not describe a correct ext2 filesystem.&#8221; etc. etc.  Uh&#8230;&#8230;</p>
<p>What did mkfs.ext2 do? There are backups of these file system parameters, why are they all bad now?</p>
<p>What did the USB enclosure do? It didn&#8217;t barf all over the disk, did it?</p>
<p>This completely goes against the original intention of having a <b>good</b> copy of the data! And at this point I need to fork a sub-project to work on recovering the ext2 volume, because I don&#8217;t think I can read all 38GB of the already-recovered data back out of the dead Seagate again.  Argh!!  I called it a night.</font></p>
<p>Lessons today:</p>
<ul>
<li>I shouldn&#8217;t fork the project, I should just bork it altogether. The gods clearly aren&#8217;t working with me.</li>
<li>Of course I should keep working at this. I just need to use proven technology when making a crucial file copy.</li>
<li>ddrescue is good about skipping over good areas of the disk already scanned, but isn&#8217;t intelligent about scanning the bad areas of the disk.</li>
<li>Dell support is truly useless.</li>
</ul>
<p>On to <a href="http://scripts.mit.edu/~zong/wpress/?p=44">Part 4</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=38</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I tried a whole bunch of things, and all that (part 2)</title>
		<link>https://blog.yhuang.org/?p=37</link>
		<comments>https://blog.yhuang.org/?p=37#comments</comments>
		<pubDate>Sun, 24 Dec 2006 08:18:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[data recovery services]]></category>
		<category><![CDATA[ddrescue]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[external usb hard disk]]></category>
		<category><![CDATA[hard disk recovery]]></category>
		<category><![CDATA[miracle recovery]]></category>
		<category><![CDATA[usb hard disk]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=37</guid>
		<description><![CDATA[This is part of the hard disk recovery documentation. Part 2. I tried a whole bunch of things (most that didn&#8217;t work), and all that. What is there to do? Data recovery services that run into the thousands of dollars can probably get most of the data back &#8212; they have a track record of [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the hard disk recovery documentation.</p>
<p>Part 2.</p>
<p><font color="#770033"><br />
I tried a whole bunch of things (most that didn&#8217;t work), and all that.</p>
<p>What is there to do?  Data recovery services that run into the thousands of dollars can probably get most of the data back &#8212; they have a track record of that.  My data isn&#8217;t worth nearly that much, sad to say.  But I don&#8217;t feel like abandoning perfectly good data, either.  Yes, there is probably McNorton ViralGhostSpy or whatever this bloatware is called these days; I don&#8217;t know&#8230; I prefer more flexibility so I&#8217;ll take the trouble to proceed with free or freely available tools.</font><br />
<span id="more-37"></span><br />
<font color="#770033">Since the Seagate disk is too dead to figure out what is on itself, I need to get its contents off onto another medium.  I need two things: some means of getting the only computer that can read the disk as is (the laptop) into a working state, and some means of direct disk copying from the laptop.  I have an enclosured USB drive: 160GB.  Let&#8217;s work with that.  To protect the original broken Seagate, I left it out of the laptop for the time being.</p>
<p>Many a self-proclaimed miracle recovery boot disks/discs conceivably take care of both tasks.  A quick search turns up a boot floppy software called &#8220;EaseUs disk copy&#8221; using a self-booting &#8220;freedos&#8221; but it was useless because it would like to copy <b>within</b> a computer (from master IDE drive to slave).  Into the trash it goes.  There were a few others like this, all useless.</p>
<p>Next up, I&#8217;ve got some Windows-based disk editor tool.  Maybe I can install Windows on this external USB hard disk so I can boot the laptop?  No.  Evidently <a href="http://www.microsoft.com/whdc/device/storage/usb-boot.mspx">it isn&#8217;t supported</a>.  Windows installed fine on the external USB drive (all files are copied), but on the first boot BSOD&#8217;d.  Some say there is a way to <a href="http://www.ngine.de/index.jsp?pageid=4176">hack the Windows CD</a> to make this work.  Well I don&#8217;t have that much time to waste, so forget that.</p>
<p>Next up, Knoppix version 5 (Linux Knoppix 2.6.17 #4 SMP PREEMPT, i686 GNU/Linux).  I had some difficulty mounting the external USB hard drive, but finally by booting from CD, <b>then</b> attaching the external drive <b>after startup</b>, Knoppix found it and stuck it under /dev/sdaN (for N in 1,2,etc.).  The drive had a 20GB FAT32 partition already (where I attempted to install Windows before), along with an empty 120GB partition, so the empty partition was at /dev/sda2.</p>
<p>These days, the favorite recovery tool under Knoppix seems to be the ignore-on-read-error disk copy tool called <a href="http://www.gnu.org/software/ddrescue/ddrescue.html">ddrescue</a> (not the Knoppix-included <a href="http://www.garloff.de/kurt/linux/ddrescue/">dd_rescue</a>).  I believe the difference is that ddrescue is much more automatic in dealing with the log file &#8212; this is important.  Both will copy a disk&#8217;s contents into a disk image file.  ddrescue needs to be compiled though; fortunately compilation was clean.</p>
<p>The choice of filesystem for /dev/sda2, which would hold the disk image, was limited.  The plan was to eventually read the data on a Windows computer, which would be easiest with FAT32 or NTFS.  However, NTFS write-support on Knoppix is of unknown reliability (&#8211; why? I don&#8217;t know).  I tried FAT32, using mkdosfs to format because Windows refuses to format a FAT32 volume larger than 32GB.  Then I even began copying data before realizing, to my chagrin, that FAT32 has another limit: 4GB on the file size.  That left ext2, and its default block-size of 4K was fine (block-size under 2K would be a problem due to file size limitation), so something like:</p>
<p>  # mkfs.ext2 /dev/sda2<br />
  # mount -t ext2 /dev/sda2 /media/sda2</p>
<p>Progress.</p>
<p>Now, computer off.  Broken Seagate goes back in.  Boot.  And&#8230; no boot.  The boot sequence now stuck at two points where it wanted to read the Seagate drive (on /dev/hda):  First, it attempted to find a (nonexistent) CD on /dev/hda, resulting in churning the hard drive for a few seconds (damaging my data further, I&#8217;m sure!)  Next, at the auto-detection stage to create /etc/fstab, Knoppix repeatedly tried to read the drive, and apparently would go no further.  Online sources are rife with suggestions of passing the boot options &#8220;nofstab&#8221; and &#8220;noswap&#8221; to the kernel to solve this problem.  Wrong.  With these options set, it still had the same problem at the auto-creation of /etc/fstab.  The solution turned out to be nail-biting patience: After booting and allowing the auto-detection to proceed for 10+ minutes of now-familiar churn-churn-churn on the broken Seagate, heating it up and losing me more data, it eventually did go on and boot.  Um&#8230; whoever is responsible for this boot code should be flogged or at least, made to go home and work on it some more.  I can think of zero (0) reasons why this particular process warrants persisting through multiple disk read errors.</p>
<p>Now, /dev/hda wouldn&#8217;t mount (of course), but no matter. Here we have: </p>
<p>  /media/sda2#  ddrescue -B -n /dev/hda rescue.image rescue.log</p>
<p>ddrescue proceeded through the evening, surprising me by writing quite a bit of good data onto the disk image, even as it sticks briefly at various corrupted points, but then got bogged down at around 3200MB.  I left it to its own devices at 3AM.</font></p>
<p>Lessons today:</p>
<ul>
<li>Knoppix is genius. Why is there no Live-Windows-on-CD? Oh, I know why.</li>
<li>Knoppix is semi-retarded for disk recovery because it fights with a broken hard disk on boot.</li>
<li>FAT32 has a 4GB file-size limit even if you manage to format the volume to be rather large.</li>
<li>ddrescue is a great tool to have.</li>
</ul>
<p>On to <a href="http://scripts.mit.edu/~zong/wpress/?p=38">Part 3</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=37</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Today I became suspicious of Seagate products (part 1)</title>
		<link>https://blog.yhuang.org/?p=36</link>
		<comments>https://blog.yhuang.org/?p=36#comments</comments>
		<pubDate>Thu, 21 Dec 2006 23:43:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[confidence test]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[hard disk recovery]]></category>
		<category><![CDATA[mass input]]></category>
		<category><![CDATA[Momentus]]></category>
		<category><![CDATA[plastic]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[representative sampling]]></category>
		<category><![CDATA[seagate products]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=36</guid>
		<description><![CDATA[This is part of the hard disk recovery documentation. Part 1. Today I became suspicious of Seagate products (and my fortune in general) Windows XP was running, and programs were being used. The disk was probably being accessed for memory cache. I noticed the drive making repetitive noises, spinning down and then spinning up, and [...]]]></description>
			<content:encoded><![CDATA[<p>This is part of the hard disk recovery documentation.</p>
<p>Part 1.</p>
<p><font color="#770033"><br />
Today I became suspicious of Seagate products (and my fortune in general)</p>
<p>Windows XP was running, and programs were being used.  The disk was probably being accessed for memory cache.  I noticed the drive making repetitive noises, spinning down and then spinning up, and the machine became unusable.  I power-cycled the machine, and it was &#8220;NTOSKRNL.EXE is missing or corrupt.&#8221;  Bad news.</font><br />
<span id="more-36"></span><br />
<font color="#770033">To diagnose the problem, I booted the machine into &#8220;Dell diagnostic partition&#8221;, located at the front of the hard disk.  This partition booted with no problem.  Good?  I used the &#8220;disk diagnostic&#8221; tool, which passed basic disk parameter checks (size of disk, for example), but upon reading the disk soon found read errors on some sectors.  I started the same test at a later location to skip the damaged sectors, and passed a long error-free zone of the disk, but then encountered more erroneous sectors.  After this, I tried the &#8220;disk confidence test&#8221; tool, which reads only small portions of the disk at a time, as a representative sampling of disk integrity.  The test was proceding well, but I halted it for time reasons.</p>
<p>Next thing to do was to boot off the Windows XP CD, hoping to use its Recovery Console to see if the file system is still okay, and maybe try to fix the file system if the problem isn&#8217;t too serious.  At this point however, my CD drive made a loud clicking noise, and I found the spindle plastic at the axis of the CD had come off the drive.  Two malfunctions on the same day?  Woe is me.  What&#8217;s wrong with this picture &#8212; I don&#8217;t believe I killed any small animals today (or on any day really)!</p>
<p>So I pushed the spindle plastic back on, tried again.  No luck.  I conclude that the CD-ROM, my only other means of mass-input, is broken just when I need it quite much.  In my last attempt to fix anything today, I tried white-out as glue on the plastic part.  This worked.  Unfortunately, the CD drive vibrates far more than before, due to its spindle being now slightly off-kilter.  This isn&#8217;t going to last for very long&#8230;</p>
<p>So, in goes the XP CD and Recovery Console comes up, but the OS installation can&#8217;t even be found on the disk and there is no C: drive to inspect.  Ouch.  This is serious.  One screw off and out pops the hard disk.  Hoho!  It&#8217;s a Seagate Momentus ST94811A, a so-called &#8220;reliable&#8221; drive.  This machine is barely two years old!  Woe be to Seagate which made the drive.  Woe be to Seagate Momentus which is designed to run way too hot under the palm for a laptop hard disk anyway.  That should have tipped me off.  Hrmmmm.</font></p>
<p>Lessons today:</p>
<ul>
<li>When hard disk seems to churn more than usual paging (as in defragmentation-like churn), it may die soon.</li>
<li>When your browser repeatedly crashes for no apparent reason after paging in from disk, yet your RAM is verifiably good, your disk may die soon.</li>
<li>White-out is reasonably good plastic glue.</li>
<li>Dell diagnostic partition takes up almost 50MB of disk space.</li>
<li>Please choose a Seagate Momentus if you would like to burn your palm and lap.</li>
<li>If there is some data you would rather not lose at this very moment, back up now.</li>
</ul>
<p>On to <a href="http://scripts.mit.edu/~zong/wpress/?p=37">Part 2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=36</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
