hello All
I have created a /mnt/mainraid/videoclips
dataset which will fill up with video clips and jpegs written one at a time, periodically throughout the day and night.
I have set a quota warning for the dataset to 80% and a critical warning at 95% .
-
What happens when it fills up to the brim?
-
If it continues to write (but with the attendant quota warnings), is there a webUI way to “hard limit” the dataset’s capacity so it cannot “grow”?
-
Is there a way to turn the dataset into a “giant FIFO” whereby older clips are deleted to make way for newer ones being written?
I can’t see a UI mechanism, but I think I that (3) could be achieved via a script and a cron job, for example:
#!/bin/bash
DATASET_PATH="/mnt/mainraid/videoclips"
QUOTA_LIMIT=80 # in GB
CURRENT_USAGE=$(du -sBG "$DATASET_PATH" | cut -f1 | sed 's/G//')
if [ "$CURRENT_USAGE" -ge "$QUOTA_LIMIT" ]; then
# Find and delete the oldest files until the usage is below the limit
while [ "$CURRENT_USAGE" -ge "$QUOTA_LIMIT" ]; do
# Find the oldest file and delete it
OLDEST_FILE=$(find "$DATASET_PATH" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2-)
if [ -n "$OLDEST_FILE" ]; then
rm "$OLDEST_FILE"
echo "Deleted: $OLDEST_FILE"
fi
CURRENT_USAGE=$(du -sBG "$DATASET_PATH" | cut -f1 | sed 's/G//')
done
fi
(not my work - beyond me!).
I did look at this page and a handful of forum posts to no avail, perhaps because I don’t understand.