Home > Data Center Tips > > Getting started with Sun ZFS file system
Data Center Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 


Getting started with Sun ZFS file system


Ben Rockwood, Contributor
01.07.2009
Rating: -4.67- (out of 5)


IT infrastructure news
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Sun ZFS is a new kind of file system -- it is a fundamentally new approach to data management. Sun's ZFS file system is the brainchild of Jeff Bonwick, Sun Microsystems Chief Technical Officer of Storage Technologies, who spent years working on the Solaris Virtual Memory system, which applied virtual memory concepts to storage.

When you add a DIMM, you don't partition it, you don't allocate it, and when it is replaced you don't fsck it. Memory management is something we all take for granted because complex software masks management away. ZFS was born with the intent to bring the same advantages to storage.

At first glance, the most striking feature of ZFS is that it combines the volume manager (which virtualizes disks, typically via RAID) and the file system into a single piece of software.

Disks are formed into a storage "pool" using a single simple command:

Using the simple command "zpool create" we specify a name for our pool ("mypool") and then the drives we want to assign to that pool, in this case three. This creates a "dynamic stripe," akin to RAID0 with the added bonus that strip width is not set in stone.

The proceeding commands in the example explore our new creation.

will give you a quick summary of available pools
will output information about the pool configuration, status and errors
will show us all our available datasets
is our old and trusty friend that displays information about mounted file systems

This is the fantastic part. Notice carefully what has happened and what we didn't need to do! The disks were partitioned, the RAID was set up and made ready, the file system was created and it was mounted.

Using the traditional Unix Logical Volume Manager we would need to partition the disks, create physica...


BROWSE BY TAG
Sun Solaris Unix and Sparc server platforms,   Server hardware,   Unix operating systems and servers,   Data center storage,   VIEW ALL TAGS

Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Sun Solaris Unix and Sparc server platforms
Are containerized data centers catching on outside Microsoft, Google?
Will Oracle hold a Sun yard sale as the acquisition's value declines?
Sun Microsystems customers stew in limbo
Will Solaris on x86 survive the Oracle-Sun acquisition and Linux?
Unix updates are slower, and users like it that way
New eBay data center director dishes
How should Sun customers read Oracle's latest rumblings?
With Exadata, Oracle embraces Sun hardware
Solaris Project Crossbow offers virtualized network management
IBM announces Power7 upgrade path in uncertain Unix market

