Skip to content

ZFS Pools

ZFS pools are the foundational structure for organizing and managing storage in a ZFS environment. Creating a pool involves defining datasets, configuring redundancy, and optimizing performance through vdev (virtual device) arrangements. This section covers the essential steps to create and configure ZFS pools, including device selection, RAID configurations, and property tuning for reliability and efficiency.


Understanding ZFS Pools and Vdevs

A ZFS pool aggregates physical storage devices (disks, SSDs, etc.) into a logical storage pool. These devices are grouped into vdevs (virtual devices), which can be:
- Disks: Single physical devices.
- Mirrors: Pairs or groups of disks for redundancy.
- RAIDz: Striping with parity (RAID ⅚-like) for fault tolerance.

Key considerations:
- Redundancy (mirrors, RAIDz) protects against device failure.
- Performance depends on vdev configuration (e.g., mirrored pools offer faster read/write speeds).
- Avoid over-provisioning; balance redundancy and capacity.

Example: A mirrored pool with two disks ensures data redundancy while maintaining performance.


Creating a ZFS Pool

Use the zpool create command to define a pool. Start by identifying available devices (e.g., /dev/sdX, /dev/sdY).

Basic Pool Creation

# Single disk pool (no redundancy)  
zpool create mypool /dev/sdX  

# Mirrored pool (redundant)  
zpool create mypool mirror /dev/sdX /dev/sdY  

# RAIDz pool (parity-based redundancy)  
zpool create mypool raidz /dev/sdX /dev/sdY /dev/sdZ  

Notes:
- Use zpool status to verify the pool’s state after creation.
- If the pool was previously created and exported, import it with zpool import.


Configuring Pool Properties

After creation, fine-tune pool behavior using properties like ashift, compression, and logbias.

Common Property Configurations

# Set ashift (alignment) for optimal performance (12 for 4KB sectors)  
zpool set ashift=12 mypool  

# Enable compression (e.g., lz4 for speed)  
zpool set compression=lz4 mypool  

# Optimize for read-heavy workloads (e.g., logbias=throughput)  
zpool set logbias=throughput mypool  

# Set a quota for the pool (e.g., 50% of available space)  
zfs set quota=50G mypool  

Advanced tuning: Use zfs set to configure properties like dedup (data deduplication) or reservation (space guarantees).


Best Practices for Pool Creation

  1. Device Selection: Use SSDs for log devices (e.g., zpool create mypool /dev/sdX log /dev/sdY) to improve write performance.
  2. Redundancy: Prioritize mirrors over RAIDz for simplicity and faster recovery.
  3. Avoid Over-RAIDz: RAIDz pools are more complex and slower to rebuild than mirrored pools.
  4. Monitor Health: Regularly run zpool scrub to check for data integrity issues.
  5. Documentation: Label devices clearly and document pool configurations for troubleshooting.

Key takeaways

  • Vdevs (disks, mirrors, RAIDz) define redundancy and performance.
  • Use zpool create with appropriate vdevs for fault tolerance and speed.
  • Configure properties like ashift, compression, and logbias for optimal performance.
  • Prioritize simplicity (mirrors) over complex RAIDz setups unless parity is critical.
  • Regularly monitor and maintain pools with zpool scrub and zpool status.