project-trident / trident-docs Public
zfs snapshot and pruning
Sven Putze edited this page Feb 29, 2020
·
8 revisions
Pages 17
Table of Contents
General Information
Terminal-based Configuration
Graphical Configuration
ZFS References
- ZFS Snapshots and Pruning
- ZFS Send and Receive
- Exporting/Importing Datasets
- Moving Default Home Directory to a Separate Drive
General How-To's
Clone this wiki locally
PLEASE NOTE: I am using trident as the zpool name, adjust as you need to for those wishing to take automatic snapshots of the ~/HOME directory.
First install zfs-prune-shapshots. Either using octoxbps or command line
This will clean out ONLY the ~/HOME snapshots.
Open a terminal and type the following;
mkdir /usr/home/$USER/bin
touch /usr/home/$USERbin/snapshot.sh
chmod 744 /usr/home/$USERbin/snapshot.sh
lte /usr/home/$USER/bin/snapshot.sh
now copy and paste the following into the file;
#!/bin/sh
## working - all of /home
# /bin/zfs snapshot -r trident/home@`date +"%F"-"%H":"%M"`
## working - /home/$USER
# replace john with your user name
/bin/zfs snapshot -r trident/home/john@`date +"%F"-"%H":"%M"`
Note there are two options. 1 for all of ~/HOME, the other for your users ~/HOME only. Save the file and close
now type;
sudo lte /var/spool/cron/root
Copy and paste the following;
0 0,2,4,6,8,10,12,14,16,18,20,22 * * * /usr/home/john/bin/snapshot.sh
0 3 * * * /bin/zfs-prune-snapshots -v 1w trident/home >> /var/log/snapshot.log
The top line takes a snapshot of your ~/HOME every two hours. And the bottom line will delete the snapshot(s) after a week.
Save and close the text editor.
This should start snapshotting your system every 2 hours.
Quick Links
- Main Website: https://project-trident.org
- Sponsorships available! https://project-trident.org/sponsors
- Void Linux Documentation
- Void Linux Rosetta Stone: Dictionary of commands between different Linux distros.
- Void Linux FAQ