Btrfs 定期检查

Posted by 韩同学的笔记本 on February 7, 2020

/etc/systemd/system/btrfs_scrub.service

1
2
3
4
5
6
7
8
9
[Unit]
Description=Run btrfs scrub on filesystem

[Service]
Type=forking
ExecStart=btrfs scrub start -B -d -c 2 -n 4 /mnt/ORICO/
TimeoutSec=10000
[Unit]
Description=Weekly btrfs scrub

/etc/systemd/system/btrfs_scrub.timer

1
2
3
4
5
6
7
8
[Timer]
OnBootSec=15min
#OnCalendar=weekly
OnUnitActiveSec=1w 
Persistent=true

[Install]
WantedBy=timers.target

定期检查命令例

1
2
btrfs scrub start -B -d -c 2 -n 4 /
btrfs balance start -dusage=50 -dlimit=2 -musage=50 -mlimit=4 /