to be
a problem slover

how to reduce geth space usage

According to this ethereum issue @karalabe provide this solution to reduct disk space for fullnode (by “fast syncing” with itself):

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/

Note:

It only applies to ethereum, but not woking in bsc.

For bsc you need offline block prune

Some of the enhancements below can address the existing challenges with running a BSC full node:

Prune the state. To prune the stale data and make the storage lighter:

Stop the bsc node first.
Run nohup geth snapshot prune-state --datadir {the data dir of your bsc node} &. It will take 3-5 hours to finish.
Start the node once it is done.
Enable diff sync and disable unnecessary transaction exchange.

Stop the bsc node first.
Add DisablePeerTxBroadcast = true under the [Eth] module of the config.tom file.
Add --diffsync to the start command.
Start the node.
If you build a new bsc node, please fetch snapshot from: https://github.com/binance-chain/bsc-snapshots

In short:

prune state (may take far more than 3-5 hours as claimed)

geth --datadir /your/data/dir snapshot prune-state

once pruning is complete, start Geth again: sudo systemctl start geth

reference

https://gist.github.com/yorickdowne/3323759b4cbf2022e191ab058a4276b2

赞(7) 打赏
欢迎转载,注明出处:刘世明的博客 » how to reduce geth space usage

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下作者

支付宝扫一扫打赏

微信扫一扫打赏