Fri, 22 Aug 2008
dd, dd_rescue, and ddrescue
The short answer: "Use GNU ddrescue. GNU stands for Quality."
dd is a classic UNIX utility to read from and write to files (often devices). Typically, one uses it to copy a hard disk to a file, or to image a hard drive by copying a backup onto it.
One hits a problem when the hard disk has errors. In this case, dd abruptly stops working in the middle, reporting an "Input/output error." But when the hard disk has errors, usually what you want is to get an image of all the blocks on the hard disk that are readable - not just the first few before the first error!
(Note for the pedantic: Yes, I know about dd conv=notrunc,noerror. They're so easy to misuse (mostly by forgetting one of those two options) that they're worth avoiding.)
Two tools are available for this particular purpose. Confusingly, one is called ddrescue, and the other is called dd_rescue.
Around 2001, Kurt Garloff wrote dd_rescue. It does what dd does if you pass it some options, but it comes with instructions on how to use it to recover data from drivers, like by running it multiple times or bakcwards. A wrapper script called dd_rhelp automates that process.
When you're running dd_rescue on an obscure OS like Mac OS X 10.3 because you dropped your laptop in Uganda and the Linux partition grew bad blocks and you still want your data, you will find that dd_rhelp is written as a complicated shell script that relies on GNU versions of core system utilities. OS X provides non-GNU versions, and you will waste hours fiddling with compiling those utilities just so you can run some dumb shell script.
In the summer of 2004, the same summer as I dropped my laptop, Antonio Diaz Diaz wrote "ddrescue," a stand-alone C++ tool that does the same things as dd_rhelp, but more sanely and therefore more efficiently. It became an official GNU project. GNU ddrescue, like dd_rhelp, can keep a log file to let itself gracefully pick up after interrputions.
When your hard disk fails, you should turn to your backups. But if you need a tool like these, just remember: "GNU ddrescue."
$ sudo apt-get install gddrescue
[/note/sysop] permanent link and comments
Wed, 20 Aug 2008
Lamers
Kragen Sitaker and his wife Beatrice were very gracious in hosting me and my brother for a week in Buenos Aires.
I was looking for something on Kragen's website and found a ten-years-old discussion of how to find security problems in software. In it, he writes:
Lamers, you say? Nelson took this picture of me a few years back. Look at the thumbs-up from the driver!
(Photo available for re-use under Creative Commons Attribution-ShareAlike 2.0.)
Note: Mako addressed this topic earlier this year, and then again more recently.
[/note/ba-2008] permanent link and comments
Tue, 19 Aug 2008
For Timo art with me
Chris Wakelin asks Timo of Dovecot to change his English usage:
Stewart Dean points out:
Psalm 23:4
[/scribble/code] permanent link and comments
Sun, 17 Aug 2008
Fake Out in Buenos Aires
"Falso," he said.
I accepted the 100 peso (US$30) note back. The only place we had gotten 100 peso notes were ATMs.
I found a different one with a good watermark and handed it to him. (This happened a bit over a week ago.)
[/note/ba-2008] permanent link and comments
Fri, 15 Aug 2008
Hello Planet Debian
I have a face on Planet Debian!
(Thanks to John Wright for setting it up for me!)
[/note/debian] permanent link and comments
Tue, 12 Aug 2008
Geocoding location
Writes Aldon Hynes:
Steve's head explodes.
[/scribble/code] permanent link and comments
Mon, 04 Aug 2008
Argentina for two weeks
For those of you I haven't told, I'm in Argentina. I've been here since Friday July 31. The idea is to take a week's vacation before heading to Mar del Plata for a week of the Debian conference, Debconf. This year, Debconf is held that beach resort town in the winter. From what I read, Mar del Plata is worth visiting even in this off season. On August 17, I'll be back in the Untied States (*).
The gracious Kragen Sitaker and Beatrice Murch are hosting me and my brother for a week in Buenos Aires. As a side note, right now I'm not in Buenos Aires but in a cold place called El Calafate.
On an overcast wintery day, B.A. looks like someone took a remix of Belgium and Paris and let it wear out a litte more than you'd expect from the Continentals. On any sort of day, from Kragen's and Beatrice's roof, it looks like someone ported Blade Runner to Europe.
(*.) [sic]
[/note/ba-2008] permanent link and comments
Francisco
Francisco is the name of the very energetic hostel attendant at America del Sud El Calafate.
After offering me a key (literally) for the wireless, he told me the password.
"What are you doing there?," he asked me. "It's email," I answered.
"Email? And how can you see? I can't see any letters." (The fonts are pretty small on my laptop.) "What program is that?"
"Pine," I said. "It's called Alpine."
He paused for a moment, and reported, "You look like a hacker with that." He patted me on the shoulder and wandered off.
[/note/ba-2008] permanent link and comments
Sun, 03 Aug 2008
Real DOS on a virtual disk
Sometimes you need to run DOS programs, like to flash BIOSs on your laptop. Sometimes, if you're Kragen, that lets you fix ACPI on your BIOS, giving you a hope that X will boot up more often than 1 in 3, sound will skip less, and the first PC card you insert will be assigned a valid IRQ. (The last one is particularly interesting: to get a working PC card before the promised joy of the BIOS update, you have to plug in one card, watch it get assigned the mostly broken IRQ 3, plug in a second card, watch it get assigned the useful IRQ 4, and then you can remove the first one. This is a good way to get a wifi card working.)
Here's a simple HOWTO for getting that going on a Linux machine without repartitioning or booting off external media.
I'll refer to aptitude; I'm assuming you're using a Debian/Ubuntu machine so that makes sense.
Step 1: Install syslinux
Now memdisk is in /usr/lib/syslinux/memdisk .
You should copy it to /boot/ in case your root filesystem is encrypted:
Step 2: Get your DOS floppy in /boot
Debian packages FreeDOS in dosemu-freedos. Unfortunately that doesn't include a floppy image. Instead:
Step 3: Configure GRUB
Put this in your /boot/grub/menu.list and smoke it:
Step 4: Reboot, and choose FreeDOS!
Ta-da, you're done.
More options
For bonus points, you can customize the floppy disk image. The easiest way to modify is to mount it loopback:
Then you can copy files into /mnt/, and then when you're done:
Ta-da, the image has been changed! (Thanks to Kragen for confirming that this actually works.)
The lame old way to customize the image is to use "mtools."
P.S. Thanks to Albert Lee for explaining this trick to me in the first place!
[/note/sysop] permanent link and comments