FreeBSD ZFS Cheat Sheet

My tips about ata/ahci/zpool/zfs

ATA & AHCI

  1. Use AHCI and NCQ
  2. In your kernel configuration file add this then rebuild kernel:

    device ahci

    In /boot/loader.conf, add:

    ahci_loader="YES"
  3. Use camcontrol (8) instead of atacontrol (8)
  4. atacontrol cap device

    now:

    camcontrol identify device

zpool

  1. Create a RAID-Z Storage Pool
  2. zpool create tankz raidz ada1 ada2 ada3
  3. Destroy a ZFS Storage Pool
  4. zpool destroy tankz
  5. Create a Mirrored Storage Pool
  6. zpool create tank mirror ada4 ada5
  7. List Storage Pools
  8. zpool list
  9. Export/Import a ZFS Storage Pool
  10. zpool export tank
    zpool import tank
    
  11. Add Cache Devices to a ZFS Storage Pool
  12. zpool add tank cache ada6 ada7
  13. Replace Device with Another Device in the Same Location
  14. zpool offline tank ada3
    zpool replace tank ada3
    
  15. Replace Device with Another Device in the Different Location
  16. zpool replace tank ada4 ada8

zfs

  1. Create a ZFS Mount Point
  2. zfs create tank/foo
    zfs set mountpoint=/home/share/foo tank/foo
    
  3. Create a ZFS Snapshot
  4. zfs snapshot tank/foo@day1
  5. Enable/Disable ZFS Compression
  6. zfs set compression=off tank/foo
    zfs set compression=on tank/foo
    
  7. Restore Tuneables to Default
  8. zfs inherit <property>=<value> <dataset>

References

  1. Freebsd Handbook: ZFS
  2. zfs (8)
  3. zpool (8)
  4. ata (4)
  5. ahci (4)

Leave a Reply

Your email address will not be published.