Posts Tagged ZFS
Using a ZFS filesystem with Time Machine
Posted by Greg in Unix / Linux on October 4, 2009
This simple how-to explains how to get your Time Machine backups working with a ZFS filesystem. This allows you to use the features of ZFS filesystems for your Time Machine backups.
Please note this is for Mac OS X – Snow Leopard.
1) Enable unsupported network volumes on your Mac by opening a Terminal and pasting this:
greg@macbook:~ %> defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
2) Create a new ZFS filesystem and enable CIFS access to it:
greg@opensolaris:~ %> zfs create tank/userbackups greg@opensolaris:~ %> zfs set sharesmb=on tank/userbackups greg@opensolaris:~ %> zfs set sharesmb=name=userbackups tank/userbackups greg@opensolaris:~ %> zfs set aclmode=passthrough tank/userbackups greg@opensolaris:~ %> zfs set aclinherit=passthrough tank/userbackups
You will probably want to setup the correct permissions on your new share, more details in [this post].
3) Make sure you can mount this share and write to it from your Mac.
4) Create the correct disk image:
greg@macbook:~ %> /bin/bash
greg@macbook:~ %> cd /Volumes/userbackups
greg@macbook:~ %> SYSNAME=`scutil --get ComputerName`
greg@macbook:~ %> hdiutil create -size 600G -fs HFS+J \
> -volname 'Time Machine Backups' -type SPARSEBUNDLE "${SYSNAME}.sparsebundle"
greg@macbook:~ %> UUID=`system_profiler | grep 'Hardware UUID' | awk '{print $3}'`
greg@macbook:~ %> cat << EOF > "${SYSNAME}.sparsebundle"/com.apple.TimeMachine.MachineID.plist
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
> <key>com.apple.backupd.HostUUID</key>
> <string>$UUID</string>
> </dict>
> </plist>
> EOF
greg@macbook:~ %>
5) and finally, open up Time Machine. You should now see your network share as an option. Choose it, configure any excludes you want and kick off your first backup!
I’ll post a little later on restoring these backups using one of these methods:
- Restore from Time Machine by using the boot disk
- or by doing a standard install then using the Migration Assistant.
Good luck!
The basics of ZFS ACLs
This post was mostly inspired by reading this post in trying to get my head around the ZFS ACL and permission system.
Basically I have a pool set out as follows:
tank tank/media tank/zones
tank/media is served via CIFS and NFS to multiple clients on my network, each with their own unix account on the OpenSolaris server. tank/zones is used for extra zones running on the host.
Everything was working great until I found that files and directories created by clients ended up looking like this:
---------- 1 greg staff 734310400 2009-07-18 19:10 foo.txt d--------- 2 greg staff 19 2008-12-06 14:10 Bar
This sure didn’t go down well when other users needed to access those files or directories.
So in following the above mentioned post I did this:
# zfs set aclinherit=passthrough tank/media # zfs set aclmode=passthrough tank/media # /bin/chmod 0774 /tank/media # /bin/chmod -R A- /tank/media # /bin/chmod -R A=owner@:full_set:fd:allow /tank/media # /bin/chmod -R A+group@:full_set:fd:allow /tank/media # /bin/chmod -R A+everyone@:read_set:fd:allow /tank/media
A better description of what the flags / syntax mean can be found here and here
A simple breakdown:
- First off, we tell ZFS that all files or directories must inherit all acls / permissions from their parent.
- We use /bin/chmod as the chmod in the default path is the GNU chmod which does not understand ZFS acls.
- The second chmod “A-” will remove all acls currently set on the object.
- We then set the owners permission to the “full_set”, thus giving the owner all possible permissions.
- We do the same for the group.
- Finally, we give everyone else read access.