How to prune Geth?

My disk is 65% full and I would like to start saving some space before it’s too late. Is there any tutorial out there to prune geth on a dAppnode? Or any recommendation?

Thanks!

2 Likes

Hello Clem,
I haven’t tested this myself yet. I grabbed this from the discord channel.

Set a fallback ETH1 node like Infura (because your Geth node will be offline while pruning) then go to the Geth package, Config tab and set the EXTRA_OPTIONS field to snapshot prune-state and click update, when it restarts Geth it will prune the DB. When done copy back the default --http.api eth,net,web3,txpool settings again and restart. Warning though if the pruning doesn’t work for some reason you will likely need to do a full re-sync from scratch so be prepared for that as a worst case scenario.

1 Like

Thanks, seems to be working; will know for sure in a week, after it’s finished (:

Starting to loose hope this will ever happen, 4 days in and a week still remaining…

elapsed=97h27m18.883s eta=180h32m27.532s

Hello Vanjan,
It took me a week to sync blocks and states from scratch with default settings, so I wouldn’t be surprised if it takes at least that time to prune. Can you keep me updated if you finish doing it?

Thanks
Dylan

Thanks guys.
Vanjan, I would love to have an update too!

It finished generating snapshots last night, but if you use the latest version (1.10.3) it should be “10x quicker” according to their release notes. I was using 1.10.2.

Now failing with the following error:

ERROR[05-26|09:23:19.025] Failed to prune state                    err="snapshot not old enough yet: need 120 more blocks"
snapshot not old enough yet: need 120 more blocks

I’ve raised an issue with geth about this, let’s see what comes back: snapshot not old enough yet: need 120 more blocks · Issue #22947 · ethereum/go-ethereum · GitHub

Hello all,
About to attempt this myself. After some googling I found a couple of tips.

Geth has to finish the snapshot. If it’s on 1.10.x, it will do so automatically by default. If you no longer see an ETA, it has finished with that. The ETA is accurate after about 12 hours. On machines with very slow IOPS, such as Contabo VPS, it can take 2 weeks+ to generate the snapshot. On mainstream SSD, it takes 3-4 days; and on fast SSD, about a day.

If you are having the same issue with very long estimates for creating the snapshot. Another suggestion:

delete your leveldb database (chaindata without the ancient folder within); and start a snap sync (--syncmode=snap ). By keeping the ancients you will not need to download 200GB of blocks, only the latest state.

Someone completed the process with the following specs:

CPU: Ryzen 5 3600

RAM: 32GB (16GBx2) - 3600MHz CL18

SSD: Silicon Power 1TB NVMe Gen4

  1. Iterating state snapshot: 43 minutes
  2. Pruning state data: 25 minutes
  3. Compacting database: 69 minutes (the journal stopped updating after 12 minutes, but resumed after ~55 minutes).

Here are two ethstaker post about it.
https://www.reddit.com/r/ethstaker/comments/n7mnx5/psa_if_youre_running_geth_prune/
https://www.reddit.com/r/ethstaker/comments/m8ppq6/just_got_back_200gb_of_disk_space_from_geth/
Also, for those wanting to know how to set a fallback node for Prysm:
https://docs.prylabs.network/docs/prysm-usage/setup-eth1/#adding-fallback-eth1-nodes

Hope that helps.

Dylan

1 Like

Hello all,
I have successfully pruned the geth DB on a system with similar specs to the DAppNodeAdvanced. I’m also using Geth v1.10.3. The process was rather straight forward and easy to complete. I’ll detail below.

** Duration on my setup:**

  1. Iterating state snapshot: 57m
  2. Pruning state data: 1h13m
  3. Compacting database: 4h37m
    To be warned, when compacting the log file stopped providing frequent updates on the progress from about the 26 min mark and started again about the 1h26m mark. The compacting process worked fine.

pruned=176.65GiB

Here are the detailed steps:
Setup Prysm to use a Infura fallback.
(You don’t have to use Infura, it is just one example)

  1. Register an Infura account at https://infura.io/
  2. Generate a new project in Infura
  3. Go to my.dappnode → packages → prysm → config → advanced editor
  4. add --fallback-web3provider=https://mainnet.infura.io/v3/YOUR-PROJECT-ID to the Beacon Chain EXTRA_OPTS (replace YOUR-PROJECT-ID with your generated project ID in Infura)
  5. Click update

Pruning Geth DB

  1. Go to my.dappnode → packages ->Geth-> Config
  2. Copy the EXTRA_OPTIONS and save somewhere
  3. replace EXTRA_OPTIONS with snapshot prune-state
  4. Press Update
  5. Once the process is complete copy back the original EXTRA_OPTIONS and click update

Dylan

6 Likes

Thanks Dylan. I’m going to try this week end and will let you guys know if it worked for me.

1 Like

I also managed to finish with the result being around 400 gb reclaimed.

Same, it worked! 115gb saved. Definitely lower than expected but I guess I’ll just re-prune in a few months! Thanks so much guys.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.