Run fstrim daily on ZFS systems for zvols
This commit is contained in:
parent
e9498669e8
commit
a7fa5b9b7a
@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Discard unused blocks once a day
|
||||||
|
Documentation=man:fstrim
|
||||||
|
ConditionVirtualization=!container
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=daily
|
||||||
|
AccuracySec=1h
|
||||||
|
Persistent=true
|
||||||
|
RandomizedDelaySec=6000
|
||||||
|
Unit=fstrim.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
@ -1,3 +1,20 @@
|
|||||||
|
# Run fstrim daily on ZFS. It's a no-op on ZFS filesystems, but it will run on zvols mounted via
|
||||||
|
# fstab. This helps keep zvol space requirements down.
|
||||||
|
- name: Configure daily fstrim timer
|
||||||
|
copy:
|
||||||
|
src: ./filesystem/common/etc/systemd/system/fstrim-daily.timer
|
||||||
|
dest: /etc/systemd/system/fstrim.timer
|
||||||
|
mode: 0644
|
||||||
|
register: systemd_fstrim_daily_timer_file
|
||||||
|
when:
|
||||||
|
is_zfs
|
||||||
|
|
||||||
|
- name: SystemD daemon reload
|
||||||
|
systemd:
|
||||||
|
daemon_reload: true
|
||||||
|
when:
|
||||||
|
systemd_fstrim_daily_timer_file is changed
|
||||||
|
|
||||||
- name: Enable fstrim
|
- name: Enable fstrim
|
||||||
systemd:
|
systemd:
|
||||||
name: fstrim.timer
|
name: fstrim.timer
|
||||||
|
Loading…
Reference in New Issue
Block a user