Solaris · ZPOOL – Pool Management in Solaris

Solaris · Lesson 17

ZPOOL – Pool Management in Solaris

Create and manage ZFS pools. Mirror and RAIDZ concepts. Import export pools. Scrub and repair operations.

ZPOOL Overview — the foundation of ZFS

A ZPOOL is the top-level storage object in ZFS. All ZFS filesystems, volumes, snapshots and clones live inside a pool.

A pool is built from one or more vdevs(virtual devices), which determine redundancy:

Single Disk / Stripe

Fast but no redundancy. Pool is lost if the disk fails.

Mirror (RAID-1)

Safest for OS/root pools and critical data. Survives 1 disk failure.

RAID-Z (1/2/3)

Parity-based redundancy. Survives 1, 2, or 3 disk failures respectively.

Step-by-step ZPOOL commands with examples

1. Check existing zpools (zpool list)

Shows size, alloc, free, expandsize, fragmentation, and more.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
rpool 60G 10.3G 49G - 2% 17% 1.00x ONLINE -

2. Check detailed pool status (zpool status)

Shows pool state, errors, vdevs, read/write/checksum failures and device paths.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool status rpool
pool: rpool
state: ONLINE
scan: scrub repaired 0B in 0 days 00:05:20 with 0 errors
config:
 
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c3t0d0 ONLINE 0 0 0

3. Discover disks before creating pools (echo | format)

List available disks in non-interactive mode to avoid format> prompt.

terminal — zpool
solaris-lab
[root@solaris ~]# echo | format
AVAILABLE DISK SELECTIONS:
0. c2t1d0 <100.00GB>
1. c2t2d0 <100.00GB>

4. Create a basic (single-disk) pool

Always use the whole disk (slice s2). Single-disk pools have no redundancy.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool create mypool c2t1d0
# Or using slice:
[root@solaris ~]# zpool create mypool /dev/dsk/c2t1d0s2
 
[root@solaris ~]# zpool list
NAME SIZE ALLOC FREE HEALTH
mypool 100G 0K 100G ONLINE

5. Create a mirror pool

Mirror protects against 1 disk failure (RAID-1 equivalent).

terminal — zpool
solaris-lab
[root@solaris ~]# zpool create mymirror mirror c2t1d0 c2t2d0
 
[root@solaris ~]# zpool status mymirror
pool: mymirror
state: ONLINE
config:
 
NAME STATE READ WRITE CKSUM
mymirror ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c2t1d0 ONLINE 0 0 0
c2t2d0 ONLINE 0 0 0

6. Create RAID-Z1 / RAID-Z2 / RAID-Z3 pools

RAID-Z avoids the write hole and provides better data integrity.

terminal — zpool
solaris-lab
# RAID-Z1 (1 disk redundancy)
[root@solaris ~]# zpool create rz1 raidz c2t1d0 c2t2d0 c2t3d0
 
# RAID-Z2 (2 disk redundancy)
[root@solaris ~]# zpool create rz2 raidz2 c2t1d0 c2t2d0 c2t3d0 c2t4d0
 
# RAID-Z3 (3 disk redundancy)
[root@solaris ~]# zpool create rz3 raidz3 c2t1d0 c2t2d0 c2t3d0 c2t4d0 c2t5d0

7. Add a new disk/vdev to an existing pool (zpool add)

Adding disks expands capacity but may reduce redundancy depending on vdev layout.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool add mypool c2t3d0
 
[root@solaris ~]# zpool status mypool
pool: mypool
state: ONLINE
config:
 
NAME STATE READ WRITE CKSUM
mypool ONLINE 0 0 0
c2t1d0 ONLINE 0 0 0
c2t3d0 ONLINE 0 0 0

8. Convert single disk pool to mirror using attach

Attach a second disk to turn a single-disk pool into a mirror.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool attach mypool c2t1d0 c2t2d0
# pool old-disk new-disk
 
[root@solaris ~]# zpool status mypool
pool: mypool
state: ONLINE
config:
 
NAME STATE
mypool ONLINE
mirror-0 ONLINE
c2t1d0 ONLINE
c2t2d0 ONLINE

9. Detach a disk from a mirror

Detaching removes the disk and returns the pool to degraded or single state.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool detach mypool c2t2d0

10. Export a pool (prepare for moving it to another system)

Exporting cleanly unmounts filesystems and removes ZFS metadata from memory.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool export mypool

11. Import pools available on the system

Shows pools found but not yet imported.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool import
pool: mypool
id: 12345678912345678
state: ONLINE
action: The pool can be imported using its name or ID.
config:
mypool ONLINE
c2t1d0 ONLINE

12. Import a pool by name

Standard import after an export.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool import mypool

13. Recover destroyed pools using -D (rewind/remnant detection)

zpool import -D shows pools that were destroyed OR have corrupted labels.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool import -D
pool: mypool
id: 12345678912345678
state: DESTROYED
action: The pool can be imported using 'zpool import -D mypool'

14. Check pool errors in detail (zpool status -xv)

-x means 'only show pools with issues', -v provides detailed error logs.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool status -xv
all pools are healthy

15. Clear device errors (zpool clear)

Resets error counters after issues have been fixed.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool clear mypool

16. Start a scrub

Scrubbing scans all data for silent corruption (checksums) and repairs from redundant copies.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool scrub mypool
 
[root@solaris ~]# zpool status mypool
scan: scrub in progress, 10.2% done

17. View all ZFS administrative operations

Shows pool creation, add/remove, scrubs, snapshots, dataset creation, etc.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool history
History for 'mypool':
2025-01-10.12:30:11 zpool create mypool c2t1d0
2025-01-10.12:40:15 zpool scrub mypool
2025-01-10.13:00:11 zfs create mypool/data

18. Destroy a pool

WARNING: Destroys all data in the pool. Only use in labs or confirmed migrations.

terminal — zpool
solaris-lab
[root@solaris ~]# zpool destroy mypool

Quick ZPOOL Admin Cheat Sheet

Creation & expansion

  • zpool create <pool> <disk>
  • zpool create <pool> mirror d1 d2
  • zpool create <pool> raidz d1 d2 d3
  • zpool add <pool> <disk>
  • zpool attach <pool> old-disk new-disk
  • zpool detach <pool> disk

Maintenance & recovery

  • zpool scrub <pool>
  • zpool clear <pool>
  • zpool export <pool>
  • zpool import
  • zpool import -D (show destroyed pools)
  • zpool import <pool>
  • zpool status -xv
  • zpool history

Critical Safety Notes

  • zpool destroy will wipe all data instantly — use only in labs.
  • When expanding pools, remember redundancy is determined by vdevs, not entire pool.
  • RAID-Z vdevs cannot be shrunk or reshaped; plan topology carefully.
  • Use zpool scrub regularly to detect silent corruption.

Next chapter: ZFS datasets, filesystems, quotas, mountpoints and snapshots.