Monday, November 23, 2009

Mac OSX Time Machine and FreeNAS 0.7

Since FreeNAS 0.7 it is easy to configure TimeMachine to use a AFP share (like Apple's Time Capsule)... Here is a short howto :-)

First step: Configure FreeNAS

-> Enable AFP
-> Configure the share
  • Automatic disk discovery - Enable automatic disk dicovery
  • Automatic disk discovery mode - Time Machine
Second Step: Configure OSX Time Machine

-> Select System Preferences -> Time Machine
-> Select Backup Disk
-> and Authenticate
Thats it!


Your FreeNAS will work now similar than a TimeCapsule. Enjoy! Details can be found here...

I've combined this with ZFS. With two clients and regular backups since two months, I have here a compression (gzip) enabled volume with 238 GByte. The compression ratio (compressratio) is at 1.24x

freenas:~# zfs get compressratio data0/timemachine
NAME PROPERTY VALUE SOURCE
data0/timemachine compressratio 1.24x -


Instead of 295 GByte, only 238 GBytes are used. IMHO this is great :-)


If you want to see how to do a complete restore of your system, please see my new blogpost "Mac OS X system restore using time machine and FreeNAS"

23 comments:

bmcclure937 said...

Nice. Now I need to find a way to configure Time Machine to use the share (which is part of my 3x1TB ZFS RAIDZ) and not think it has ALL of the space available for back-ups.

I do not want Time Machine daily back-ups slowly eating away at all of my space!

I have had Time Machine over AFP from my FreeNAS configured for quite some time now (since it had support added in Nightly Builds) but I turned off Time Machine backups for this reason.

On top of this, it seems I should also look into tuning my ZFS configuration to possibly use compression, as it proves to work nicely. Are there any disadvantages of compression? Any speed/performance issues?

Can I change my current RAIZ to use compression or would I need to back up my data and rebuild the ZFS pool (or whatever it is called, I get my terms mixed up with ZFS).

harryd said...

Why don't you just set a quota for this share? -> WebGUI -> Disks|ZFS|Datasets|Dataset|Edit -> Quota. This works well for me!

harryd said...

Regarding the compression... I've enable gzip (and yes you can enable it for an existing zfs. But only new files will get compressed) my savings for 2x MBP's 1.24x (which is IMHO quite ok!)

bmcclure937 said...

Thanks for the quick replies!! I quickly logged onto my FreeNAS from work to look into setting the quote for my dataset... but found that I do not have any "datasets" listed :(

I only have my 3x1TB disks setup in a RAIDZ... it looks like the only thing configured is a pool and a virtual device. How do I begin using datasets and what is the best way to go about doing this?

Sorry, I am not a FreeNAS noob or anything but I do not have much experience with ZFS. Hopefully you will be able to educate me and help me out along the way.

harryd said...

So you've just configured a zpool but no dataset, right? Did you've done a 'zfs list'?

I would recommend you to use the WebGUI -> Disks|ZFS|Datasets|Dataset and create a dataset for your TimeMachine backups. You will be able to set a quota and enable compression.

Travis said...

It took me a while to figure this out. When trying to create an AFP share on a ZFS dataset, I had to first ssh in as root. Then I created a new directory under the ZFS dataset, did a chown user:group, and finally a chmod 775. This allowed me to create the AFP share and use it for Time Machine.

papaskitch said...

Has anyone tried to do a full restore from using this method? Just wondering if there'd be any hiccups.

matt said...

We attempted a restore Leopard OSX server which proved to be a little tricky, see my post for details http://www.junasoftware.com/blog/system-restore-from-time-machine-on-freenas.aspx. Its certainly a good idea to consider how you are going to restore it even try it.

harryd said...

Hi matt,

it looks like you use an old version of FreeNAS or how you are doing the backup to FreeNAS with timemachine. The last version of FreeNAS 0.7 doesn't need the 'hack' with 'defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1' and creating the sparsebundle. But I want to try it myself and will post here an update...

jlocicero said...

Harry, can you add some more details (and screenshots) about how to use quotas and datasets? I have no problem making the dataset with a quota, but I can't figure out how to make it work with my AFP service.

I want to use my FreeNAS server as both a general purpose server and a Time Machine backup disk. Do I need more than one AFP share?

Thanks for your help. You method seems a lot easier than others I've seen!

harryd said...

Hi jlocicero,

I use ZFS and it is easy to change the quota setting of a dataset. Use the WebGUI and go to -> Disks|ZFS|Datasets|Dataset|Edit and change the 'Quota' setting.
In your case I would recommend one share for the usage of timemachine and one or more different shares for your data...

jlocicero said...

Hi again, Harry. Thanks for answering my questions.

I've set up exactly as your post indicates, but when I point Time Machine at the correct share, it gives me the error message: "Time Machine can’t access the backup disk “Time Machine”. The operation couldn’t be completed. (OSStatus error 13.)"

Any ideas? :)

harryd said...

Hi jlocicero,

do you've set the right permission? You can ssh to your server and do a 'chmod -R 777 /mnt//'. Be careful! This will give permission to everyone.

jlocicero said...

Thanks again Harry. I haven't tried the ssh command you gave me because then I'd have to learn about ssh commands! I want to try to solve it in the FreeNAS user permissions, if possible.

I've got my Time Machine dataset ready to go now, I've got a separate share for my Time Machine dataset and my other, general data, and I've got users and permissions set up so I can access my general data share - but not the Time Machine dataset. I can't write anything to it, just like before. And when I try to point Time Machine at it, I get this new error message: "You do not have the necessary read, write and append privileges on the selected network backup disk. Please connect as a different user or contact your network administrator."

That's different.

Is it something to do with groups? My user is set as part of the "wheel" group - that allows me access to the general share. Do I need to be a part of another group to access the Time Machine dataset?

I appreciate your thoughts, and I'm trying hard not to be a pest! :)

jlocicero said...

harryd, sorry about that last post. I see now that you have been trying to help me in the FreeNAS forums. Please disregard my last post here, and have a look at https://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=97&t=5449&p=26499#p26499

I've posted the information you requested.

Thank you very much!

harryd said...

Please see the answer at tho forum post.

IMHO, you didn't executed the chmod to the right directory...

chmod 777 /mnt/pool1/timemachine

jlocicero said...

All is working now. Very nice! Thank you for your help, harryd!

elf said...

I have 0.7 Khasadar (revision 4919) and setup TM to use the AFP share...it was really easy (previously I had manually created a sparsebundle and allowed network disks to show...in an old SMB share). Now with Freenas, it seems to be working great, but when I enter the TM I cannot see the history of backups. Only "now" and "today". I read in other forums that I can mount the sparsebundle image and browse other disks, but I cannot see the mounted image. If I browse the filesystem I do see the directory structure with older dates, and the todal size is 71GB, which sounds right. If anyone has any experience with this, pass it on! :)

Badaap said...

Thank you very much indeed harryd. I'm gonna update my virtual freenas, and try this out. It'll be great!

Phillip said...

I must be doing something wrong with permissions because I cannot write to this share in time machine or anything else. any help on permissions or authentication?

harryd said...

@Phillip: you can try a 'chmod 777 /mnt/pool1/timemachine'

Levi said...

I don't know what I'm doing wrong but I set up the things as you said. I still can't see anything in time machine but I can connect to the server through finder. I am running through VMWare Fusion but I have a direct connection for the virtual machine to the network. What are the other things that I need to set with the drives? I have a drive, formatted in ZFS, mounted, and a folder on there called "timemachine" but I can't get it to be seen on my Mac.

Any ideas?

Levi said...

Nevermind. It was just a permissions thing. Thanks for your help!