Backup & Restore
DO NOT FORGET YOUR PASSWORD and BACK UP YOUR KEYSTORE
Data directory
Everything geth
persists gets written inside its data directory (except for the PoW Ethash DAG, see note below). The default data directory locations are platform-specific:
Mac:
~/Library/Ethereum
Linux:
~/.ethereum
Windows:
%APPDATA%\Ethereum
Accounts are stored in the keystore
subdirectory. The contents of these directories should be transportable between nodes, platforms, and implementations (C++, Go, Python).
To configure the location of the data directory, the --datadir
parameter can be specified. See CLI Options for more details.
Upgrades
Sometimes the internal database formats need updating (i.e with upgrades from before 0.9.20). This can be run with the following command (geth should not be otherwise running):
Cleanup
Geth's blockchain and state databases can be removed with:
This is useful for deleting an old chain and sync'ing to a new one. It only affects data directories that can be re-created on synchronization and does not touch the keystore.
Blockchain Import/Export
Export the blockchain in binary format with:
On the other hand, if you want to back up portions of the chain over time, a first and last block can be specified. For example, to back up the first epoch:
Note that when backing up a partial chain, the file will be appended rather than truncated.
Import binary-format blockchain exports with:
And finally: DO NOT FORGET YOUR PASSWORD and BACKUP YOUR KEYSTORE
Last updated