Chapter 2 Getting
Started With Oracle Solaris ZFS

This chapter provides step-by-step instructions on setting up a basic
Oracle Solaris ZFS configuration. By the end of this chapter, you will have
a basic understanding of how the ZFS commands work, and should be able to
create a basic pool and file systems. This chapter does not provide a comprehensive
overview and refers to later chapters for more detailed information.

ZFS Hardware and Software Requirements and Recommendations

Ensure that you review the following hardware and software requirements
and recommendations before attempting to use the ZFS software:

Use a SPARC or x86
based system that is running at least the Solaris 10 6/06 release or later release.

The minimum amount of disk space required for a storage pool
is 64 MB. The minimum disk size is 128 MB.

The minimum amount of memory needed to install a Solaris system
is 768 MB. However, for good ZFS performance, use at least one GB or more
of memory.

If you create a mirrored disk configuration, use multiple
controllers.

Creating a Basic ZFS File System

ZFS administration has been designed with simplicity in mind. Among
the design goals is to reduce the number of commands needed to create a usable
file system. For example, when you create a new pool, a new ZFS file system
is created and mounted automatically.

The following example shows how to create a basic mirrored storage pool
named tank and a ZFS file system named tank in
one command. Assume that the whole disks /dev/dsk/c1t0d0 and /dev/dsk/c2t0d0 are available for use.

Typically, you want to create and organize a hierarchy of file systems
that matches your organizational needs. For information about creating a hierarchy
of ZFS file systems, see Creating a ZFS File System Hierarchy.

Creating a ZFS Storage Pool

The previous example illustrates the simplicity of ZFS. The remainder
of this chapter provides a more complete example, similar to what you would
encounter in your environment. The first tasks are to identify your storage
requirements and create a storage pool. The pool describes the physical characteristics
of the storage and must be created before any file systems are created.

How to Identify Storage Requirements for Your ZFS
Storage Pool

Determine available devices for your storage pool.

Before
creating a storage pool, you must determine which devices will store your
data. These devices must be disks of at least 128 MB in size, and they must
not be in use by other parts of the operating system. The devices can be individual
slices on a preformatted disk, or they can be entire disks that ZFS formats
as a single large slice.

ZFS supports multiple types
of data replication, which determines the types of hardware failures the pool
can withstand. ZFS supports nonredundant (striped) configurations, as well
as mirroring and RAID-Z (a variation on RAID-5).

How to Create a ZFS Storage Pool

This name is used
to identify the storage pool when you are using the zpool and zfs commands. Most systems require only a single pool, so you can
pick any name that you prefer, but it must satisfy the naming requirements
in ZFS Component Naming Requirements.

Create the pool.

For example, the following command
creates a mirrored pool that is named tank:

# zpool create tank mirror c1t0d0 c2t0d0

If one or more devices contains another file system or is otherwise
in use, the command cannot create the pool.

Creating a ZFS File System Hierarchy

After creating a storage pool to store your data, you can create your
file system hierarchy. Hierarchies are simple yet powerful mechanisms for
organizing information. They are also very familiar to anyone who has used
a file system.

ZFS allows file systems to be organized into hierarchies, where each
file system has only a single parent. The root of the hierarchy is always
the pool name. ZFS leverages this hierarchy by supporting property inheritance
so that common properties can be set quickly and easily on entire trees of
file systems.

How to Determine Your ZFS File System Hierarchy

Pick the file system granularity.

ZFS file systems
are the central point of administration. They are lightweight and can be created
easily. A good model to use is to establish one file system per user or project,
as this model allows properties, snapshots, and backups to be controlled on
a per-user or per-project basis.

ZFS allows file systems
to be organized into hierarchies so that similar file systems can be grouped.
This model provides a central point of administration for controlling properties
and administering file systems. Similar file systems should be created under
a common name.

Most file system
characteristics are controlled by properties. These properties control a variety
of behaviors, including where the file systems are mounted, how they are shared,
if they use compression, and if any quotas are in effect.

In the example in How to Create ZFS File Systems,
all home directories are mounted at /export/zfs/user, are shared by using NFS, and have compression enabled.
In addition, a quota of 10 GB on user bonwick is enforced.

Next, individual file systems are grouped under the home file
system in the pool tank.

Create the individual file systems.

File systems could
have been created and then the properties could have been changed at the home level. All properties can be changed dynamically while file
systems are in use.

# zfs create tank/home/bonwick
# zfs create tank/home/billm

These file systems inherit their property values from their parent,
so they are automatically mounted at /export/zfs/user and are NFS shared. You do not need to edit the /etc/vfstab or /etc/dfs/dfstab file.