Btrfs scrub & backup

Hi all,

I created a script that can be execute periodically via cron and it will check for btrfs errors and in case everything is fine it will take a backup of the current system. It will keep the last 5 backups


btrfs scrub start -B /
if [ $SCRUB_STATUS -eq 0 ];then
  schnapps export current /mnt/sda1/ > /dev/null
  ls -F /mnt/sda1/omnia-medkit-*.tar.gz | head -n -5 | xargs -r rm
  logger 'router backup ok'
  logger 'btrfs problem'
1 Like