The doors have been flung open for ZFS, Sun's "last word in filsystems". It's now in OpenSolaris and there is a ZFS Community page where you can find introductions, demonstrations, and advanced discussions. We don't know when ZFS will appear in Solaris 10, but for it to appear in OpenSolaris shows that the process has began.
ZFS raises the bar for filesystems to a new height, and even changes the way you think about filesystems. Let me provide a quick demo, although I don't have an array of spare disks handy - you'll need to pretend that each of these 1 Gb slices is actually a seperate disk,
# zpool create apps mirror c0t1d0s0 c0t1d0s1 mirror c0t1d0s3 c0t1d0s4
That's it - 1 command for a ZFS pool, that is both mirrored and dynamically striped (think RAID 1+0), 256 bit checksum'd, remounted on boot, and can be grown to a virtually unlimited size.
Lets run a few status commands to check it worked.
# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
apps 1.98G 33.0K 1.98G 0% ONLINE -
#
# zpool status
pool: apps
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
apps ONLINE 0 0 0
mirror ONLINE 0 0 0
c0t1d0s0 ONLINE 0 0 0
c0t1d0s1 ONLINE 0 0 0
mirror ONLINE 0 0 0
c0t1d0s3 ONLINE 0 0 0
c0t1d0s4 ONLINE 0 0 0
#
# df -h -F zfs
Filesystem size used avail capacity Mounted on
apps 2.0G 8K 2.0G 1% /apps
The size of 2 Gb is correct, and the "zpool status" command neatly prints the layout.
Now perhaps a slightly more realistic demo (although still no seperate disks, sorry). Rather than having all the disks combine to one filesystem, ZFS is really intended to combine disks into pools, and then have multiple filesystems share a pool. The following quick demo shows this,
# zpool create fast mirror c0t1d0s0 c0t1d0s1 mirror c0t1d0s3 c0t1d0s4
# zfs create fast/apps
# zfs create fast/oracle
# zfs create fast/home
# zfs set mountpoint=/export/home fast/home
# zfs set compression=on fast/home
# zfs set quota=500m fast/home
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
fast 91.0K 1.97G 9.5K /fast
fast/apps 8K 1.97G 8K /fast/apps
fast/home 8K 500M 8K /export/home
fast/oracle 8K 1.97G 8K /fast/oracle
Each filesystem may have different options set, such as quotas, reservations and compression. If a filesystem was running out of space, quotas can be changed live with a single command. If the pool was running out of space, disks can be added live with a single command.
As a programmer there are times when you encounter something that is so elegant and obvious that you are struck with a feeling that it is right. For a moment you can clearly see what the developer was thinking and that they achieved it perfectly. ZFS is one of those moments.
No comments:
Post a Comment