-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Backup & restore
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/Roaming/Ethereum"
Accounts are stored in the keystore
subdirectory. The contents of this directories should be transportable between platforms, but is specific to the Go implementation.
To configure the location of Geth's files, the --datadir
parameter can be specified. See CLI Options for more details.
Note: The Ethash DAG is stored at ~/.ethash
(Mac/Linux) or ~/AppData/Ethash
(Windows) so that it can be reused by all clients. You can store this in a different location by using a symbolic link.
Sometimes the internal database formats need updating (for example, when upgrade from before 0.9.20). This can be run with the following command (geth should not be otherwise running):
geth upgradedb
Geth's blockchain and state databases can be removed with:
geth removedb
This is useful for deleting an old chain and sync'ing to a new one.
Export the blockchain in binary format with:
geth --first 314150 --last 400000 export <filename>
Import binary-format blockchain exports with:
geth import <filename>
See https://github.com/ethereum/wiki/wiki/Blockchain-import-export for more info