Skip to content

Commit bb0ef2d

Browse files
committed
Add sanoid
1 parent 18d6e05 commit bb0ef2d

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

sanoid.conf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[template_os]
2+
hourly = 24 # 1 day of hourly snapshots
3+
daily = 7 # 1 week of daily
4+
weekly = 4 # 1 month of weekly
5+
monthly = 3 # 3 months of monthly
6+
autoprune = yes
7+
autosnap = yes
8+
9+
[template_media]
10+
daily = 30 # 30 daily snapshots
11+
monthly = 12 # 12 monthly
12+
yearly = 2 # 2 yearly
13+
autoprune = yes
14+
autosnap = yes
15+
16+
# Apply to datasets
17+
[zpcachyos]
18+
use_template = template_os
19+
recursive = yes
20+
21+
[media]
22+
use_template = template_media
23+
recursive = yes

sanoid.timer

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=Run Sanoid every 15 minutes
3+
4+
[Timer]
5+
OnCalendar=hourly
6+
Persistent=yes
7+
RandomizedDelaySec=15m # stagger execution
8+
9+
[Install]
10+
WantedBy=timers.target
11+

scripts/nas.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,22 @@ yay_install \
4343
cockpit-sensors \
4444
cockpit-zfs-manager \
4545
ntfy \
46-
resticprofile
46+
resticprofile \
47+
sanoid
4748

4849
WARNING "Remember to create ntfy config at /root/.config/ntfy/ntfy.yml"
4950

5051
sudo systemctl enable --now sshd
5152
sudo systemctl enable --now cockpit.socket
5253

54+
# zfs mainenance
55+
sudo cp "$DOTFILES_DIR/sanoid.timer" /etc/systemd
56+
sudo cp "$DOTFILES_DIR/sanoid.conf" /etc/sanoid/
57+
sudo systemctl daemon-reload
58+
sudo systemctl enable --now sanoid.timer sanoid-prune.service
59+
sudo systemctl enable --now [email protected]
60+
sudo systemctl enable --now [email protected]
61+
5362
# allow ufw to manage docker traffic
5463
sudo iptables -I DOCKER-USER -i enp4s0 -s 192.168.1.0/24 -j ACCEPT
5564
sudo iptables -I DOCKER-USER -i enp5s0 -s 192.168.1.0/24 -j ACCEPT

0 commit comments

Comments
 (0)