1

I have a production Geth node whose blockchain occupies around ~600 GB. I'm trying to figure out how to free up disk space. I know I can remove the blockchain and start fast sync from scratch, but that will take some time (probably more than a day) and it is not acceptable for a production node that is expected to be up 24/7. I can bring it down but for a couple of hours at the most. So my question is how to reduce blockchain size with a minimal downtime?

I was considering starting a new Geth node in parallel and have it fully sync, and then migrate the keys from the old node to the new one. But is there a better approach?

2
  • Is this a private network or a public network?
    – wtk219
    Apr 20, 2018 at 14:35
  • Do you need to check account's historical balances of blocks below lastblock-1000? If not, you can prune the state and release 500GB of historical state entries.
    – Nulik
    Apr 22, 2018 at 21:40

1 Answer 1

2

From Issue #15797

Geth also supports "fast syncing" with itself, which you can use to synchronize an existing chain into a fresh data directory and then swap out the old one with the fresh one:

geth --datadir=/my/temp/datadir copydb --cache=512 /my/main/datadir/geth/chaindata/
rm -rf /my/main/datadir/geth/chaindata/
mv /my/temp/datadir/geth/chaindata /my/main/datadir/geth/

Your Answer

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

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