使用 cron 運行 btrfs 平衡

使用 cron 運行 btrfs 平衡

由於我今天運行時遇到磁碟已滿的問題,事實證明這並不是不平衡。你可以用 來修復它btrfs balance

所以我的問題是:

透過 cron 作業破壞它是否有任何風險? (如果我的筆記型電腦進入睡眠狀態)

答案1

I33tname 先生給了你答案。

但是,您應該執行單獨的 cron 作業來檢查幾乎已滿的磁碟。這是一個如何做到這一點的想法,不一定是適合您情況的完美解決方案

Use cronjob -e to add this (example change names of directories and files): 0,10,20,30,40,50 * * * * /path/to/my/script.sh 2>>/path/to/記錄檔

script.sh 有類似這樣的內容(檢查 df -h 的輸出 - 我假設 col #5 是 %full,這假設 90% 是問題的開始,並且您已經設定了電子郵件):

 #!/bin/bash
 df -h  | awk 'INT($5)>80 { print }{next}' > /path/to/diskfull.txt
 [  -s /path/to/diskfull.txt ] && /usr/bin/mailx -s 'disk full error ' [your email name here ] < /path/to/diskfull.txt

相關內容