ZFS on Mac OS X 10.5 - a closer Look

posted December 19th, 2006

Ok, now it is official: Mac OS X Leopard (Build 9a321) features support for ZFS. The rumors were true, you can create disk images with a ZFS filesystem, well at least in theory, because Build 9a321 is far away from being stable. The DiskUtility itself crashes again and again. Trying to create an actual ZFS image produces kernel panics. There is no pool support to create stripes, mirrors or even RaidZ in DiskUtility yet.

It seems that all the other rumor sites stopped right there, which is why we had to set up this website to show you how well ZFS is already implemented. We show you what works and what doesn’t. After reading you will know what the deal is, with ZFS and the upcoming Mac OS.

What most people are missing is the existance of command-line tools. The big news is, with Build 9a321, there is not only a ZFS.kext kernel extension, but there are also a bunch of command-line tools to manage your ZFS filesystems (as you will see as you read along). With these tools it is possible to create stripes, mirrors and RaidZ with ZFS!

I played around to find out how well ZFS is already implemented in 10.5. Here is what I did:

First, I simply added two SATA-disks with the following command-line: (I’m using files as disks now, because its much faster to play with.)

1> sudo zpool create tank mirror /Users/themachacker/test1 /Users/themachacker/test2

and boom – theres a zpool with 200MB (this is the size of the pool, not the usable size for filesystems in it)

1> sudo zpool status
pool: tank
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror ONLINE 0 0 0
/Users/themachacker/test1 ONLINE 0 0 0
/Users/themachacker/test2 ONLINE 0 0 0

errors: No known data errors

1> sudo zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
tank 95.5M 90K 95.4M 0% ONLINE -

Now we are enabling compression:

1> sudo zfs set compression=on tank
1> sudo zfs get all
NAME PROPERTY VALUE SOURCE
tank type filesystem -
tank creation Tue Dec 19 2:49 2006 -
tank used 87K -
tank available 63.4M -
tank referenced 24.5K -
tank compressratio 1.00x -
Bus error

Oops… we ran into a bug here, but the OS still is running.

Then I copied the sources of postgresql into it to test the compression ratio.

1> sudo zfs get all
NAME PROPERTY VALUE SOURCE
tank type filesystem -
tank creation Tue Dec 19 2:49 2006 -
tank used 54.3M -
tank available 9.21M -
tank referenced 54.1M -
tank compressratio 1.88x -
Bus error

1> du -sk postgresql-8.2.0
102008 postgresql-8.2.0

Originally the folder was about 100MB. With ZFS and compression it only uses 54M.

The fun thing is: you can turn compression on and off as you wish – all the time, even while the copy process is still running. The same applies for the checksum algorithm you want to use (fletcher2, fletcher4 or sha256).

Now I will delete one part of the mirror and create an empty one:

1> rm test2
1> mkfile 100m test2

how does it look now?

1> sudo zpool status
pool: tank
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror ONLINE 0 0 0
/Users/themachackers/test1 ONLINE 0 0 0
/Users/themachackers/test2 ONLINE 0 0 0

errors: No known data errors

ZFS has not detected anything. But you can check your pool with:

1> sudo zpool scrub tank
1> sudo zpool status
pool: tank
state: ONLINE
status: One or more devices has experienced an unrecoverable error. An
attempt was made to correct the error. Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool clear' or replace the device with 'zpool replace'.
see: http://www.sun.com/msg/ZFS-8000-9P
scrub: scrub completed with 0 errors on Tue Dec 19 03:04:12 2006
config:

NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror ONLINE 0 0 0
/Users/themachackers/test1 ONLINE 0 0 0
/Users/themachackers/test2 ONLINE 0 0 5.67K

errors: No known data errors

After the scrub it found out that one half is missing. Other Raid0 implementations would copy the whole disk again – not ZFS. It knows, which parts are used and and only copies these. That’s the improvement over solutions like LVM. On big disks you would watch the progress, in our case it already reports that scrub has completed.

So I do what it says:

1> sudo zpool clear tank
1> sudo zpool status
pool: tank
state: ONLINE
scrub: scrub completed with 0 errors on Tue Dec 19 03:04:12 2006
config:

NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror ONLINE 0 0 0
/Users/themachackers/test1 ONLINE 0 0 0
/Users/themachackers/test2 ONLINE 0 0 0

