System information

Geth version: 1.8.27 OS & Version: Linux Docker version: 18.09.0


gcmode is full, syncmode is fast. Single node in private network. datadir mount to docker volume.


I restart the docker so that geth quit unsafely

sudo service docker restart

When I restart the geth, the latest block become 0.

> 0

it was 140000, so 140000 minded blocks are missing. However, I still can get data of old blocks

> {data of this block}

So it looks like blocks still exist but the head of chain reset to 0.


1 Does full gcmode cause this issue?

2 Is there a way to reset the head? I tried


but nothing happen.

1 Answer 1


I had the same problem, I tried everything. The only way worked:

  1. export all block data by run golang code
chainClient, err := ethclient.Dial("./db/geth.ipc")
if err != nil {
fh, err := os.OpenFile("./aaa", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.ModePerm)
if err != nil {
defer fh.Close()

var writer io.Writer = fh
for nr := 0; nr <= ___ 140000____; nr++ {
    blockNumber := big.NewInt(int64(nr))
    // blockNumber.Int64(nr)
    block, err := chainClient.BlockByNumber(context.Background(), blockNumber)
    if err != nil {
    if block == nil {
        log.Fatalf("export failed on #%d: not found", nr)
    if err := block.EncodeRLP(writer); err != nil {
  1. geth init
  2. geth import aaa

Then everything is right. eth.blockNumber is no longer zero.

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.