A true story: Loop device !relative addressing

Markus Stenberg (mstenber@cc.Helsinki.FI)
02 Jul 1999 08:48:47 +0300


I've just had _the_ most harrowing two days of my life. I happily defragged
my DOS drive, innocently forgetting that my (in ancient days initiated)
blowfish-encrypted ext2fs file was on it. Logically enough, when I next
booted Linux, Nasty Things happened (to be more precise, the filesystem did
not work).

After reading some notes, I gathered I was fucked, literally. The drive
(had?) contained two weeks' worth of work on various documents (my thesis,
among others).

My mood didn't improve when I faced same note everywhere: 'yeah, the data
is gone'. It was _NOT_. Only the first few bytes in each 512-byte block
were, obviously, considering the cypher chaining encryption setup
uses. This was enough for ext2fs not to accept it as a drive, however.

As I preferred spending some time figuring out how the ext2fs internals
worked over rewriting/rethinking a lot of stuff (data was in text format so
100% integrity wasn't needed), I just happily wrote ext2fs-reader, and then
added 'driver' for it that replaced all loop-translation-caused errors with
?:s. Net result was ~95% of data saved, 99% of what was important.

Moral of the story? I forgot it while I was writing this; it was somewhere
around the lines of 'original absolute translation scheme was _BAD_',
'backing up your data very often is _GOOD_' and 'I have a tool that can
maybe save someone's day in similar case'.

-Markus

P.S.
Is there a freeware ext2fs resizer? After looking a bit at the
internals of ext2fs, doing a resizer for it doesn't seem _that_
hard and if there are none, I might tackle that one of these
days. (LVM support would make ext2fs-resizing very appealing;
something on the lines of
- remount drive readonly
- resize / play with LVM (order depends on shrink/grow)
- remount drive writable
(With some careful locking of things whenever resizer was working
with things, obviously)

This would allow on-the-fly resizing which would be _very_ neat on
larger production systems. (ok, read-only time might confuse some
programs but the usual case, growing of filesystem, could be very
fast, judging by the ext2fs internals)

P.P.S.
If no ext2fs resizer exists, is there any >= ext2fs-level capable
filesystem for Linux with one? I have fairly lacking knowledge of
LFS, ReiserFS et al.

-- 
.. quote from a MU* .. ;-)
[Wizard] Fingon: man..
[Wizard] Fingon: I _hate_ C++. hate hate hate!
[Wizard] Fingon: if mr. stroustrup ran at me somewhere in Helsinki
(pref. at nighttime), he'd be sorry.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/