Dan's Wiki

6.1 Configuring Storage Pools

What are pools and how do you create them?

A ZFS Pool is the basic unit of storage in ZFS, and therefore in TrueNAS. When you install TrueNAS to get your first pool created for you as standard (the boot-pool) and that is the only storage present in the directory tree. All the other NVMe/SSD/HDD disks you have installed cannot yet be accessed or used - to do that you need to group them into one or more storage pools.

Note: In case you hear the term used, pools are sometimes referred to as tanks by old-time ZFS users.

Virtual Devices (vDevs)

Unfortunately it is a bit more complicated than simply grouping disks into a pool. Firstly, a pool consists of one or more “virtual devices” or vDevs - and each vDev consists of one or several disks. There are several different types of vDev - the most obvious and standard one being a Data vDev -  and there are several ways of combining two or more disks into a single vDev (such as mirrors, RAIDZ and DRAID).

The other types of vDev have been previously described in section 2.2.5 ZFS Special Devices - but for most basic home TrueNAS servers, these will not be needed. Hopefully you will already have used the whole of section 2. Planning to pre-plan what your pools will look like, and if you need any of these other specialised types of vDev then that will have been highlighted much earlier than here and now.

To recap, a pool consists of one or more Data vDevs[1] (and possibly other specialised vDevs) and each vDev in turn consists of one or more disks or devices.

Types of vDev

Now, just in case you have jumped here and bypassed Planning, or are just dipping a toe in the water, we will recap the various ways of grouping disks into a vDev: 

Mirrors

A mirror vDev consists of 1 or more disks/devices where each of them holds exactly the same data - you have as many copies as there are disks in the mirror.

When you have two or more disks in the mirror, your data is protected against a disk (or an individual sector of a disk) failing. ZFS will typically recover from an individual sector failing without you even noticing it. If an entire disk fails, TrueNAS will keep working without it, and when you have replaced that failed disk with a new one, TrueNAS can copy all your data to it from the surviving disk(s) to recover you back to the number of copies you want.

Although a single disk is not strictly technically a mirror, from the perspective of the technical rules of ZFS, a single disk is in essence a mirror with only one copy of the data.

RAIDZ

RAIDZ is a different way of combining drives to give you some redundancy in case of drive or sector failures. There are three types of RAIDZ which differ by  the amount of redundancy you are providing: RAIDZ1 (one disk worth of space used for redundancy) RAIDZ2 (2 disks worth of space used for redundancy) and RAIDZ3 (3 disks … well you get the point by now). 

Although RAIDZ doesn't actually work this way technically, for the purposes of space planning you can conceptually think of the redundant disks as being dedicated to holding specially calculated versions of the equivalent blocks on the other disks so that if 1 or 2 or 3 of the disks holding the actual data have failed, you can use these equivalent blocks on the remaining data disks and remaining redundancy disks in order to calculate backwards what data was stored on the failed disk. 

This is how the original RAID5 used to work - dedicated redundancy devices - but if you really want to understand the difference between RAID5 and RAIDZ, then in RAIDZ the set of equivalent data and redundancy blocks are calculated as described, and they are written across all of the disks in the same way, but the data and redundancy blocks can be written to all the drives without worrying which drive gets the data blocks and which drive gets the redundancy blocks.

Maximum drives in a RAIDZ vDev: Whilst in theory you can have as many devices/disks as you like in a RAIDZ vDev (within reason anyway - there is undoubtedly a theoretical limit), in practice the number of drives should be limited to 12 (or possibly 16 if you believe  the OpenZFS documentation).

Minimum drives in a RAIDZ vDev: You can have a minimum of 1 data drive and 1, 2 or 3 redundancy drives, so the minimum is 2, 3 or 4 devices.

Mirror vs. RAIDZ

At this point you may well be wondering what the difference is between a 2x drive mirror and a 2x drive RAIDZ1 (or a 3x drive mirror and a 3x drive RAIDZ2 etc.)??

The fundamental similarities and differences between mirrors and RAIDZ are:

So the basic difference is that a 2x drive mirror can have redundancy adjusted, and a 2x drive RAIDZ1 can have the useable data increased.

DRAID

DRAID is a derivative of RAIDZ consisting of one or more RAIDZ sub-vDevs plus a hot spare combined together and prepopulating the hot-spare with partial redundancy data so that in the event of the hot-spare being brought into use it the “resilvering” can be achieved in a much shorter timescale.

This is only really useful when you have several tens or hundreds of disks in your pool, so for the intended primary audience of this wiki it is highly unlikely to be relevant. In theory because the resilver is quicker it should allow for a wider RAIDZ sub-vDev than a normal equivalent RAIDZ or allow for e.g. use of RAIDZ2 instead of RAIDZ3.

Stripes

Stripes are what happens when you use multiple vDevs for data (or any other vDev type). In essence ZFS distributes your data evenly across the various vDevs in a stripe.

To ensure consistent performance,  it is usual to have each of the multiple vDevs in a stripe to be defined the same i.e. the same type and width as the others e.g. a 2x mirror or a 6x RAIDZ2. (This is not required technically, but you will have very inconsistent performance if you did otherwise.)

Why define multiple pools?

When you have different types of data with fundamentally different performance needs you need to put them on separate pools. Generally speaking there is no way within a single pool to put different performant data on different vDevs.

So, in addition to the boot-pool, you might have an NVMe pool, a SATA SSD pool and an HDD pool.

However, within these performance classes, it is normal only to have one Pool consisting of all of the disks of that type - and this is because the available space is in one single lump which reduces or eliminates the need for a storage administrator to keep moving files from one pool to another because one pool has run out of space whilst another of the same type as lots of available space.

A typical TrueNAS server will have a main data pool (traditionally on HDDs - but increasingly commonly on NVMe). If your main data pool is on HDDs, you may well have an NVMe and/or a SATA SSD pool to hold applications and their data or VMs.  

Before you Create a Pool

The only real decisions you need to make before creating a pool are:

With these decisions made you are ready to create your pool…

Creating a Pool in TrueNAS SCALE

Select the Storage icon from the list running down the left side of the UI screen, and then click the Create Pool button.

scalepool1.png

Enter a pool name, then click Next. 

scalepool2.png

Under the Data heading, select your desired layout ("Mirror" in this example). The system will suggest a layout that seems appropriate under the heading of Automated Disk Selection. If you feel the need to adjust this manually, you can click the Manual Disk Selection button. Once finished, click Save And Go To Review--the other pool options won't be used in this example.

scalepool3.png

In the Review section, you'll be able to see the summary of how your pool will be created. Click Create Pool to create the pool.

scalepool4.png

In the popup warning window, check the box to confirm that the contents of any disks you're adding to your pool will be lost, then click Continue. Your pool will be created.

The root dataset of your new pool will be mounted at /mnt/poolname.

Creating a Pool in TrueNAS CORE

To create a pool in TrueNAS CORE, log into the web GUI and go to Storage -> Pools (1), then click on the ADD button (2).

corepool1.png

Select Pools in the left menu

On the next screen, leave the radio button set to its default of Create new pool (1), then click on CREATE POOL (2).

corepool2.png

On the next screen, enter a pool name (1) and select the drives you want to add (2) (the warning about non-unique serial numbers shouldn't appear for you). Then click the arrow (3) to add them to a vdev.

corepool3.png

Once the drives are added to the vdev (1), set the vdev layout appropriately (2, mirror in this case), then click CREATE.

corepool4.png

In the popup warning window, check the box to confirm that the contents of any disks you're adding to your pool will be lost, then click CREATE POOL. Your pool will be created.

References


[1] Pools can also include special vdevs, such as spares, metadata, cache, and SLOG. These advanced topics will not be covered by this guide ↩︎