errors: No known data errors

Everything is fine again – what now? I think we should make our pool bigger. We buy bigger disks, in our case two new bigger files with 200MB each. You can then replace the older smaller disk. You could also make them mirrors and add them to the pool. But I want to replace the old ones to give them away:

1> sudo zpool replace tank /Users/themachackers/test1 /Users/themachackers/test3
1> sudo zpool replace tank /Users/themachackers/test2 /Users/themachackers/test4

So, what does it say now?

1> sudo zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
tank 196M 54.4M 141M 27% ONLINE -

But we are also interested in the usable size:

1> sudo zfs list
NAME USED AVAIL REFER MOUNTPOINT
tank 54.3M 109M 54.1M /tank

I made my old drives unused – which is exactly what I wanted. Simply think that your small tower can’t handle more than two drives.

To see what happened to your zpool you can look at the history of the commands:

1> sudo zpool history tank
History for 'tank':
2006-12-19.02:49:12 zpool create tank mirror /Users/themachackers/test1 /Users/themachackers/test2
2006-12-19.02:55:37 zfs set compression=on tank
2006-12-19.03:04:11 zpool scrub tank
2006-12-19.03:08:59 zpool clear tank
2006-12-19.03:12:24 zpool replace tank /Users/themachackers/test1 /Users/themachackers/test3
2006-12-19.03:12:39 zpool replace tank /Users/themachackers/test2 /Users/themachackers/test4

Since this feature came to open solaris only some weeks ago you can see that Apple is not very far behind with their code. It also supports RaidZ2 (the RaidZ version which supports double parity). You can see that with the following command:

1> sudo zpool upgrade -v
This system is currently running ZFS version 3.
The following versions are suppored:

VER DESCRIPTION
— ——————————————————–
1 Initial ZFS version
2 Ditto blocks (replicated metadata)
3 Hot spares and double parity RAID-Z

For more information on a particular version, including supported releases, see:

http://www.opensolaris.org/os/community/zfs/version/N

Where ‘N’ is the version number.

Since I’m testing this on a nice MBP C2D I don’t know if it also runs on PPC. But it looks like it does according to this:

1> file /System/Library/Extensions/zfs.kext/Contents/MacOS/zfs
/System/Library/Extensions/zfs.kext/Contents/MacOS/zfs: Mach-O universal binary with 2 architectures
/System/Library/Extensions/zfs.kext/Contents/MacOS/zfs (for architecture i386): Mach-O object i386
/System/Library/Extensions/zfs.kext/Contents/MacOS/zfs (for architecture ppc): Mach-O object ppc

Ok, that’s enough for tonight. But there is alot more to expore like: snapshots, clones and other cool features you don’t see in the usual filesystems.

This entry was posted on Tuesday, December 19th, 2006 at 1:36 pm and is filed under leopard, filesystem. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

27 Responses to “ZFS on Mac OS X 10.5 - a closer Look”

  1. soeren says » Blog Archive » Mac-specific ZFS intro Says:

    […] The website may have an awful name, but TheMacHackers.com provides a somewhat useful introduction to ZFS features. […]

  2. bbolli Says:

    Hey, great article. One small nit: your “About” link has a typo, is says “themaghackers.com”.

  3. :D Says:

    My small tower can handle 4 drives officially…and 6+ unofficially.

  4. Andrew Says:

    Um… You’re under NDA and shouldn’t be talking about this…

  5. fudo Says:

    Andrew,

    ZFS is open source, and Apple announced they were porting it to OS X months ago, and several other news sources have reported on it as well, just not with this level of detail. So where does this NDA come into play again?

  6. Andrew Says:

    Fudo,

    Non-public, feature level details of a developer preview of Leopard. That’s where.

  7. random visitor Says:

    I don’t think that they did worse than the other rumor sites which posted screen shots etc.

    They just added some details.

  8. fudo Says:

    Andrew,

    At the risk of being repetitious, ZFS is open source. That functionality is not OS X specific. How is it that Apple is going to enforce NDAs on open source projects?

  9. ZFS on Mac OS X 10.5 - a closer Look : planomug.com Says:

    […] Look closer yourself […]

  10. Damengineer Says:

    So, out of curiosity, can one create a raidz on a couple of usb drives (or firewire drives)?

  11. contact Says:

    Shouldn’t be a problem. Actually we wanted to post this kind of setup. You can put a USB drive, a Firewire drive and your internal hard drive together. Doesn’t make a difference.

  12. John Ladwig Says:

    @Damengineer:10, I have a coworker who’s doing ZFS raidset testing with pairs and forusomes of USB flash drives.

    Cost/meg is high, but cost/device is pretty attractive.

  13. Edward Says:

    Very nice information indeed. I think Apple has found it’s replacement for the aging HFS+.

  14. Chris Says:

    Only problem with it replacing HFS+ is that ZFS is, so far, not bootable. :) The community is working on that though.

  15. Justin Blanton | How a small, persistent team created a revolutionary file system Says:

    […] How a small, persistent team created a revolutionary file system. Kind of apropos (at least in my world) given the current hoopla surrounding Mac OS X Leopard’s ZFS support. © 1999-2006 Justin Blanton                    e v e r y t h i n g i s r e l a t i v e                    In partnership with DreamHost //’); //]]> […]

  16. UNIX-WORLD NEWS : ZFS on Mac OS X 10.5 - a closer Look Says:

    […] Complete story […]

  17. Daniel’s personal and sometimes geeky blog » ZFS on Mac OS X. Says:

    […] I can’t wait: TheMacHackers.com » Blog Archive » ZFS on Mac OS X 10.5 - a closer Look. That could prove really useful for Mac OS X. Heres hoping the Time Machine of 10.5 is going to use ZFS features for backup instead of full file copies (I read that somewhere, can’t remember where — not sure if it is true) […]

  18. aho Says:

    Howdy. How did you create your four test disks?
    Are they all the same size?

    I’m wondering if you can “replace” a disk with a
    larger one.

    Cheers!

  19. ..:: j3ns ::.. » Blog Archive » ZFS Says:

    […] I’m so much looking forward to the next release of OSX. Version 10.5 should include ZFS which I think is a killer filesystem. So if you are interested in knowing more about ZFS then I think you should read the “ZFS on Mac OS X 10.5 - a closer Look” post at at themachackers.com and the ZFS page at OpenSolaris. […]

  20. Expressed » MacBook Pro Says:

    […] I’m definitely getting a MacBook Pro when Leopard is out with at least one (if not two) patch, if only for ZFS support. That, and VMWare Fusion might be out by that time as well, and I can compare against Parallels (which has had sporadic reports of Cisco VPN not working under it). For the Windows partitions, one will be set aside specifically for the Documents and Settings directory, which will be shared amongst different boot partitions built for separate VPN clients (Cisco, Nortel, etc.), applications (Framemaker), etc. […]

  21. c0t0d0s0.org Says:

    Insights into ZFS on MacOS X 10.5

    The implementation of ZFS in Leopard seems quite final in respect to the infrastructure in the kernel and the command line: ZFS on MacOS X 10.5: a closer look

  22. shak Says:

    Great article ! Does anyone know if ZFS support will include USB disks attached via the new airport extreme ?
    I want a cheap, power efficient, robust, easy to maintain, networked home storage system for music, videos etc.
    ZFS is great, but I don’t want to have the disks attached to my G5 approx. 90 watts.

  23. James Alcasid Says:

    We may see ZFS included as a format option in MacOSX Leopard but for the time being inability to use ZFS for the fs boot volume, no DOD secure erase and lack of encryption will hamper adoption especially in government locations.

  24. John Lester Says:

    is OS 10.4.9 ppc dead in the water ??? Meaning i must get rid of all my tiger software and computer and buy a new system ??? It semes like a lot of waste here. Why cant i run time machine on tiger …it would help a lot ..

  25. Computer Maintenance Tips Says:

    Computer Maintenance Tips

    I couldn’t understand some parts of this article, but it sounds interesting

  26. Gibt es nur Idioten ? : technology, music and thoughts Says:

    […] In der Zwischenzeit beschäftige ich mich mit anderen Dingen, wie z.B. ZFS auf Apple oder meinen Basteleien, wie Mean Sucker VCF (wie passend). […]

  27. Usb Flash Drives Flash Drives Says:

    SSD Super Talent 32GB SATA Flash Hard Drive

    Brand new Super Talent 32GB SATA flash hard drive has boasted its real talent in the technology industry. It is instant access, light weight, and low power consuming hard drive. It is just perfect for your every-day needs and this SSD has a wide temper…

Leave a Reply