Data center storage
How will SSD fit into the data center?
EMC to buy RSA Security for $2.1 billion
Deduping: an essential backup tool in the data center?
Data center storage fast guide
Tiered storage shifts focus away from disk
Leasing vs. buying storage: A closer look
Minimize storage costs; cut out the fat
CDW improves backup server speeds by 1,000%
EMC adds Kashya to InVista
Three ways to virtualize storage

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Andrew  (SearchDataCenter.com)
MVS  (SearchDataCenter.com)
RAIN  (SearchDataCenter.com)
VSAM  (SearchDataCenter.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


l volumes, then create a logical volume, then create a file system, create a mount point and mount the volume.

Furthermore, Veritas Volume Manager or Logical Volume Manager commands are long, complex and frustrating!

With ZFS this was one simple and easy-to-understand command without any hard work. If you don't appreciate the full gravity of how remarkable this is, you should spend more time setting LVM or VxVM and then come back.

Drawing from the memory paradigm, now that the pool is in place we won't touch it again unless we want to add or replace disks in the pool. Really and truly, that is it.

File systems: Data sets and properties
ZFS changes the way we think of a file system. Traditionally we are limited to one file system per volume. And why shouldn't we be? Except consider that individual file systems may need different mount options or mount points. The way to solve this in the past was to create smaller volumes and create separate file systems for each purpose, but given the complexity in managing this you can only get so granular. There is also a considerable overhead in disk consumption for each file system.

In ZFS we instead think of a pool containing multiple data sets. A data set is a generic term that is for all intents and purposes just like what you consider a file system to be. A data set can have any mount point you wish, and can enable or disable certain mount options, such as turning "atime" on or off, setting read-only, etc. Except that now datasets are extremely lightweight and mount options are replaced with "data set properties".

Furthermore, data sets can be nested to form more management structures. In this way, data sets now become a point of administrative control for assigning quotas, mount points, compression, etc. Essentially you can create hundreds or thousands of "file systems" on a single system, perhaps one for each user's home directory. The more data sets, the more control you have.

Let us create some data sets using the "zfs create" command and change the point for them using the ZFS "mountpoint" property.

Notice that we've created nested data sets, and when I changed the mount point for "mypool/home" it also trickled down to all its children. This recursive behavior is known as "inheritance." I could easily override any one of the children, but when dealing with large numbers of data sets this makes life much simpler.

Now let us uncover some of ZFS's deep magic by looking at ZFS data set properties on one of these data sets:

Here we have a variety of useful knobs to turn. The first several properties are informational, such as creation time, space used, available and referenced. Here is a short list of what some of these properties are and how to use them:

  • * quota: Space quotas can be imposed anywhere, and they are recursive by default. Simply "zfs set quota=10g mypool/home/user001" and that user can never use more than 10GB of disk.
  • * reservation: Similar to a quota, but reservations are "pre-allocated." The disk space is removed from common use so that the space is guaranteed.
  • * mountpoint: Place where the data set is mounted. Mount points are created by ZFS on your behalf.
  • * compression: Just "zfs set compression=on mypool" and all new data will be compressed! Define this for everything or on a case-by-case basis.
  • * atime: If atime is "on" everytime you touch a file, its time stamp will be updated, which can be a lot of unwanted write activity. Use "zfs set atime=off mypool" to disable it.
  • * readonly: Want to lock away archive data? Just "zfs set readonly=on mypool/home/user002" and the user can look but not touch.

Three really exciting options above are "sharenfs", "shareiscsi", and "sharesmb". By simply turning the property on (zfs set sharenfs=on mypool/home) you've exported that, and any children, via NFS. No fuss no muck, turn it on and your done. The same applies to iSCSI or CIFS ("smb").

Volumes
Like file systems, we can also create block volumes as easily. With these volumes we can create legacy file systems (UFS, VxFS, etc.) or share iSCSI block volumes.

You can see that creating a block volume data set is done in the same way as file system data set. We simply add "-V" proceeded by the desired size.

If we'd added the "-s" flag after "create," we would have created a "sparse" volume, which is better known as thin provisioning. Thin provisioning means that we've defined a block allocation but we're not going to actually steal away the blocks until they are actually requested. In this way, we could create dozens of block volumes even if we didn't have enough space for them right now. Because resizing file systems can be complex, this allows us to oversize for the future even if the disk isn't actually available at the moment.

Here is a grotesque example on my little pool with only 2.2 GB available:

Notice I created a 1 TB volume, but its only consuming 16 K.

Snapshots and cloning
ZFS makes things easy to create and manage as we've seen, but it also brings enterprise-grade features down to the average user. The best example is that of snapshots and cloning.

We can create a snapshot using the "zfs snapshot" command, and following the data set name with an "@" and the desired snapshot name.

The "@" character specifies a snapshot, followed by the name. Snapshots are lightweight and created instantaneously.

One of the advantages of snapshot is the ability to cherry pick files out of them.

In the "/myhome/user001" mount point we'll find a hidden directory that can not be seen but will give us access to the snapshot contents:

Here we can traverse the file system as it appeared at the snapshots point-in-time and recovery files by simply copying them out.

Snapshots are used for many things, but let's look at cloning. For example, if you are working on a project and want to create a copy of it for another user so he doesn't mess with your work, no problem! Create a snapshot and clone it!

You can take that clone and NFS or CIFS share it, or do whatever you like!

ZFS brings enterprise storage capabilities to any system of any size. All the examples I used were preformed using three 1 GB USB sticks. Administration is simple, easy to understand and extremely fast. I hope this article has given you that warm fuzzy feeling that will help you get started using this amazingly powerful open source technology in your environment.

ABOUT THE AUTHOR: Ben Rockwood is the director of systems at cloud computing infrastructure company Joyent Inc. A Solaris expert and Sun evangelist, he lives just outside of Silicon Valley, Calif., with his smokin' hot wife Tamarah and their three children. Read his blog at cuddletech.com.

Rate this Tip
To rate tips, you must be a member of SearchDataCenter.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



White Papers - Data Center Networking

The Intel IT Technology Center - Power, Performance and Mobility Solutions

HomeNewsTopicsITKnowledge ExchangeTipsBlogsMultimediaWhite PapersEvents
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts