ZFS in Linux (Ubuntu server)

(original post: https://github.com/zfsonlinux/zfs/wiki/faq)

First install ZFS with command: sudo apt install zfsutils-linux

I prefer creating pools with the “by-id” options. It’s easy to see which disk is bad by its unique id. Read the info bellow before continuing. It’s highly recommended to use ECC memory with ZFS.


Booting from ZFS on Linux is possible and many people do it. There are excellent walk throughs available for Debian, Ubuntu and Gentoo.

Selecting /dev/ names when creating a pool

There are different /dev/ names that can be used when creating a ZFS pool. Each option has advantages and drawbacks, the right choice for your ZFS pool really depends on your requirements. For development and testing using /dev/sdX naming is quick and easy. A typical home server might prefer /dev/disk/by-id/ naming for simplicity and readability. While very large configurations with multiple controllers, enclosures, and switches will likely prefer /dev/disk/by-vdev naming for maximum control. But in the end, how you choose to identify your disks is up to you.

  • /dev/sdX, /dev/hdX: Best for development/test pools
    • Summary: The top level /dev/ names are the default for consistency with other ZFS implementations. They are available under all Linux distributions and are commonly used. However, because they are not persistent they should only be used with ZFS for development/test pools.
    • Benefits:This method is easy for a quick test, the names are short, and they will be available on all Linux distributions.
    • Drawbacks:The names are not persistent and will change depending on what order they disks are detected in. Adding or removing hardware for your system can easily cause the names to change. You would then need to remove the zpool.cache file and re-import the pool using the new names.
    • Example: zpool create tank sda sdb
  • /dev/disk/by-id/: Best for small pools (less than 10 disks)
    • Summary: This directory contains disk identifiers with more human readable names. The disk identifier usually consists of the interface type, vendor name, model number, device serial number, and partition number. This approach is more user friendly because it simplifies identifying a specific disk.
    • Benefits: Nice for small systems with a single disk controller. Because the names are persistent and guaranteed not to change, it doesn’t matter how the disks are attached to the system. You can take them all out, randomly mixed them up on the desk, put them back anywhere in the system and your pool will still be automatically imported correctly.
    • Drawbacks: Configuring redundancy groups based on physical location becomes difficult and error prone.
    • Example: zpool create tank scsi-SATA_Hitachi_HTS7220071201DP1D10DGG6HMRP
  • /dev/disk/by-path/: Good for large pools (greater than 10 disks)
    • Summary: This approach is to use device names which include the physical cable layout in the system, which means that a particular disk is tied to a specific location. The name describes the PCI bus number, as well as enclosure names and port numbers. This allows the most control when configuring a large pool.
    • Benefits: Encoding the storage topology in the name is not only helpful for locating a disk in large installations. But it also allows you to explicitly layout your redundancy groups over multiple adapters or enclosures.
    • Drawbacks: These names are long, cumbersome, and difficult for a human to manage.
    • Example: zpool create tank pci-0000:00:1f.2-scsi-0:0:0:0 pci-0000:00:1f.2-scsi-1:0:0:0
  • /dev/disk/by-vdev/: Best for large pools (greater than 10 disks)
    • Summary: This approach provides administrative control over device naming using the configuration file /etc/zfs/vdev_id.conf. Names for disks in JBODs can be generated automatically to reflect their physical location by enclosure IDs and slot numbers. The names can also be manually assigned based on existing udev device links, including those in /dev/disk/by-path or /dev/disk/by-id. This allows you to pick your own unique meaningful names for the disks. These names will be displayed by all the zfs utilities so it can be used to clarify the administration of a large complex pool. See the vdev_id and vdev_id.conf man pages for further details.
    • Benefits: The main benefit of this approach is that it allows you to choose meaningful human-readable names. Beyond that, the benefits depend on the naming method employed. If the names are derived from the physical path the benefits of /dev/disk/by-path are realized. On the other hand, aliasing the names based on drive identifiers or WWNs has the same benefits as using /dev/disk/by-id.
    • Drawbacks: This method relies on having a /etc/zfs/vdev_id.conf file properly configured for your system. To configure this file please refer to section 1.10 How do I setup the /etc/zfs/vdev_id.conf file? As with benefits, the drawbacks of /dev/disk/by-id or /dev/disk/by-path may apply depending on the naming method employed.
    • Example: zpool create tank mirror A1 B1 mirror A2 B2
This entry was posted in Guides. Bookmark the permalink.