cmd/geth: graceful shutdown if disk is full (#22103)

Adding warnings of free disk space left and graceful shutdown when there is not enough space left.
This also adds a flag datadir.minfreedisk which can be used to set the trigger for low disk space, and setting it to zero disables the check. 

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Alex Mazalov
2021-01-19 08:26:42 +00:00
committed by GitHub
parent 5e9f5ca5d3
commit 24c1e3053b
6 changed files with 113 additions and 2 deletions

View File

@ -65,6 +65,7 @@ var (
utils.LegacyBootnodesV5Flag,
utils.DataDirFlag,
utils.AncientFlag,
utils.MinFreeDiskSpaceFlag,
utils.KeyStoreDirFlag,
utils.ExternalSignerFlag,
utils.NoUSBFlag,
@ -368,7 +369,7 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend) {
debug.Memsize.Add("node", stack)
// Start up the node itself
utils.StartNode(stack)
utils.StartNode(ctx, stack)
// Unlock any account specifically requested
unlockAccounts(ctx, stack)