Reference for manipulating Erigon datadirs. Use this when the user wants to perform operations on Erigon data directories.
Given a source path and destination path, follow this procedure exactly.
All checks must pass before copying. Abort on the first failure.
test -d <src> — abort if missing<src>/nodekey (file)<src>/snapshots/ (directory)<src>/chaindata/ (directory)test ! -e <dst> — abort if it already existstest -w "$(dirname <dst>)" — abort if notdu -sh <src> and the size before proceedingmount output. If the mount entry contains apfs, use the APFS CoW procedure below; otherwise use the full-copy procedure.Use this when the destination is on an APFS volume.
cp -ac <src> <dst> — this creates a CoW clone that is near-instant and consumes no extra disk space.rm -rf <dst>/chaindataUse this when the destination is NOT on APFS.
df -h "$(dirname <dst>)" and compare available space to the source size. If available space is less than source size, abort and tell the user — do not proceed.cp -a <src> <dst> to recursively copy the entire datadir. This is a long-running operation for large datadirs — run in background.After either procedure completes, confirm success by listing the destination contents and comparing against the source (minus chaindata/ for APFS copies).