I am trying to do a fast sync using geth --fast
but I am getting this message:
blockchain not empty, fast sync disabled
How can I empty the blockchain to allow for fast sync?
To remove your blockchain with geth, run: geth removedb
Then:
Use --fast
but you probably also need --cache=1024
(and --jitvm
may also help). Without it, you are running with the default which is --cache=16
.
A 50% speed increase is possible just by increasing the cache.
If you are starting from the beginning, use: geth --fast --cache=1024 --jitvm
Depending on your RAM, you can also try with higher values, like --cache=2048
.
NOTE:
The number after --cache=
is the amount of memory allocated to the task of downloading the blockchain!!
geth --fast
is already running? I want to leave it running long-term to answer RPC requests but don't want it to eat up my disk.
geth removedb
in a separate shell while geth --fast
is running. I didn't have any problems doing this then sending a few xacts after, but I don't know if it's safe. Docs say nothing.
The default datadir
is:
Mac: ~/Library/Ethereum
Linux: ~/.ethereum
Windows: %APPDATA%/Ethereum
Delete the chaindata
subdirectory that you find.
Run geth --fast --cache=1024
for a recommended way to sync the chain quickly (don't forget to use a bigger --cache
with a value like 1024, otherwise the default is 16, and it won't sync as quickly).
EDIT: Running geth removedb
is the simplest way to delete the blockchain in Geth.
If you have your blockchain partially or fully imported while starting geth
, then using the --fast
flag is ignored (the flag is disabled). To use the --fast
flag you have to remove all of the data from your chaindata
folder.
use
geth --fast --cache=2048
it seems at least Mac does not provide the other options under go1.9.2:
flag provided but not defined: -jitvm
--fast
flag didn't allow restarting geth until it finished syncing, if you did restart it will switch to full mode.