Skip to content

Instantly share code, notes, and snippets.

@chappjc
Last active June 9, 2021 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chappjc/4feefe593f870cd008180c00f72f85ca to your computer and use it in GitHub Desktop.
Save chappjc/4feefe593f870cd008180c00f72f85ca to your computer and use it in GitHub Desktop.
Ethereum full node (geth) notes

With geth 1.10.3+, the following options should be used to sync a full node from scratch:

  • --datadir.ancient=, to put the freezer on a larger and less expensive drive (HDD), option added in geth 1.9
  • --syncmode snap, to use the new "snap" initial sync mode, added in geth 1.10

e.g. geth --datadir /mnt/fast-ssd/geth --datadir.ancient /mnt/big-hdd/geth-ancient --syncmode snap

As of Ethereum mainnet block 12,517,949 (May-27-2021 06:27:52 PM +UTC), the disk space required is:

  • state and indexes (datadir minus the ancient folder): 151 GiB
  • freezer (datadir.ancient folder): 215 GiB

This can be done overnight on a 3 core 8 GiB RAM virtual machine with sufficient disk space and an NVMe SSD for the main datadir.

When the initial sync is completed, geth switches to full mode. Disk utilization begins to climb more quickly. Reports from the Go Ethereum Discord channel suggest that 10 GiB/week are expected. My observation are that the bulk of this new usage goes to the datadir. In just under 2 weeks since May 27, the datadir folder on the fast NVMe has grown by 18 GiB, while the ancient folder has grown by 4 GiB. In the same period, the node has used about 338 GiB egress and 277 GiB ingress.

The DB can be occasionally purged with the removedb command and then reconstructed with a fast or snap sync again, but this takes hours. With Go 1.10, a snapshot prune-state is recommended instead. Running the state prune looked like the following:

Use before:

219G	/mnt/big-hdd/geth-ancient
168G	/mnt/fast-ssd/geth/.ethereum

progress:

INFO [06-08|22:02:37.880] Iterating state snapshot                 accounts=136,898,891 slots=451,482,427 elapsed=1h6m32.182s eta=11.503s
INFO [06-08|22:02:45.308] Iterated snapshot                        accounts=136,898,891 slots=453,527,760 elapsed=1h6m39.611s
...
INFO [06-08|22:25:12.503] Pruned state data                        nodes=58,553,306 size=16.10GiB  elapsed=20m34.954s
...
INFO [06-08|23:11:07.963] Compacting database                      range=0xf0-     elapsed=45m54.990s
INFO [06-08|23:12:59.121] Database compaction finished             elapsed=47m46.148s
INFO [06-08|23:12:59.121] State pruning successful                 pruned=16.10GiB elapsed=2h16m53.430s

Use after:

219G	/mnt/big-hdd/geth-ancient
139G	/mnt/fast-ssd/geth/.ethereum

It looked like roughly half of the disk use was from just the last year, so there should be plenty of free space on both disks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment