From f5eb4756601dfc012f5881af0ed95c13b7ee1591 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Fri, 11 Feb 2022 15:03:37 +0300 Subject: [PATCH] selfcheck.py: check free disk space --- clover/src/selfcheck.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/clover/src/selfcheck.py b/clover/src/selfcheck.py index 3093f813..b2b5e7bb 100755 --- a/clover/src/selfcheck.py +++ b/clover/src/selfcheck.py @@ -740,6 +740,14 @@ def check_network(): @check('RPi health') def check_rpi_health(): + try: + import shutil + total, used, free = shutil.disk_usage('/') + if free < 100 * 1024 * 1024: + failure('disk space is less than 100 MB; consider removing logs (~/.ros/log/)') + except Exception as e: + info('could not check the disk free space: %s', str(e)) + # `vcgencmd get_throttled` output codes taken from # https://github.com/raspberrypi/documentation/blob/JamesH65-patch-vcgencmd-vcdbg-docs/raspbian/applications/vcgencmd.md#get_throttled # TODO: support more base platforms?