23

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?

0

4 Answers 4

16

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!!

Source

3
  • 3
    Note this should now be geth removedb (no dash)
    – Derek
    Commented May 31, 2017 at 13:31
  • Is there a way to do this while 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.
    – sudo
    Commented Apr 7, 2018 at 20:45
  • I mean a safe way. You can run 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.
    – sudo
    Commented Apr 7, 2018 at 20:56
9

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.

6

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.

1
  • 1
    Will starting fresh with --fast take less time than updating from the stored data? At what point would you say it's worth it? Commented Jul 18, 2017 at 2:58
1

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
1
  • 1
    This is an old question (March 2016), early iterations of the --fast flag didn't allow restarting geth until it finished syncing, if you did restart it will switch to full mode.
    – Ismael
    Commented Jan 12, 2018 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.