Skip to content

Commit c135084

Browse files
committed
Add sanoid
1 parent a7a06f2 commit c135084

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,11 +43,20 @@ yay_install \
4343
cockpit-sensors \
4444
cockpit-zfs-manager \
4545
ntfy \
46-
resticprofile
46+
resticprofile \
47+
sanoid
4748

4849
sudo systemctl enable --now sshd
4950
sudo systemctl enable --now cockpit.socket
5051

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

0 commit comments

Comments
 (0)