Categories
Tech

How to: Configure FreeNAS 9.3 for Time Machine with disk quotas

FreeNAS Logo

FreeNAS is an amazing software stack and purpose built for hosting dedicated file storage shares, so it makes for an excellent platform to host a Time Machine compatible network share for use with OS X.

I wanted to build a server that would provide a reliable backup location with data redundancy for multiple Macs, with the ability to scale the storage space to meet future needs. Something which the current line of Apple TimeCapsules don’t offer, not to mention they are expensive for what they offer.

This setup will allow any Mac on the local network to backup to a central server using Ethernet/Wireless. I have gone the extra mile and included the ability of being able to remotely backup my MacBook Pro when away in London to my FreeNAS server at home using my OpenVPN server, but that’s for another post.

To clarify this was my first time using FreeNAS, I had no prior experience with the platform before writing this guide, so anyone should be able to recreate my setup with no prior knowledge of FreeNAS. My post is an updated version of an existing article I found, but is also a result of my own trial and errors. It takes time to figure out what works and what doesn’t.

Hardware

For storage I picked up 4 x WD Red 3TB for NAS (Inc WD Express Warranty) for £91.99 each (£183.98 total). I picked the 3TB over the 4TB partly because of cost, but namely for reliability as numerous forums discuss high failure rates for the 4TB models.

I decided to utilise one of my G7 HP MicroServers as a dedicated FreeNAS server. The 2 WD Red drives were installed for storage, as well as a 32GB SanDisk Cruzer for the FreeNAS OS. I also maxed out the 16GB Kingston ECC RAM to help cope with the ZFS filesystems (the minimum recommended is 8GB).

Prerequisites

FreeNAS 9.3 Homepage
You need to have a working install of FreeNAS before you can attempt this guide. I won’t detail over the OS installation as it’s fairly simple and has been documented numerous times over online, without forgetting to mention the amazing documentation that comes with FreeNAS Doc.
FreeNAS 9.3 is the current release at time of writing and is what this guide is based on, although future versions should also work fine.

Create ‘time-machine’ Group

The first step is to create a system group for the Time-Machine share in preparation for adding users.
Under the ‘Account’ menu item, expand the ‘Groups’ item, then select ‘Add Group’. Note that in my screenshots I already have a group called ‘Time-Machine’, your system won’t have until you complete this step.
Add Group in FreeNAS for TimeMachine

An ‘Add Group’ dialog box should pop up, prompting you to create the new group.
FreeNAS Group Settings
Set the config as follows:

  • Leave ‘Group ID’ to whatever it is by default
  • Set ‘Group Name’ to ‘time-machine’

Leave everything else as default and click OK. Our newly created ‘time-machine’ group should be visible under the ‘Groups’ section now.

Create and Configure Time-Machine ZFS Dataset

Now it’s time to create the ZFS dataset which will be used to store the Time Machine backups. You must have a ZFS volume already created for this step, if you haven’t got one then you should go read through the ZFS primer in the FreeNAS docs.

Under the ‘Storage’ tab select the ‘Volumes’ menu item, then select your ZFS volume (Volume1 in my case) and then select ‘Create Dataset’.
FreeNAS Create ZFS Dataset for TimeMachine

A ‘Create ZFS Dataset’ dialog box should pop up, prompting you to create the new ZFS dataset.
FreeNAS Create ZFS Dataset Dialog
Ensure the wizard is in ‘Advanced Mode’ and then set the config as follows:

  • Set ‘Dataset Name’ to ‘Time-Machine’
  • Set ‘Quota for this dataset’ to ‘1000 GiB’

In the section option we are specifying a quota for the dataset, effectively settings the size of available disk space for our Time Machine backups. Change the value if 1000 GiB is not suitable for your setup.
Leave everything else as default and click ‘Add Dataset’. Our newly created ‘Time-Machine’ dataset should be visible under the ‘Volumes’ section now.

Now we need to configure the permissions for our ‘Time-Machine’ dataset, so that our ‘time-machine’ group has read/write access.
Select the dataset (Time-Machine) and then select ‘Change Permissions’.
FreeNAS Change ZFS Permissions

A ‘Change Permissions’ dialog box should pop up, prompting you to edit the ZFS dataset.
FreeNAS Change ZFS Permissions Dialog
Set the config as follows:

  • Set ‘Owner (group)’ to ‘time-machine’
  • Set ‘Mode’ checkboxes to the same as mine in the screenshot

Click ‘By setting the group owner to the ‘time-machine’ group, we are granting any users of that group read/write/execute permissions.

Create Time-Machine Users

Now it’s time to create a separate user to represent each computer that will use the FreeNAS server for Time Machine backups.
Under the ‘Account’ menu item, expand the ‘Users’ item, then select ‘Add User’.
FreeNAS Create User Dialog
Set the config as follows, but change the relevant information related to your setup:

  • Leave ‘User ID’ to whatever it is by default
  • Set ‘Username’ to ‘dans-macbook-pro’
  • Ensure ‘Create a new primary group’ is deselected
  • Set ‘Primary Group’ to ‘time-machine’
  • Set ‘Full Name’ to ‘Dan’s MacBook Pro’
  • Set ‘Password’ to something strong (mix of; uppercase, lowercase, numbers, 16 chars long)

Leave everything else as default and click OK. Our newly created ‘dans-macbook-pro’ should be visible under the ‘Users’ section now.

Create Time-Machine AFP Share

