Today is notable in the history of OpenSolaris/Solaris development. Today the source code for ZFS, Sun’s next generation filesystem, was published. Today, binaries of Nevada build 27 became available so you can try ZFS yourself. And some night soon, we hope, you’ll sleep better knowing that your data is safe and sound because ZFS is protecting it.
Anyway, I want to talk about the marvelous integration work Eric did between ZFS and Zones. In ZFS, storage is pooled, and you can create one or many filesystems from the pool. Each filesystem acts as a container for those below it: filesystem properties set on a parent are inherited to children. Even better, you can allocate one or many of these containers to a zone– and then the zone can manage that container for itself, creating new child filesystems. This is an incredibly powerful form of delegated administration and I think it’s a great example of how our suite of technologies can be converged.
Here’s an example I did on my test system using a very small slice on a disk (the test box
happened to have only one disk):
trolls # zpool create mypool c0d0s3 trolls # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT mypool 95.5M 32.5K 95.5M 0% ONLINE - trolls # zfs create mypool/myzone-data trolls # zfs set compression=on mypool/myzone-data trolls # zfs set quota=30m mypool/myzone-data
So at this point, we’ve created a storage pool, enabled compression, and made sure that
myzone-data will never grow larger than 30MB in size. Now, we’ll add that dataset
to a zone on the system:
trolls # zonecfg -z myzone zonecfg:myzone> add dataset zonecfg:myzone:dataset> set name=mypool/myzone-data zonecfg:myzone:dataset> end zonecfg:myzone> \^D trolls # trolls # zoneadm -z myzone boot
Ok! Let’s now look inside the zone:
trolls # zlogin myzone [Connected to zone 'myzone' pts/3] Last login: Fri Nov 4 17:49:18 on console Sun Microsystems Inc. SunOS 5.11 onnv-gate:2005-11-07 October 2007 myzone # zfs list NAME USED AVAIL REFER MOUNTPOINT mypool 45.0K 79.5M 8K /mypool mypool/myzone-data 8K 30.0M 8K /mypool/myzone-data myzone # myzone # zfs create mypool/myzone-data/project1 myzone # zfs set mountpoint=/project1 mypool/myzone-data/project1 myzone # zfs set quota=10m mypool/myzone-data/project1
Cool: the zone adminstrator can further quota and subdivide the storage. Did
myzone # cat /dev/urandom > /project1/test cat: output error (0/1040 characters written) Disc quota exceeded myzone # ls -lh /project1/ total 20492 -rw------- 1 root root 10.0M Nov 15 13:28 test
As you can see, you can use ZFS to give a great deal of administrative freedom
to the administrator inside of zone without providing access to raw devices.
Even better, the tools offer one stop shopping for creating and managing filesystems and their properties.
Technorati Tag: Solaris