Re: a cautionary tale w/ successful recovery
On Sun, Nov 01, 2009 at 02:57:49PM -0800, Andrew Sackville-West wrote:
> Hi all, mildly off-topic, perhaps.
> Due to a cascading series of errors on my part yesterday, I managed to
> not only wipe over my partition table, but also overwrite enough data
> in the actual disk to prevent reasonable recovery of the partitions
> with such tools as gpart.
> I could recover /boot, and /swap, but the lvm-hosted remaining portion
> of the system was hosed, mostly because I couldn't accurately locate
> the partition. Maybe if I'd been a little smarter about it, I could
> have, but I didn't know, until too late, what exactly to look for. So,
> after much gnashing of teeth and rending of clothing, I decided to
> Now mind you, this is the first reinstall on this machine (a very loose
> description considering it's had three motherboards, two disks and
> various and sundry parts swapped) since 2004.
> Installation was, of course, fairly painless using the daily-build
> business card image of squeeze. I had a couple of problems when
> partitioning, but got it sorted out after a reboot to properly re-read
> the partition table.
> So here is the real success part of the story: my backups worked! I
> had weekly backups of /etc and daily backups of /home. Since I'd not
> done any work of consequence in about 24 hours, I had not lost data!
> Restoring was a simple matter of copying over from the backup server,
> fixing up a couple of permissions and moving on.
> Lessons learned:
> 1) don't do risky things in DOS 6.22 when tired... you can't trust
> DOS to behave in a consistent manner (maybe)
> 2) keep a copy of the boot sector lying around (on another machine!!)
> 3) keep a copy of dpkg --get-selections lying around
> Now, I know bot 2) and 3), but hadn't really ever bothered to do
> it. It's *possible* that 2) could have saved me from reinstalling, but
> it still would have required significant work to get everything going
> 3) is just a convenience really. I have a pretty good idea of what
> packages I use on a daily basis are, but there are always random
> things one forgets and they'll probably crop up routinely over the
> next couple of months.
> Anyway, I just wanted to share that. And for all those who think they
> don't need backups... you're so wrong. I am truly grateful that I had
> good ones and the recovery went well.
A couple good utilites I've used in situations like these are testdisk
and photorec. Photorec can recover files even if there is no partition
table (it won't know the filename, but it will tell you the file type).