Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -494,15 +494,17 @@ __check_disk_space() {
echo "It should currently be auto-pruning, check logs with \"$__me logs -f --tail 500 execution | grep \
Full\". Free space:"
else
echo "If the below reads above ${__safe_prune} GiB free, prune it with \"$__me prune-nethermind\""
echo "You might be able to resync Nethermind for path storage if you haven't done so already, with \"$__me resync-execution\"."
echo "Also verify the amount of space your consensus layer client takes, and resync it as needed."
fi
echo
__display_docker_dir
__display_docker_volumes
elif [[ "${__value}" =~ "geth.yml" ]] && [[ "${__free_space}" -lt 104857600 ]]; then
echo
echo "You are running Geth and have less than 100 GiB of free disk space."
echo "You may resync from scratch to use PBSS and slow on-disk DB growth, with \"$__me resync-execution\"."
echo "You may resync from scratch to use PBSS and slow on-disk DB growth, if you haven't done so already, with \"$__me resync-execution\"."
echo "Also verify the amount of space your consensus layer client takes, and resync it as needed."
echo
__display_docker_dir
__display_docker_volumes
Expand Down Expand Up @@ -1825,6 +1827,12 @@ prune-nethermind() {
__var="NETWORK"
NETWORK=$(sed -n -e "s/^${__var}=\(.*\)/\1/p" "${__env_file}" || true)

if [ -n "$(dodocker run --rm -v "$(dodocker volume ls -q -f "name=$(basename "$(realpath .)")[_-]nm-eth1-data")":"/var/lib/nethermind" \
alpine:3 ls "/var/lib/nethermind/nethermind_db/${NETWORK}/pathState")" ]; then
echo "This Nethermind uses path-based storage. Manual pruning is not required."
return 0
fi

if [ "${NETWORK}" = "mainnet" ] || [ "${NETWORK}" = "gnosis" ]; then
__min_free=262144000
__min_gib=250
Expand Down Expand Up @@ -1885,6 +1893,7 @@ prune-nethermind() {
echo "Nethermind should auto-prune below ${__threshold} GiB free. Check logs with \"$__me logs -f --tail 500 \
execution | grep Full\" to see whether it is."
fi
echo "Instead of pruning, consider resyncing Nethermind to use path-based storage, with \"$__me resync-execution\"."
read -rp "WARNING - this will prune Nethermind's database in the background. Do you wish to continue? (No/Yes) " __yn
case $__yn in
[Yy][Ee][Ss] ) break;;
Expand Down
37 changes: 22 additions & 15 deletions nethermind/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,31 @@ if [ "${ARCHIVE_NODE}" = "true" ]; then
echo "Nethermind archive node without pruning"
__prune="--Sync.DownloadBodiesInFastSync=false --Sync.DownloadReceiptsInFastSync=false --Sync.FastSync=false --Sync.SnapSync=false --Sync.FastBlocks=false --Pruning.Mode=None --Sync.PivotNumber=0"
else
__parallel=$(($(nproc)/4))
if [ "${__parallel}" -lt 2 ]; then
__parallel=2
fi
__prune="--Pruning.FullPruningMaxDegreeOfParallelism=${__parallel}"
if [ "${AUTOPRUNE_NM}" = true ]; then
__prune="${__prune} --Pruning.FullPruningTrigger=VolumeFreeSpace"
if [ "${NETWORK}" = "mainnet" ] || [ "${NETWORK}" = "gnosis" ]; then
__prune="${__prune} --Pruning.FullPruningThresholdMb=375810"
else
__prune="${__prune} --Pruning.FullPruningThresholdMb=51200"
# Fresh DB or already path based storage
if [[ ! -d "/var/lib/nethermind/nethermind_db/${NETWORK}" || -d "/var/lib/nethermind/nethermind_db/${NETWORK}/pathState" ]]; then
__prune=""
else # Hash, set pruning parameters
__parallel=$(($(nproc)/4))
if [ "${__parallel}" -lt 2 ]; then
__parallel=2
fi
__prune="--Pruning.FullPruningMaxDegreeOfParallelism=${__parallel}"
if [ "${AUTOPRUNE_NM}" = true ]; then
__prune="${__prune} --Pruning.FullPruningTrigger=VolumeFreeSpace"
if [ "${NETWORK}" = "mainnet" ] || [ "${NETWORK}" = "gnosis" ]; then
__prune="${__prune} --Pruning.FullPruningThresholdMb=375810"
else
__prune="${__prune} --Pruning.FullPruningThresholdMb=51200"
fi
fi
if [ "${__memtotal}" -ge 30 ]; then
__prune="${__prune} --Pruning.FullPruningMemoryBudgetMb=16384"
fi
fi
if [ "${__memtotal}" -ge 30 ]; then
__prune="${__prune} --Pruning.FullPruningMemoryBudgetMb=16384 --Init.StateDbKeyScheme=HalfPath"
if [ -n "${__prune}" ]; then
echo "Using pruning parameters:"
echo "${__prune}"
fi
echo "Using pruning parameters:"
echo "${__prune}"
fi

# New or old datadir
Expand Down