ZFS Notes

SneWs's picture

Here I have my own notes and commands list for ZFS usage.

Creation of pools and FS

# Create a new pool with a list of drives
$ zpool create [pool name] /dev/sdb /dev/sdc /dev/sdd ...
# Create a new mirrored pool
$ sudo zpool create [pool name] mirror /dev/sdb /dev/sdc ...
# Get the status for a pool
$ zpool status [pool name]
# Create a new ZFS FS
$ zfs create [pool name]/[path] # Example zfs create mypool/data/movies
# Mount a pool on a specific path
$ zfs set mountpoint=/[path] [pool name] # Ex. zfs set mountpoint=/data/movies mypool

Properties and features

# Enable compression on a pool and/or pool path
$ zfs set compression=on [poolname] # Ex. zfs set compression=on mypool
$ zfs set compression=on [poolname]/[path] # Ex. zfs set compression=on mypool/movies
# Get compression ratio for all pools
$ zfs get compressratio
# Show basic usage and stats for all pools
$ zpool list


# Scrub a specific pool
$ zpool scrub [pool name]

Importing pools

$ zpool import [poolname]

If the pool(s) have been setup in/from another system you will need to use the -f option to force the import.

$ zpool import -f [poolname]

Data recovery


Read more

More info can be found here:

© 2008 - 2012 Marcus Grenängen. Drupal theme by Kiwi Themes.