The last step on the FreeNAS server is to create the AFP Share that will broadcast the storage on the local network.
Under the ‘Sharing’ tab select the ‘Apple (AFP)’ menu item, and then select ‘Add Apple (AFP) Share’.
FreeNAS Create AFP Share Dialog
Ensure the wizard is in ‘Advanced Mode’ and then set the config as follows:

  • Set ‘Name’ to ‘Time Machine’
  • Set ‘Path’ to your ZFS dataset path
  • Set ‘Allow List’ to ‘@time-machine’
  • Ensure the ‘Time Machine’ box is checked
  • Ensure the ‘Default file permission’ is set to the same as the screenshot
  • Ensure the ‘Default directory permission’ is set to the same as the screenshot

Add Time Machine Backup to OS X

Finally the last step is to configure Time Machine itself to backup to the newly created share.
In OS X, select ‘Time Machine’ from within ‘System Preferences’, and then click the ‘Select Disk’ button.
Add FreeNAS to Time Machine in OS X Dialog
All being well your FreeNAS AFP share should be listed. If you select to use the disk for Time Machine you will be prompted to enter the username and password for the FreeNAS user we created previously. That’s the last step, Time Machine should begin backing up shortly after adding the disk. I recommend that the first backup be completed over Ethernet instead of wireless as the initial backup can take considerable time.

I have used this setup for a couple of years now backing up 4/5 Mac’s with no real issues. Any problems I have ran into have most revolved around sudden shutdowns of the FreeNAS server midway through Time Machine backing up due to power cuts/loss. My Storage is setup using ZFS in striped mirrored mode, meaning I get the best of both for speed and disk redundancy.

Please let me know if you found this guide useful, or spot any mistakes above.

19 replies on “How to: Configure FreeNAS 9.3 for Time Machine with disk quotas”

Hi Dan,

Great article–thanks!. I realise this article is almost 5 years old; however, it is still very helpful. I do have one question.

Regarding creating the FreeNAS TimeMachine user(s), you state:
“…create a separate user to represent each computer that will use the FreeNAS server for Time Machine backups.” Why are unique/multiple users required?

Most everything in your article makes sense to me–except the need for multiple FreeNAS users. Time Machine (TM) starts by creating a folder containing the name of the device being backed-up, so why is it a problem if two different devices use the same FreeNAS TM user?

Thanks again for the article–
Scott

For some reason when I set the quota to 700GiB, My mac sees 752GB available. Is that going to cause a problem down the road? Any idea what is going on here?

I see you don’t monetize bytesandbolts.com, don’t
waste your traffic, you can earn additional cash every month with new monetization method.

This is the best adsense alternative for any type of website (they approve all
sites), for more details simply search in gooogle: murgrabia’s tools

Hello, I did as your article and it works great! I have HP Proliant Micro Server and it can get quite noisy and it is a power monster. What I wanna do is that at night I want my mac is to check if it is charging, if so check the network and if it is my home network send wol message to freenas and than start time machine backup and after completing backup send shutdown message to freenas. It can be scheduled for every night. This is what I could do so far,

– Get battery info
– Get the SSID of the network connected
– Start time machine backup
– Shutdown the freenas

I can’t WOL the device, any help is appreciated.

Big thanks for this. Wonderful tutorial, really. Everything works flawlessly, and my MacBook Pro connected smoothly to the Time Machine share. This also taught me a lot about clever ways how to use group shares.

Hello, I am using an HP similar to yours (min is a Microserver Gen 10). I am encountering pretty slow performances over wireless. Everything is on backups over ethernet, but on wireless Time Machine seems sleepy. I did some tests with iPerf3 and my wireless connection is good and stable (~400Mbit/s on 802.11ac) and transfering files from my Mac to my FreeNAS over wifi is pretty fast. Do you think I could check some settings? What’s your backup speed experience?
Thanks,
Emanuele

I followed the guide exactly, but when I go to “Select backup disk” it is not showing the disk. Any way of troubleshooting this? Any ideas?

Thanks

I have used this guide a number of times with no trouble t all. A good start into FreeNAS. Thanks

Setting this up for the first time, got all the way to the end and got a “Backup Disk Not Available” error from Time Machine on the Mac. Anyone else encounter this and have a fix?

By default Mac OS doesn’t show “unsupported” or non-Apple Time Machine network drives, but you can easily change that with one Terminal command:

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Thank you for this. I recently got engaged to someone with a Mac. This guide made the process of setting up her Time-Machine on my server a cinch.
Cheers!

It is a great and simple to follow guide. Thanks.
I have few questions though.

1. Have You ever tried to back up/ restore from Your FreeNAS machine? Did it go well?

2. How do You deal with several Macs backing up to one dataset? Did You create more shares, or adding a group to share is all it takes?

3. How do You manage quotas per user?

1. Backing up goes great.

2. I have two macs backing up to the one dataset, just the one share, it works great.

3. No quotas per user. If you want this then you would have to create an individual share per user. Note that this is not how Apple manages their own time machines either. When space is tight it deletes the oldest backups.

Regarding #3 – Per user quota in the same share/partition:

On an OS X server I manage, which is used as a backup destination for Time Machine clients, I do set the “quota” per user even though all users share one and the same share of a big size.

Since each client creates its own .sparsebundle, I simply do the following to set a max size and lock a bundle:

# hdiutil resize -size 30g TheClientComputerName.sparsebundle/
# SetFile -a L TheClientComputerName.sparsebundle/Info.*

This has worked literally perfectly for soon to be ten years. Each client is restricted to the size I set in the -size argument to `hdiutil`, and as usual deletes its own oldest backup when needed, and everyone gets their own share of the disk space on this share/partition.

The above is done on the server, I’m curious if there’s equivalent commands on the FreeNAS? Can it manage sparsebundles like that, and lock files?

Leave a Reply to Dirk Cancel reply

Your email address will not be published. Required fields are marked *