user659: My copy of blkindex.dat became corrupted, but I still have the whole blk0001.dat file.
Is it possible to reconstruct the blkindex.dat file from the blk0001.dat file or do I have to delete both files and redownload the whole blockchain from scratch?
Edit: Pieter's answer is working for me.  It's taking many hours to run, but at least it isn't using any bandwidth.  I'm wondering, as a related question, whether this bitcoind -loadblock=blk0001.dat.bak technique is a way of being able to get a trusted copy of the blockchain from an untrusted source.  If I download a blk0001.dat from a random website, then import it using this -loadblock command, does that ensure it's correct, and ask the network for anything the download was missing?
While running, the command just said:
SetBestChain: new best=00000000000004411998  height=174305  work=284206530118085534778
SetBestChain: new best=00000000000009a01d64  height=174306  work=284213516218692473063
InvalidChainFound: invalid block=000000000000038181de  height=174307  work=284220502319299411348
InvalidChainFound:  current best=00000000000009a01d64  height=174306  work=284213516218692473063
SetBestChain: new best=00000000000007e352ec  height=174307  work=284220502319299411348
SetBestChain: new best=00000000000006b4b91c  height=174308  work=284227488419906349633

Is that normal, representing an orphaned block?  Or possibly the result of the same disk error that caused the blkindex.dat to become corrupted initially?

user208: This is possible in git HEAD, and will be in 0.7.0. You can move the existing blk0001.dat elsewhere, delete blkindex.dat, and then start the client using ./bitcoind -loadblock=blk0001.dat.bak

659: <p>My copy of <code>blkindex.dat</code> became corrupted, but I still have the whole <code>blk0001.dat</code> file.</p>

<p>Is it possible to reconstruct the <code>blkindex.dat</code> file from the <code>blk0001.dat</code> file or do I have to delete both files and redownload the whole blockchain from scratch?</p>

<p>Edit: Pieter's answer is working for me.  It's taking many hours to run, but at least it isn't using any bandwidth.  I'm wondering, as a related question, whether this <code>bitcoind -loadblock=blk0001.dat.bak</code> technique is a way of being able to get a trusted copy of the blockchain from an untrusted source.  If I download a blk0001.dat from a random website, then import it using this -loadblock command, does that ensure it's correct, and ask the network for anything the download was missing?</p>

<p>While running, the command just said:</p>

<pre><code>SetBestChain: new best=00000000000004411998  height=174305  work=284206530118085534778
SetBestChain: new best=00000000000009a01d64  height=174306  work=284213516218692473063
InvalidChainFound: invalid block=000000000000038181de  height=174307  work=284220502319299411348
InvalidChainFound:  current best=00000000000009a01d64  height=174306  work=284213516218692473063
SetBestChain: new best=00000000000007e352ec  height=174307  work=284220502319299411348
SetBestChain: new best=00000000000006b4b91c  height=174308  work=284227488419906349633
</code></pre>

<p>Is that normal, representing an orphaned block?  Or possibly the result of the same disk error that caused the <code>blkindex.dat</code> to become corrupted initially?</p>
 208: <p>This is possible in git HEAD, and will be in 0.7.0. You can move the existing blk0001.dat elsewhere, delete blkindex.dat, and then start the client using <code>./bitcoind -loadblock=blk0001.dat.bak</code></p>
