Bitcoin Forum
November 09, 2024, 03:56:14 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why is it not possible to move the blk* files to another server?  (Read 2453 times)
TAiS46 (OP)
Full Member
***
Offline Offline

Activity: 222
Merit: 100



View Profile WWW
February 20, 2013, 05:06:51 PM
 #1

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?
galaxyAbstractor
Full Member
***
Offline Offline

Activity: 147
Merit: 100



View Profile WWW
February 21, 2013, 10:10:53 AM
Last edit: February 21, 2013, 04:14:26 PM by galaxyAbstractor
 #2

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

1gaLaxy9csuBTvNLJYoUy6sengQbh1TpV
Pyramining - Invest in mining!
BookLover
Hero Member
*****
Offline Offline

Activity: 533
Merit: 500


^Bitcoin Library of Congress.


View Profile
February 21, 2013, 02:52:58 PM
 #3

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.

TAiS46 (OP)
Full Member
***
Offline Offline

Activity: 222
Merit: 100



View Profile WWW
February 21, 2013, 02:54:12 PM
 #4

Thank you,
I think this will work Smiley
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1036



View Profile WWW
February 23, 2013, 10:22:24 PM
 #5

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.
tinyapps
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile WWW
March 25, 2013, 01:40:27 AM
Last edit: March 29, 2013, 06:31:05 AM by tinyapps
 #6

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://bitcointalk.org/index.php?topic=143220.msg1666681#msg1666681 .

UPDATE: https://bitcointalk.org/index.php?topic=143220.msg1694068#msg1694068
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!