This exercise will walk you through the process of creating virtual disks. The advantage of this method, is that you can create a huge number of disks and more realistic ZFS pools.
A. Creating Virtual Disks
A1. Locate a filesystem with at least 2G of free space.
(for example /export or /zones or create a new filesystem)
A2. Create ten large files to use as virtual disks. Some will be used in the pool and some will be spare:

B. Creating A Simple 2-Way Mirror
B1. Create the following ZFS pool which will have two disks in it. These will be the two sub-mirrors. When created, check the pool configuration and size with zpool commands:

B2. Check where the pool has been mounted.

The pool will be mounted to a directory at the top of the filesystem, in this example /mypool.
C. Mount Points and Filesystems
C1. Multiple filesystems can be created in the pool and the mount-points for these filesystems do not have to be the same as the pool mount point.
In ZFS, creating a hierarchy of filesystems is encouraged. Properties assigned to one file system (like compression) are inherited by sub-filesystems. In this example, a filesystem is created for all user's homes and then sub filesystems for two users. Follow this example:

Notice that each user appears to have access to all the space in the pool (163M).
C2. Copy a large file into Dave's home and see what effect it has in the free space in the pool:

Notice that the free space has gone down for all filesystems. Carious options can be enabled for particular zfs filesystems to reduce the amount of disk space used or prevent one user depriving other users of disk space.
D. Filesystem Options
D1. Use zfs set commands to enable compression for Phil and check the results:

Notice that Phil's home directory is only using 3.2M of disk space when it has the same file in it as Dave (who is using 13M of disk space).
D2. You may think that enabling compression will make the filesystem slower. Run some tests copying files to compressed and non-compressed ZFS file systems:

The real time is the time elapsed from when the command was started to when it ended. The sys time is the amount of CPU time assigned to the process. How can you explain the time differences shown above and when wouldn't it be more efficient to enable compression?
____________________________________________________________________
____________________________________________________________________
D3. Before looking at the next option, clear out all the large files created during compression performance testing from the user's file systems:
![Text Box: # rm /export/home/dave/file[0-9]
# rm /export/home/phil/file[0-9]
# rm /export/home/sam/file[0-9]
# df -F zfs
Filesystem size used avail capacity Mounted on
mypool 163M 24K 147M 1% /mypool
mypool/home 163M 28K 147M 1% /export/home
mypool/home/dave 163M 13M 147M 8% /export/home/dave
mypool/home/phil 163M 3.2M 147M 3% /export/home/phil
mypool/home/sam 163M 24K 147M 1% /export/home/sam](image3127.png)
Dave and Phil have one copy of the large file in their homes. Phil's home is showing less used disk space because he still has compression turned on.
D4. Enabling disk quotas will prevent one user from starving other users of disk space. Follow this example to restrict the amount of disk space available to Sam:

Notice that the size and available column shows only 50M whereas other filesystems have the full pool size of 163M. Copy in the large file to see the usage change:
