Moving the Bitcoin Core Data Directory
4 stars based on
Bitcoin Core runs as a full network node and maintains a local copy of the block chain. This data independence improves wallet privacy and security.
With local access to the complete set of headers and transactions, Bitcoin Core can use full verification to tell when peers lie about payments. However, dealing with the block chain comes at a price.
An ever-growing data set causes smaller hard drives to fill up quickly. This article describes two approaches that can be used with either a new or existing Bitcoin Core 0. To protect yourself from loss of funds, make a backup of your wallet now. After the backup has been saved, exit Bitcoin Core. The first step is finding the default data directory. Mac, Windows, and Linux version of Bitcoin Core each store data in a different location.
The procedure described here will use a graphical file browser to find it. On Windows 7, begin by clicking on the Windows menu.
Then click your username from the right-hand menu. Windows Explorer should show a folder containing other folders such as Contacts and Desktop. Another folder, AppData is hidden by default. Windows Explorer should now display an AppData folder. Then enter the Roaming folder, where the Bitcoin folder is contained. Double click on the Application Support folder. On Ubuntu, open a file browser by clicking on the folder icon in the launcher.
Having found the default data directory, we can now copy it. Be sure that Bitcoin Core has been shut down and is no longer running. The software occasionally takes a minute or two to completely exit. Begin by renaming the Bitcoin Core data directory. Use the name bitcoin-backup.
This allows recovery of the original data directory in case something goes wrong. To recover the original, reinstate the original name of the bitcoin-backup folder either Bitcoin or. Next copy the renamed bitcoin data directory to a destination of your choice.
This can be the same hard drive, an external hard drive, or a removable medium such as USB drive or SD card. Copying data may require only a few minutes or a couple of hours, depending on how up-to-date your copy of the block chain is and the speed of your hardware. You can now rename the copied folder. For example, it might be convenient to use the name Bitcoin.
With no default data directory, Bitcoin Core assumes that this is its first session. Launching Bitcoin Core should yield a welcome screen. This screen gives you to option to store data in the default location or a custom location. Select the second option. Bitcoin Core should continue starting up.
When the process completes, the software should work exactly as it did before. When ready to proceed to the next step, close the application. At this point your system contains two more or less identical copies of the data directory. Assuming there were no issues with the move, the original can now be deleted.
Browse to the location of the bitcoin-backup directory and delete it. Users of Armory on Mac face a tricky problem when trying to move the Bitcoin Core data directory. Armory only recognizes the default data directory on OS X.
Moving it means that Armory will no longer function. Fortunately, the solution is relatively simple. Create a symbolic link from the new data directory to the old default directory. Creating this link allows the new data directory to be used as if it still resided at the old location. Begin by launching the Terminal application. Instead of pulling the data directory out from under Bitcoin Core and then supplying a new path after startup, the data directory can be passed as the command line parameter datadir.
This approach keeps the existing default data directory intact. It also allows multiple data directories to be used side-by-side. Windows users can create a shortcut that uses the command line option datadir. Doing so directs Bitcoin Core to use, not the default data directory, but the one given as a parameter. Browse to the location of the Bitcoin Core executable C: Next, add the command line option datadirusing the path to your data directory.
Double clicking the newly-created shortcut will direct Bitcoin Core to use the new data directory. This places a shortcut on the desktop. Double clicking the resulting shortcut starts Bitcoin Core with the custom data directory. Although a similar shortcut-based approach will work on OS X, creating a clickable icon is much more difficult. Copy the Data Directory Having found the default data directory, we can now copy it. Delete the Original Data Directory At this point your system contains two more or less identical copies of the data directory.
Command Line Parameter Instead of pulling the data directory out from under Bitcoin Core and then supplying a new path after startup, the data directory can be passed as the command line parameter datadir. Conclusions Moving the Bitcoin Core data directory can be helpful in two situations: Was this post useful? Get my newsletter direct to your inbox for free. No spam, just great content like this. Unsubscribe at any time.