zfspools
ZFS Pools
Creating the ZFS Storage Pool
# zpool create tank c1t0d0 // -- Mirrored Storage Pool (mirror) -- # zpool create tank mirror c1t0d0 c1t1d0 // -- Single-Parity RAID-Z Storage Pool (raidz) -- # zpool create tank raidz c1t0d0 c2t0d0 c3t0d0 c4t0d0 /dev/dsk/c5t0d0 // -- Double-Parity RAID-Z Storage Pool (raidz2) -- # zpool create -f tank raidz2 c1t0d0 c2t0d0 c3t0d0
Change the default mount point
# zpool create -m /export/zfs home c1t0d0
Pools List
# zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT tank 80G 137K 80G 0% ONLINE -
Status
# zpool status
// Listing Specific Storage Pool Statistics
# zpool list -o name,size
# zpool status -v tank
pool: tank
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror ONLINE 0 0 0
c2t0d0 ONLINE 0 0 0
c2t1d0 ONLINE 0 0 0
errors: No known data errors
Listing Pool-Wide Statistics
# zpool iostat
capacity operations bandwidth
pool used avail read write read write
---------- ----- ----- ----- ----- ----- -----
tank 100G 20.0G 1.2M 102K 1.2M 3.45K
Adding Devices to a Storage Pool
// dry run # zpool add -n zeepool mirror c3t1d0 c3t2d0 // real add # zpool add zeepool mirror c2t1d0 c2t2d0
Attaching and Detaching Devices in a Storage Pool
If the existing device is part of a two-way mirror, attaching the new device, creates a three-way mirror, and so on. In either case, the new device begins to resilver immediately.
# zpool attach zeepool c1t1d0 c2t1d0 # zpool detach zeepool c2t1d0
In this example, zeepool is an existing two-way mirror that is transformed to a three-way mirror by attaching c2t1d0, the new device, to the existing device, c1t1d0.
Onlining and Offlining Devices in a Storage Pool
NOTE: Devices do not need to be taken offline in order to replace them.
You can use the offline command when you need to temporarily disconnect storage.
# zpool offline tank c1t0d0 bringing device c1t0d0 offline # zpool online tank c1t0d0 bringing device c1t0d0 online
When a device is brought online, any data that has been written to the pool is resynchronized to the newly available device. Note that you cannot use device onlining to replace a disk. If you offline a device, replace the drive, and try to bring it online, it remains in the faulted state.
Replacing Devices in a Storage Pool
# zpool replace tank c1t1d0 c1t2d0
Designating Hot Spares
The hot spares feature enables you to identify disks that could be used to replace a failed or faulted device in one or more storage pools. Designating a device as a hot spare means that the device is not an active device in a pool, but if an active device in the pool fails, the hot spare automatically replaces the failed device.
// during creation # zpool create zeepool mirror c1t1d0 c2t1d0 spare c1t2d0 c2t2d0 // or add them to the pool # zpool add -f zeepool spare c1t3d0 c2t3d0
Destroying ZFS Storage Pools
# zpool destroy tank
Destroying a Pool With Faulted Devices
# zpool destroy tank cannot destroy ’tank’: pool is faulted use ’-f’ to force destruction anyway # zpool destroy -f tank