Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: doghouse on February 11, 2013, 10:36:18 AM



Title: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: doghouse on February 11, 2013, 10:36:18 AM
This is a newbie question...

I've installed bitcoin-qt and Armoury on on a PC. After ages, (more than 8 hours) the blockchain is still downloading. (Last received block generated 175 days ago).
Instead of going through the same rigmarole again on another PC, can I install bitcoin-qt, and move the files from C:\Users\USERNAME\AppData\Roaming\Bitcoin to the new installation?

Which files do I need?
Are blk0001.dat, blk0002.dat and blkindex.dat enough? (I don't need to move my wallet.dat)

Can they just be "dropped into place", or is there a command line option I need to use to make it recognised?

Many Thanks!


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: Akka on February 11, 2013, 10:43:51 AM
Yes, that are the files you need, just copying the should be sufficient. But as you are not finished yet anyway, I would suggest, that you upgrade to v0.8 instead.

This Version uses ultraprune and reduces the download time for the blockchain to a few hours.

The final version is not out yet, but you can download the release candidate here: https://bitcointalk.org/index.php?topic=142151.0


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: doghouse on February 11, 2013, 11:36:29 AM
Hi Akka,
Thanks for your help!
I'm using v0.7.2-beta... when did v0.8 come out?

Can I still transpant the files over to 0.8?

Kind Regards.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: Akka on February 11, 2013, 11:43:40 AM
I'm using v0.7.2-beta... when did v0.8 come out?

3 days ago, so it's brand new.

Can I still transpant the files over to 0.8?

Kind Regards.

Yes and no, 0.8 needs to convert the files to the new format. If you are not finished downloading anyway, I would let it start new.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: Pieter Wuille on February 11, 2013, 09:42:01 PM
v0.8.0 is not released yet, there's only a release candidate.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: zvs on February 13, 2013, 09:17:03 AM
Hi Akka,
Thanks for your help!
I'm using v0.7.2-beta... when did v0.8 come out?

Can I still transpant the files over to 0.8?

Kind Regards.

i have a 7z of 0.8 reorganization @ http://www.nogleg.com/archive/v0.8.0-Feb-11th/v0.8.0-Feb-11th.7z   goes up to block 220800 or so..  it isn't "pruned", so it's just as big as before, but in a diff format

and then you'd delete everything but bitcoin.conf & wallet.dat, then use that for 0.8 rc

aha


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: BookLover on February 13, 2013, 03:26:44 PM
This is a newbie question...

I've installed bitcoin-qt and Armoury on on a PC. After ages, (more than 8 hours) the blockchain is still downloading. (Last received block generated 175 days ago).
Instead of going through the same rigmarole again on another PC, can I install bitcoin-qt, and move the files from C:\Users\USERNAME\AppData\Roaming\Bitcoin to the new installation?

Which files do I need?
Are blk0001.dat, blk0002.dat and blkindex.dat enough? (I don't need to move my wallet.dat)

Can they just be "dropped into place", or is there a command line option I need to use to make it recognised?

Many Thanks!
Yes, blk0001.dat, blk0002.dat and blkindex.dat are enough. (Unless there is a new blk0003.dat then you need it to.)
Before moving any files start both the bitcoin-qt clients, go to options, and check the box which says detach database at shutdown.  Then close both clients. (Make sure they are closed in taskmanager.) then you are free to move the block chain files.

P.S. You can start the bitcoin clients with the command option -detachdb to accomplish the same thing as checking the box.
P.S. After the files are successfully imported you may want to deselect the detach database at shutdown to speed up the shut down of the bitcoin-qt clients.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: zvs on February 13, 2013, 04:47:22 PM
This is a newbie question...

I've installed bitcoin-qt and Armoury on on a PC. After ages, (more than 8 hours) the blockchain is still downloading. (Last received block generated 175 days ago).
Instead of going through the same rigmarole again on another PC, can I install bitcoin-qt, and move the files from C:\Users\USERNAME\AppData\Roaming\Bitcoin to the new installation?

Which files do I need?
Are blk0001.dat, blk0002.dat and blkindex.dat enough? (I don't need to move my wallet.dat)

Can they just be "dropped into place", or is there a command line option I need to use to make it recognised?

Many Thanks!
Yes, blk0001.dat, blk0002.dat and blkindex.dat are enough. (Unless there is a new blk0003.dat then you need it to.)
Before moving any files start both the bitcoin-qt clients, go to options, and check the box which says detach database at shutdown.  Then close both clients. (Make sure they are closed in taskmanager.) then you are free to move the block chain files.

P.S. You can start the bitcoin clients with the command option -detachdb to accomplish the same thing as checking the box.
P.S. After the files are successfully imported you may want to deselect the detach database at shutdown to speed up the shut down of the bitcoin-qt clients.

for?  reindexing?  unless you have 8GB RAM for a ramdrive or less than 10Mbps downstream, it'd be quicker to DL


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: doghouse on February 13, 2013, 08:59:09 PM
Thanks everyone for your help!
In the end, I installed v0.8 and then re-downloaded the Blockchain from scratch using the -dbcache=2000 parameter. This was much quicker than on the previous version of bitcoin-qt. Unfortunately, it and Armory takes up a lot of RAM though!


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: BookLover on February 14, 2013, 02:47:20 PM
This is a newbie question...

I've installed bitcoin-qt and Armoury on on a PC. After ages, (more than 8 hours) the blockchain is still downloading. (Last received block generated 175 days ago).
Instead of going through the same rigmarole again on another PC, can I install bitcoin-qt, and move the files from C:\Users\USERNAME\AppData\Roaming\Bitcoin to the new installation?

Which files do I need?
Are blk0001.dat, blk0002.dat and blkindex.dat enough? (I don't need to move my wallet.dat)

Can they just be "dropped into place", or is there a command line option I need to use to make it recognised?

Many Thanks!
Yes, blk0001.dat, blk0002.dat and blkindex.dat are enough. (Unless there is a new blk0003.dat then you need it to.)
Before moving any files start both the bitcoin-qt clients, go to options, and check the box which says detach database at shutdown.  Then close both clients. (Make sure they are closed in taskmanager.) then you are free to move the block chain files.

P.S. You can start the bitcoin clients with the command option -detachdb to accomplish the same thing as checking the box.
P.S. After the files are successfully imported you may want to deselect the detach database at shutdown to speed up the shut down of the bitcoin-qt clients.

for?  reindexing?  unless you have 8GB RAM for a ramdrive or less than 10Mbps downstream, it'd be quicker to DL
No, when you check detach database at shutdown it allows the bitcoin-qt client to accept the new blockchain without errors.  It does NOT have to index the blockchain, it simply loads the blockchain files on startup like it would its own.  This is infinity faster than updating the blockchain from DL.

P.S. I may not have been clear in may previous post.  When you move the blockchain files, you move them to the bitcoin directory and REPLACE the other blockchain files.  You do NOT run the client so that is updates its blockchain files from the new ones.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: Mousepotato on February 16, 2013, 03:05:32 PM
I moved my bitcoin-qt.exe to my external drive E:\ and just dumped the blockchain files into that same directory on E:\ as well.  However, whenever I run bitcoin-qt.exe -detachdb, it keeps re-creating C:\Mousepotato\Appdata\Roaming\Bitcoin and starts downloading the blockchain again.  What am I doing wrong?


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: BookLover on February 16, 2013, 03:26:13 PM
You need to run bitcoin with the command "-datadir E:\" change the path to wherever you want your bitcoin directory to be.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: Mousepotato on February 16, 2013, 03:28:20 PM
You need to run bitcoin with the command "-datadir E:\" change the path to wherever you want your bitcoin directory to be.

Thank you!


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: niko on February 16, 2013, 03:33:17 PM
I moved my bitcoin-qt.exe to my external drive E:\ and just dumped the blockchain files into that same directory on E:\ as well.  However, whenever I run bitcoin-qt.exe -detachdb, it keeps re-creating C:\Mousepotato\Appdata\Roaming\Bitcoin and starts downloading the blockchain again.  What am I doing wrong?
You should have detached the databases before moving the files. Once you have them moved, the option is no longer needed.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: tinyapps on March 24, 2013, 07:59:49 AM
Quote
Which files do I need? Are blk0001.dat, blk0002.dat and blkindex.dat enough?
It seems that in 0.8.1 those have been superceded by two new directories: blocks and chainstate. There is a third directory named "database", but I dimly recall that being present in previous versions as well.

As of 3/23/13, those three directories contain about 7.76GB of data, with blocks making up 7.57GB of that total.

Is copying the blockchain to a new machine as simple as pasting one or more of these directories? Is there any reason to keep blk0001.dat, blk0002.dat and blkindex.dat?


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: batcoin on March 24, 2013, 09:57:05 AM
Quote
Which files do I need? Are blk0001.dat, blk0002.dat and blkindex.dat enough?
It seems that in 0.8.1 those have been superceded by two new directories: blocks and chainstate. There is a third directory named "database", but I dimly recall that being present in previous versions as well.

As of 3/23/13, those three directories contain about 7.76GB of data, with blocks making up 7.57GB of that total.

Is copying the blockchain to a new machine as simple as pasting one or more of these directories? Is there any reason to keep blk0001.dat, blk0002.dat and blkindex.dat?

I would also be interested in the steps needed for moving the blockchain around in 0.8.1. Any helpers out there?


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: Fressac on March 26, 2013, 05:26:18 PM
On my side (WinXP), data directory is on D: drive, folder BitcoinData, so "Target" field for shortcut is:

"C:\Program Files\Bitcoin\bitcoin-qt.exe" -datadir=D:\BitcoinData
Does anyone have any idea how to change the default data directory on a Mac? I'm not aware of a "Target" parameter when launching apps in OS X. I've tried googling it but come up with nothing.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: tinyapps on March 26, 2013, 05:33:52 PM
Quote
Does anyone have any idea how to change the default data directory on a Mac?

Just put the files in the default location:

~/Library/Application Support/Bitcoin

The tilde (~) represents the root directory of your home folder. The full path would look something like:

/Users/username/Library/Application Support/Bitcoin

If you wanted to change the default location, one way would be to use a symlink. I had to do this for the iMovie data directory years ago:

http://tinyapps.org/blog/mac/200805230700_change_imovie_save_directory.html (http://tinyapps.org/blog/mac/200805230700_change_imovie_save_directory.html)


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: Fressac on March 26, 2013, 08:23:48 PM
If you wanted to change the default location, one way would be to use a symlink. I had to do this for the iMovie data directory years ago:

http://tinyapps.org/blog/mac/200805230700_change_imovie_save_directory.html (http://tinyapps.org/blog/mac/200805230700_change_imovie_save_directory.html)
Of course! Thanks.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: tinyapps on March 28, 2013, 05:56:06 PM
Unable to find a definitive answer to the question of copying the blockchain to another computer, I asked Gavin via email:

In Bitcoin-Qt 0.8+, how can the blockchain be copied from one computer to another? Is it simply a matter of copying the blocks and chainstate directories?

His reply:

Yes


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: Fressac on March 29, 2013, 09:50:28 AM
Unable to find a definitive answer to the question of copying the blockchain to another computer, I asked Gavin via email:

In Bitcoin-Qt 0.8+, how can the blockchain be copied from one computer to another? Is it simply a matter of copying the blocks and chainstate directories?

His reply:

Yes
That's right. I posted on this here:
https://bitcointalk.org/index.php?topic=157314.msg1680307#msg1680307

Basically just make a copy of the whole Bitcoin data directory and drop it into any computer with the Bitcoin-Qt client installed on it. Make sure the client is not running and replace the existing directory with the copy.
BE CAREFUL NOT TO ERASE ANY WALLET THAT MAY HAVE VALUE!


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: tinyapps on March 29, 2013, 05:54:10 PM
Quote
Basically just make a copy of the whole Bitcoin data directory and drop it into any computer
For 0.8+, you may want to skip at least the deprecated blkxxxx.dat and blkindex.dat files since they are no longer used and are quite large. More on the data directory contents: https://en.bitcoin.it/wiki/Data_directory (https://en.bitcoin.it/wiki/Data_directory)


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: matt.collier on March 30, 2013, 12:54:30 AM
Hello All,

I can confirm that it is possible to copy the block chain from a Windows v0.8.1-beta installation to a linux v0.8.1-beta by copying only the contents (including subdirectories) of 'blocks' and 'chainstate' folders.

Matt


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: tinyapps on March 30, 2013, 03:59:31 AM
Thanks very much for confirming that, Matt!


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: deepceleron on March 30, 2013, 08:50:32 AM
Unable to find a definitive answer to the question of copying the blockchain to another computer, I asked Gavin via email:

In Bitcoin-Qt 0.8+, how can the blockchain be copied from one computer to another? Is it simply a matter of copying the blocks and chainstate directories?

His reply:

Yes

That is appropriately curt. You feel entitled to bother a lead developer for your own personal tech support? I have a feeling this is one reason why Satoshi was no longer entertained with the forum.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: tinyapps on March 30, 2013, 06:30:38 PM
Quote
You feel entitled to bother a lead developer
I feel "entitled" to email anyone who shares his or her email address with the world. S/he is of course free to ignore my email. We are all equals, my friend.

Quote
for your own personal tech support?
It was actually to post here so that the entire community could have a definitive answer to this question. Ironically, it was a post of yours that finally convinced me that I had to check with someone who would actually know the correct answer: https://bitcointalk.org/index.php?topic=145437.msg1553996#msg1553996 (https://bitcointalk.org/index.php?topic=145437.msg1553996#msg1553996)

Quote
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.
I had even replied to that comment 5 days ago asking for any further details from you or the community: https://bitcointalk.org/index.php?topic=145437.msg1670599#msg1670599 (https://bitcointalk.org/index.php?topic=145437.msg1670599#msg1670599)

Quote
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?
Sadly, apparently no one here knew the correct answer or could be bothered to share it. I decided to try my best to find out and share the answer so that others could benefit. With the blockchain well over 7.5GB and growing fast, it is important that users know how to copy the blockchain correctly.


Title: Re: bitcoin-qt: Move Downloaded blockchain to another installation
Post by: keystroke on April 08, 2013, 04:07:59 AM
Thanks, this was helpful information.