Skip to content

How to Manage Disk Space

Claude Pageau edited this page Oct 15, 2020 · 7 revisions

Manage free disk space when storage is limited.

Introduction

Disk space management is primarily designed for smaller size SD cards or for video files where file recycling is not used. Using this disk space management feature will reduce the chance of filling the storage device and causing Raspbian system problems due to lack of space. If you are saving to an external device with a large capacity then you may not want to use this feature. Also disk space checking will slow down motion tracking and timelapse functions.

config.py Disk Space Settings

Disk space management is controlled from the config.py file per the following settings.

SPACE_MEDIA_DIR = '/home/pi/pi-timolo/media'  # Default= '/home/pi/pi-timolo/media'  Starting point for directory walk
SPACE_TIMER_HOURS = 0         # Default= 0  0=off or specify hours frequency to perform free disk space check
SPACE_TARGET_MB = 500         # Default= 500  Target Free space in MB Required.
SPACE_TARGET_EXT = 'jpg'     # Default= 'jpg' File extension to Delete Oldest Files

To turn on disk space management set SPACE_TIMER_HOURS to number of hours to check disk space. If you just want to check disk space every day set SPACE_TIMER_HOURS = 24. this will check once a day and delete the oldest SPACE_TARGET_EXT files in the SPACE_MEDIA_DIR folder tree until the required SPACE_TARGET_MB is reached. Only 25 percent of total files will be deleted in one session.

If you do not want files deleted you may wish to archive files to a local network share or rclone remote storage name using rclone.

Clone this wiki locally