Solaris 10 ZFS Basic Example
Solaris 10 ZFS Basic Example
Solaris 10 ZFS Basic Example
How can I set up and configure a ZFS storage pool under Solaris 10?
ANSWER
This is a brief example of setting up a ZFS storage
pool and a couple of filesystems ("datasets") on Solaris 10.
You'll need the Solaris Update 2 release (dated June 2006) or later, as ZFS was
not in the earlier standard releases of Solaris 10.
http://www.opensolaris.org/os/community/zfs/docs
Once you have the Solaris system up and running, this is how to proceed:-
1. You'll need a spare disk partition or two for the storage pool. You can
use files (see mkfile) if you're stuck for spare hard partitions, but only for experimentation. The partitions
will be OVERWRITTEN by this procedure.
2. Login as root and create a storage pool using the spare partitions:-
# zpool create lake c0t2d0s0 c0t2d0s1
(The # indicates the type-in prompt)
If the above partitions contain exiting file systems, you may need to use
the -f (force) option:-
# zpool create -f lake c0t2d0s0 c0t2d0s1
4. Now create a file system within the pool (Sun call these datasets):-
6. To add further devices to a pool (not mirrors or RAIDZ - these must be extended only with similar
datasets):-
# zpool add lake c0t2d0s3 c0t2d0s4
# zpool status
pool: lake
state: ONLINE
scrub: none requested
config:
You can also offline/online components, take snapshots (recursive since update 3), clone
filesystems, and apply properties such as quotas, NFS sharing, etc.
Entire pools can be exported, then imported on another system, Intel or SPARC.
There are even built-in backup and restore facilities, not to mention
performance tools:-
# zpool iostat -v
capacity operations bandwidth
pool used avail read write read write
------------ ----- ----- ----- ----- ----- -----
lake 305M 9.39G 0 0 43.7K 74.7K
mirror 153M 4.69G 0 0 38.6K 37.5K
c0t2d0s0 - - 0 0 39.1K 38.5K
c0t2d0s1 - - 0 1 81 114K
mirror 152M 4.69G 0 0 5.11K 37.5K
c0t2d0s3 - - 0 0 5.13K 38.2K
c0t2d0s4 - - 0 0 27 38.2K
------------ ----- ----- ----- ----- ----- -----