*New 12.1 series Release:
2019-11-08: XigmaNAS 12.1.0.4.7091 - released!

*New 11.3 series Release:
2019-10-19: XigmaNAS 11.3.0.4.7014 - released


We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

Snapshots in Time Machine-style

Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
ku-gew
Advanced User
Advanced User
Posts: 173
Joined: 29 Nov 2012 09:02
Location: Den Haag, The Netherlands
Status: Offline

Snapshots in Time Machine-style

#1

Post by ku-gew » 03 Dec 2012 09:10

Hello,
I would like to set up a N4F machine and I would like to take regular snapshots of its content. Being used to Time Machine under Mac, I would like to keep old snapshots using the same rules: one per hour in the last day, one per day for the last week, one per week for the past year, one per month after that time.
Is this possible? This would be a useful improvement over the interface I saw in the WebGUI, where this kind of snapshots can maybe be set manually, but not easily.
HP Microserver N40L, 8 GB ECC, 2x 3TB WD Red, 2x 4TB WD Red
XigmaNAS stable branch, always latest version
SMB, rsync

fsbruva
Advanced User
Advanced User
Posts: 383
Joined: 21 Sep 2012 14:50
Status: Offline

Re: Snapshots in Time Machine-style

#2

Post by fsbruva » 12 Dec 2012 14:23

The best thing I have found is zfs_snap, available on git-hub aXon github.

First: You need set the com.sun:auto-snapshot property for all datasets you'd like to snapshot. In this way, you can specify which datasets are protected, and which are not. The property has no usage outside of this snapshot script, so don't worry. Additionally, the script snapshots and destroys snapshots recursively. This is done via the commandline, e.g.:

Code: Select all

zfs set com.sun:auto-snapshot= true zpool/music
zfs set com.sun:auto-snapshot= true zpool/movies
zfs set com.sun:auto-snapshot= true zpool/pictures
Steps:
1. Create zfs_snap.sh script someplace non-volatile (my scripts are in a folder on my zfs pool)
2. Put the contents of the above shell script into a new file (being mindful of extra newlines if you use nano)
3. ADDING "exit 0" after the last line <---- VERY IMPORTANT
3. Save the script
4. Make the script executable
5. Create your cron jobs using System --> Advanced --> cron

It seems like you would want to create:
Hourly task that runs: bash /mnt/zpool/folder/zfs_snap.sh -d hourly -r 24
Daily task that runs: bash /mnt/zpool/folder/zfs_snap.sh -d daily -r 7
Weekly task that runs: bash /mnt/zpool/folder/zfs_snap.sh -d weekly -r 52
Monthly task that runs: bash /mnt/zpool/folder/zfs_snap.sh -d monthly -r (insert the total number of months you want to keep)

It would be good to test each of these cron jobs to ensure they run properly. Keep in mind, your first monthly snapshot you take (as it is the longest term) will persist and continue to grow until it has expired, so it is imperative that you do that today so you can always get back to today. Also, monitor the size of your snapshots, and you can adjust how many you keep accordingly, or send the snapshots for long-term backup.

I have: hourly keep 24, daily keep 7, weekly keep 5, monthly keep 12, yearly keep 10.

ku-gew
Advanced User
Advanced User
Posts: 173
Joined: 29 Nov 2012 09:02
Location: Den Haag, The Netherlands
Status: Offline

Re: Snapshots in Time Machine-style

#3

Post by ku-gew » 12 Dec 2012 15:57

Thank, I will try it!

You may also check this one:
https://github.com/jollyjinx/ZFS-TimeMachine

Duplication of efforts :(
HP Microserver N40L, 8 GB ECC, 2x 3TB WD Red, 2x 4TB WD Red
XigmaNAS stable branch, always latest version
SMB, rsync

fritz
experienced User
experienced User
Posts: 87
Joined: 12 Dec 2012 16:40
Contact:
Status: Offline

Re: Snapshots in Time Machine-style

#4

Post by fritz » 02 Jan 2013 15:21

Another option:

You can use the scripts I provided to the nas4free community here:
viewtopic.php?f=70&t=2197

fritz
O/S: NAS4Free 11.1.0.4 - Atomics (revision 5017) (Embedded 64bit), installed on 8GB USB flash drive
https://github.com/fritz-hh

Post Reply

Return to “ZFS (only!)”