Compact the LND database (channel.db)
Compact the LND database (channel.db)
An over 1GB channel.db file does not work on 32bit systems: https://github.com/lightningnetwork/lnd/issues/4811
# check the size of channel.db
sudo du -h /mnt/hdd/lnd/data/graph/mainnet/channel.db
# example output
# 1.0G /mnt/hdd/lnd/data/graph/mainnet/channel.dbAuto-compact on restart
Since LND v0.12.0 can set db.bolt.auto-compact=true in the lnd.conf.
To edit:
sudo nano /mnt/hdd/lnd/lnd.confinsert the following (can leave out the comments):
[bolt] # Whether the databases used within lnd should automatically be compacted on # every startup (and if the database has the configured minimum age). This is # disabled by default because it requires additional disk space to be available # during the compaction that is freed afterwards. In general compaction leads to # smaller database files. db.bolt.auto-compact=true # How long ago the last compaction of a database file must be for it to be # considered for auto compaction again. Can be set to 0 to compact on every # startup. (default: 168h) # db.bolt.auto-compact-min-age=0restart lnd:
sudo systemctl restart lndmonitor the process (can take several minutes):
sudo tail -fn 30 /mnt/hdd/lnd/logs/bitcoin/mainnet/lnd.logmight want to disable the auto-compact in
lnd.confand only activate on-demand to avoid long startup times:db.bolt.auto-compact=false
Compacting with Channels Tools
https://github.com/guggero/chantools#compactdb
Run the following commands in the RaspiBlitz terminal
See the comments for what each command does.
Prune the revocation logs
available since LND v0.15.1
Does not replace the database compacting and needs to be done only once after updating to LND v0.15.1 and above
On a Raspiblitz or compatible system:
Edit the systemd service:
Edit the line starting with
ExecStart=so it looks like:CTRL+o, ENTER and CTRL+x to save then restart LND:
monitor the process in the logs:
can take 30-60 mins typically similar to compacting after a long time.
after the pruning has finished the node comes back online
will need to compact once again to remove the pruned logs and reduce the size of the channel.db
example output of the compaction after pruning the revocation logs:
Last updated