Stux
MVP
- Joined
- Jun 2, 2016
- Messages
- 4,419
Normally, when you setup Time Machine (TM) you must use a Quota of some sort, or Time Machine will allocate all of the space on your FreeNAS server. The traditional approach is to use a dataset quota, but this quota is a quota for ALL your time machine backups, and once the TM backups use up all the quota it does not work very well, as each TM instance will be relying on the other TM instances to clear their backups. This leads to failed backups.
And in fact, this is semi documented in the manual:
A much better approach is to use the same system that Mac OS X Server uses, where you set a global per-TM quota. If you need different quotas for different time machines, then you need to set up different TM shares, each with a different 'global' quota.
Using this method, won't lead to failed backups.
I posted the critical information on how to do this as a Feature Request for FreeNAS, and its at least been accepted as a Nice-To-Have feature, https://bugs.freenas.org/issues/17875
so there is some hope that it will appear as a feature in the future, but in the meantime, this is how to do it manually:
-----------------------------
Firstly, my pool is named "tank", this is a good default, but it doesn't matter what you use. Secondly, my data set is named tm_backups, and I use a single Time Machine User named "tm_user", because I find it more convenient to log all the various macs in with a single backup account. There are security implications with this approach. Feel free to change the specifics as you want.
Moving on.
Firstly, create a time machine user.
From the left column, click "Account", then "Users", then "Add User"
Next, create a tm_backups dataset
From the left column, click "Storage", then "Volumes" then "/mnt/tank" then "Create Dataset"
Once the dataset is created click it, then "Change Permissions"
Now, we'll set up the OSX server style TM quota.
Decide how many bytes you want each Time Machine to use... for example 1 trillion bytes would be a TB, which is 1,000,000,000,000
Enable SSH if you haven't already then, SSH into your root account.
then in the nano window paste:
But change "1000000000000" to how many bytes you want to allocate to each TM backup. Generally its recommended to be twice the size of the HD that you're backing up. Here I'm allowing up to 1TB for each backup.
(press control-x to exit and save in nano)
if you do:
you should see something like this
Next we'll setup the AFP Share.
Enable AFP serving if you haven't already, then click "Sharing" from the left column, then "Apple (AFP) Shares" then "Add Apple (AFP) Share"
Browse to your tm_backups dataset, or just type the path ie /mnt/tank/tm_backups
You should now be able to go to each of your Macs and select your FreeNAS Time Machine as the backup destination. login as tm_user with the password you set.
Each mac will use up to the number of bytes you specified in Nano.
You can verify this by looking at Console.app on your Mac, and searching for "backupd"
You will see something like this:
If you want to have different quotas, then you will need different datasets for each quota, and a different AFP share. If you name the shares based on their Quota, then you can simply choose which quota to use, based on which share you point the mac at.
Time Machine will take care of ensuring that every Mac automaticaly prunes its backup to fit within the per-machine quota for that share. You can also change the quota at any time, and the TM process will prune the quota next time it runs on a given mac, if you reduced the quota.
The nice thing is as your 'fleet' of macs grows, and your backup requirements grow, you can just grow your pool as the ZFS space aliens intended.
IIRC TM Quota support was added in Mac OS X 10.8, and won't work with older versions of the OS.
And in fact, this is semi documented in the manual:
...due to a limitation in how the Mac deals with low-diskspace issues when multiple Macs share the same volume, checking Time Machine on multiple shares could result in intermittent failed backups
A much better approach is to use the same system that Mac OS X Server uses, where you set a global per-TM quota. If you need different quotas for different time machines, then you need to set up different TM shares, each with a different 'global' quota.
Using this method, won't lead to failed backups.
I posted the critical information on how to do this as a Feature Request for FreeNAS, and its at least been accepted as a Nice-To-Have feature, https://bugs.freenas.org/issues/17875
so there is some hope that it will appear as a feature in the future, but in the meantime, this is how to do it manually:
-----------------------------
Firstly, my pool is named "tank", this is a good default, but it doesn't matter what you use. Secondly, my data set is named tm_backups, and I use a single Time Machine User named "tm_user", because I find it more convenient to log all the various macs in with a single backup account. There are security implications with this approach. Feel free to change the specifics as you want.
Moving on.
Firstly, create a time machine user.
From the left column, click "Account", then "Users", then "Add User"
Next, create a tm_backups dataset
From the left column, click "Storage", then "Volumes" then "/mnt/tank" then "Create Dataset"
Once the dataset is created click it, then "Change Permissions"
Now, we'll set up the OSX server style TM quota.
Decide how many bytes you want each Time Machine to use... for example 1 trillion bytes would be a TB, which is 1,000,000,000,000
Enable SSH if you haven't already then, SSH into your root account.
cd /mnt/tank/tm_backups
touch .com.apple.timemachine.supported
nano .com.apple.TimeMachine.quota.plist
then in the nano window paste:
Code:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>GlobalQuota</key> <integer>1000000000000</integer> </dict> </plist>
But change "1000000000000" to how many bytes you want to allocate to each TM backup. Generally its recommended to be twice the size of the HD that you're backing up. Here I'm allowing up to 1TB for each backup.
(press control-x to exit and save in nano)
if you do:
ls -alt
you should see something like this
Code:
[root@titan] /mnt/tank/tm_backups# ls -alt total 46 -rw-r--r-- 1 root wheel 207 Oct 31 16:23 .com.apple.TimeMachine.quota.plist drwxrwx--- 2 tm_user wheel 6 Oct 31 16:23 ./ -rw-r--r-- 1 root wheel 0 Oct 31 16:23 .com.apple.timemachine.supported -rw-r--r-- 1 root wheel 0 Oct 31 16:23 .mac -rw-r--r-- 1 root wheel 0 Oct 31 16:20 .apple drwxr-xr-x 10 root wheel 10 Oct 31 16:20 ../
Next we'll setup the AFP Share.
Enable AFP serving if you haven't already, then click "Sharing" from the left column, then "Apple (AFP) Shares" then "Add Apple (AFP) Share"
Browse to your tm_backups dataset, or just type the path ie /mnt/tank/tm_backups
You should now be able to go to each of your Macs and select your FreeNAS Time Machine as the backup destination. login as tm_user with the password you set.
Each mac will use up to the number of bytes you specified in Nano.
You can verify this by looking at Console.app on your Mac, and searching for "backupd"
You will see something like this:
Code:
31/10/2016 2:43:38.085 PM com.apple.backupd[43726]: Quota in effect for '/Volumes/FreeNAS Time Machine': 1 TB (1,000,000,000,000 bytes)
If you want to have different quotas, then you will need different datasets for each quota, and a different AFP share. If you name the shares based on their Quota, then you can simply choose which quota to use, based on which share you point the mac at.
Time Machine will take care of ensuring that every Mac automaticaly prunes its backup to fit within the per-machine quota for that share. You can also change the quota at any time, and the TM process will prune the quota next time it runs on a given mac, if you reduced the quota.
The nice thing is as your 'fleet' of macs grows, and your backup requirements grow, you can just grow your pool as the ZFS space aliens intended.
IIRC TM Quota support was added in Mac OS X 10.8, and won't work with older versions of the OS.
Last edited by a moderator: