Finding a bzip2 file on a damaged hard drive

Moe Harley moeser at
Sat Apr 9 14:31:03 MDT 2005

Jordan Curzon wrote:

>BZip handles dropping the garbage off the end.

If that's true, you could just decide what the maximum limit of the file 
was and extract that.  For example, if you know it's not bigger than 12 
megs you could just grab 12 megs of the file starting at that bzip 
header.   Then pipe it into bzip2's stdin.  Any extra data at the end 
(assuming the above is true) would be thrown out.

Of course, extracting any files bigger than the block size of your 
partition will be a gamble.  There's no guarantee that the file was 
stored in consecutive blocks.  But since bzip files are generally 
created all-at-once instead of a piece at a time, the odds should be in 
your favor.

This all assumes i'm not misunderstanding something about the situation, 
drives, filesystems, bzip2, and uh... the state of the universe in 
general. ;)


More information about the PLUG mailing list