Whew, it was a pain but I finally got the drive imaged. Even though I marked
the blocks as bad partimage
still failed due to bad blocks. I thought
partimage was intelligent and read the file system data so that it only backed
up the blocks in use by the file system, but apparently not in this case.
There probably is a really good reason that I don't understand since I'm not a
file system expert.
Anyway, I finally got it to work with dd. I just marked the bad blocks like
mentioned in this
previous
post then followed the steps I gave
here to
zero out the free space and make the image. The only thing I did different was
I piped it through
split to divide the image into manageable hunks that can
fit on a FAT32 partition or onto a DVD-R. Oddly enough, prior to marking the
blocks as bad dd complained about finding bad blocks. But, after marking them
as bad dd didn't complain at all. This is the command I ultimately used:
# dd if=/dev/hda2 conv=sync,noerror bs=64K | gzip -c | split -b 2000m - hda2.img.gz.
This produced a 3 files named hda2.img.gz.aa, hda2.img.gz.ab, and
hda2.img.gz.ac with the total being just over 4GB when added together. The
actual data was about 7GB on this partition so zeroing out the free space
really did help cut down the image size, considering that the partition is
about 19GB in size.
I haven't tested it yet, but I figure I can get the image back using something
like:
# cat hda2.img.gz.* | guzip -c | dd of=/dev/hda2 conv=sync,noerror bs=64K
So, why did I take all this effort to make an image rather than using something
like tar? Well, no real reason other than a utility like partimage
should be able to work around an issue like this. This is a drive
that is brand new, and sometimes a new drive has errors. A couple of bad
sectors are OK as long as the file system knows about it and does not use them.
If I want to backup a drive like this using a program like partimage then I
should be able to. Actually, the odd thing is, I would have never known the
bad blocks existed if I didn't try using partimage. reiserfsck --check never
found a single problem.
Sure I could have used tar, but then I wouldn't have learned how to use common
Linux tools to do the same job!