![]() |
|||
![]() |
![]() ![]() |
![]() |
![]() ![]() |
![]() |
![]() ![]() |
![]() |
| ||||
Chapter 2Getting StartedThis chapter provides step-by-step instructions for setting up simple ZFS configurations. By the end of this chapter, you should have a basic idea of how the ZFS commands work, and should be able to create simple pools and filesystems. It is not designed to be a comprehensive overview, and refers to later chapters for more detailed information. The following sections are provided in this chapter. 2.1 Hardware and Software RequirementsMake sure the following hardware and software requirements are met before attempting to use the ZFS software.
If you create a mirrored disk configuration, multiple controllers are recommended. 2.2 Creating a Basic FilesystemZFS administration has been designed with simplicity in mind. Among the goals of the commands is to reduce the number of commands needed to create a usable filesystem. Assuming that the whole disk /dev/dsk/c0t0d0 is available for use, the following sequence of commands will create a filesystem for you to use:
This creates a new storage pool with the name tank, and a single filesystem in that pool with the name fs. This new filesystem can use as much of the disk space on c0t0d0 as needed, and is automatically mounted at /tank/fs:
2.3 Creating a Storage PoolWhile the previous example serves to illustrate the simplicity of ZFS, it is not a terribly useful example. In the remainder of this chapter, we will demonstrate a more complete example similar to what we would encounter in a real world environment. The first step is to create a storage pool. The pool describes the physical characteristics of the storage and must be created before any filesystems.
|
# zpool create tank mirror c0t0d0 c0t0d1 |
If one or more of the devices contains another filesystem or is otherwise in use, the command will refuse to create the pool.
For more information on creating storage pools, see 4.4.1 Creating a Pool.
For more information on how devices usage is determined, see 4.4.2.1 Detecting In-Use Devices.
Viewing the result.
You can see that your pool was successfully created by using the zpool list command:
# zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT tank 80G 137K 80G 0% ONLINE - |
For more information on getting pool status, see 4.6 Querying Pool Status.
Now that you have created a storage pool to hold your data, you can create your filesystem hierarchy. Name hierarchies are a simple yet powerful mechanism for organizing information. They are also very familiar to anyone who has used a filesystem.
ZFS allows filesystems to be organized into arbitrary hierarchies, where each filesystem has only a single parent. The root of the name 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 filesystems.
Pick filesystem granularity.
ZFS filesystems are the central point of administration. They are lightweight, and can be created easily. A good model to use is a filesystem per user or project, as this allows properties, snapshots, and backups to be controlled on a per-user or per-project basis. For this example, we will be creating a filesystem for each of two users: bonwick and billm
For more information on managing filesystems, see Chapter 5, Managing Filesystems.
Group similar filesystems together.
ZFS allows filesystems to be organized into hierarchies so that similar filesystems can be grouped together. This provides a central point of administration for controlling properties and administering filesystems. Similar filesystems should be created under a common name. For this example, we will place our two filesystems under a filesystem named home.
Choosing filesystem properties.
Most filesystem characteristics are controlled using simple properties. These properties control a variety of behavior, including where the filesystems are mounted, how they are shared, whether they use compression, and if there are any quotas in effect. For this example, we want all home directories to be mounted at /export/home/user, shared via NFS, and with compression. In addition, we will enforce a quota of 10 Gbytes on bonwick.
For more information on properties, see 5.2 ZFS Properties.
![]() ![]() |