Author

Topic: Why is it not possible to move the blk* files to another server? (Read 2433 times)

newbie
Activity: 22
Merit: 0
Quote
In Bitcoin 0.8.0, the above files are not used, all subdirectories must be copied to the new server. It has also been reported that the new leveldb database format is not as portable, i.e. a datadir created on Linux might not work on Windows.
Thanks for the info, deepceleron. Do you know if it is possible to copy the 0.8 blockchain to a new computer by simply pasting the blocks and chainstate directories? Any further info on whether such a transfer would work cross-platform or not?

Sorry for cross posting - I did not receive a reply to this question here: https://bitcointalksearch.org/topic/m.1666681 .

UPDATE: https://bitcointalksearch.org/topic/m.1694068
legendary
Activity: 1512
Merit: 1032
You must not just move blk* files, but the ENTIRE data directory.

In bitcoin pre 0.8.0, you can move the blockchain after closing bitcoin with the detach option, but the files to move are blk000x.dat AND blkindex.dat, AND you must remove any files in the database subdirectory of the destination Bitcoin data directory.

In Bitcoin 0.8.0, the above files are not used, all subdirectories must be copied to the new server. It has also been reported that the new leveldb database format is not as portable, i.e. a datadir created on Linux might not work on Windows.

The reason for detaching the pre-0.8.0 Berkeley database before migration is similar, part of it's data structure and journaling is stored in the log files in the database subdirectory, and these are platform-specific, as the internal data will depend on the Bitcoin and library versions and platform you are running. Even copying the entire data directory may not work without "detach" if the destination is a different build environment.
full member
Activity: 222
Merit: 100
Thank you,
I think this will work Smiley
hero member
Activity: 533
Merit: 500
^Bitcoin Library of Congress.
Run Server1's bitcoind with the command option -detachdb.  Shut down bitcoind.  Move blk001.dat, blk002.dat, blk003.dat, and blkindex.dat to Server2.  Run Server2's bitcoind with the command option -detachdb.
For some reason you can't transfer the blockchain files for one bitcoin client to another without using the command option -detachdb. 

Note: you only need to use the command once, if you use it all the time you will notice a significant increase in the time needed to shutdown bitcoind.
full member
Activity: 147
Merit: 100
What do you mean? The files must be accessible locally by the client. If both shares are on the same network and there is a network share between them it should work to put the datadir on the network share then specify that path in the datadir argument when starting the bitcoin client.

Edit: Nvm I thought you meant running bitcoin on server #1 but have the files on #2
full member
Activity: 222
Merit: 100
Hello,

I set up some server and Server1 has the whole blk* files.
I stopped the Server1 and moved all blk* files to Server 2.

But if I start the bitcoind daemon, I get an error:
Code:
XCEPTION: St13runtime_error       
CDB() : can't open database file blkindex.dat, error 22       
bitcoin in AppInit()       

terminate called after throwing an instance of 'std::runtime_error'
  what():  CDB() : can't open database file blkindex.dat, error 22

I have tried a lot of things, but it does not work.
The only thing is to use -loadblock=file but it takes a while.

So why it is not possible to move the files to another server
and start the daemon?
Jump to: