The CIS Benchmarks require putting /home, /tmp and /var onto a separate partition to mitigate the worst outcome of a system freeze from root partition filling up.
There are other solutions to help it from filling up in the first place. Of course monitoring is one:
echo -e '#!/bin/bash\nCURRENT=$(df / | grep / | awk '\''{ print $5}'\'' | sed '\''s/%//g'\'') ; THRESHOLD=95; if [ "$CURRENT" -gt "$THRESHOLD" ] ; then mail -s "Disk Space Alert Used: $CURRENT" $EMAIL <<< $(hostname -i; uname -a); fi' >> /etc/cron.hourly/check-space && chmod +x /etc/cron.hourly/check-space
You can also set the system logs from filling up:
echo 'SystemMaxUse=200M' >> /etc/systemd/journald.conf && systemctl restart rsyslog
You can create a fixed size varfile and mount it to /var in /etc/fstab:
fallocate -l 600M /varfile && mkfs.ext4 /varfile
echo -e "/home/varfile /home/user1 ext4 defaults,nofail 0 2" >> /etc/fstab
(no dump, filecheck priority 1st is root)
Resize with this: fallocate -l 200M /tmpfile && mount /tmpfile /tmp && resize2fs /dev/loop1
I've safely done the file mounting with /home and /tmp dirs, but have not tested /var because I havent figured out how to copy the current contents onto the mountfile without using an attached livedisk or mounting the root filesystem. It seemed better for me to let the logs flux in free space and get monitoring which I need anyway, but I may revisit that for larger VMs than a minimal server.
Also, you can limit specific log sizes with a maxsize in individual conf files. However, things like /var/lib for apt lists and clamav definitions, as well as cache package installs in /var/cache/apt/archives, will grow aside from logs. The latter can be controlled through unattended-updates settings using apt clean
periodically.