Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Mike Man on February 05, 2017, 03:46:35 AM



Title: On-the-fly backup possible?
Post by: Mike Man on February 05, 2017, 03:46:35 AM
Usually when I make a backup of my blockchain data I close Bitcoin Core before doing it. This is a little bothersome as the blockchain is quite large and it takes a while to do it. I would rather continue downloading the last 10 weeks I have left to go.
So, is it OK to back up while Bitcoin Core is running?

Thanks in advance.

Mike


Title: Re: On-the-fly backup possible?
Post by: achow101 on February 05, 2017, 04:44:26 AM
Yes, you can backup while Bitcoin Core is open. You can go to File > Backup Wallet and use that to backup the wallet instead of copy and pasting the file while it is running. That should make sure the backup won't become corrupted.


Title: Re: On-the-fly backup possible?
Post by: Mike Man on February 05, 2017, 04:56:13 AM
OK, great. Thanks for your advice. I'll use the inbuilt feature. I guess it will save the entire blockchain and not just my empty wallet.

Cheers,

Mike


Title: Re: On-the-fly backup possible?
Post by: Foxpup on February 05, 2017, 06:08:26 AM
No, the Backup Wallet option only copies your wallet.dat file, not the blockchain state, which cannot be safely copied while Bitcoin Core is running. I think achow101 misunderstood the question.

The question is why are you backing up the blockchain state? If you merely want to avoid the bandwidth cost of downloading the blockchain all over again, a workaround is to back up the blocks folder and use the -loadblock parameter to synchronize from that, which should work despite the most recent .blk file likely being corrupt if you copied it while Core was running. It will still take a long time to verify everything. The only way around that is to back up everything while Core isn't running, so that the chainstate data will not be corrupted.


Title: Re: On-the-fly backup possible?
Post by: Mike Man on February 05, 2017, 10:04:36 AM
Excellent! Thank you. I went and made a huge batch of beans while I was awaiting follow-up posts.
So then, the safest way for a person with my reasonable, but not great, skills is to shut the show down and then copy the entire folder.

If I'm wrong, please let me know.

Thanks again,

Mike

Ps. The beans are the best batch I have ever made!


Title: Re: On-the-fly backup possible?
Post by: achow101 on February 05, 2017, 04:19:41 PM
No, the Backup Wallet option only copies your wallet.dat file, not the blockchain state, which cannot be safely copied while Bitcoin Core is running. I think achow101 misunderstood the question.
Right, now that I re-read it, I see he wants to backup the entire datadir essentially, not the wallet.

So in that case, nothing can be done except to shut it down and backup. However he should not really be doing this as this as the blockchain data does not get deleted unless you prune or manually delete it, and the databases usually don't get corrupted, and if they do, it usually means that something else is broken (e.g. hard drive failure).


Title: Re: On-the-fly backup possible?
Post by: unholycactus on February 05, 2017, 05:08:23 PM
You could also make a backup up to a recent block, not necessarily everything.
This would result into downloading the blocks, you haven't backed up and those that were added since the backup.
It shouldn't be too long.