WARNING: HERE BE DRAGONS. IF YOU DON'T KNOW EXACTLY WHAT YOU'RE DOING, DO NOT FOLLOW THESE INSTRUCTIONS.
IN FACT, IF YOU NEED THESE INSTRUCTIONS, YOU PROBABLY SHOULDN'T FOLLOW THEM.
There are a few cases where it may make sense to create a degraded pool in your FreeNAS server. One of the most common would be a case where you have all the disks you need for your pool, but one of them already has data on it. The degraded pool would let you create, for example, a three-disk RAIDZ1 pool without the third disk. Once you've transferred the data from the third disk onto the pool, you can then resilver that disk into the pool, giving you redundancy. To do it right takes a few steps to match the way FreeNAS creates pools.
The example below will create a RAIDZ1 pool on da18 and da19 (both 2 TB disks), and a 2 TB sparse file. It can be adapted to any RAIDZ level or number of disks.
Start by creating the sparse file:
Then create the GPT partition table and the necessary partitions on da18:
Repeat for the other disk(s). Then get the gptids:
You'll use the gptids for the second partition on each of the disks (da18p2 and da19p2), in the following command:
The pool will be created:
Then offline the sparsefile, and check the pool status again:
Now export the pool using
IN FACT, IF YOU NEED THESE INSTRUCTIONS, YOU PROBABLY SHOULDN'T FOLLOW THEM.
There are a few cases where it may make sense to create a degraded pool in your FreeNAS server. One of the most common would be a case where you have all the disks you need for your pool, but one of them already has data on it. The degraded pool would let you create, for example, a three-disk RAIDZ1 pool without the third disk. Once you've transferred the data from the third disk onto the pool, you can then resilver that disk into the pool, giving you redundancy. To do it right takes a few steps to match the way FreeNAS creates pools.
The example below will create a RAIDZ1 pool on da18 and da19 (both 2 TB disks), and a 2 TB sparse file. It can be adapted to any RAIDZ level or number of disks.
Start by creating the sparse file:
Code:
root@freenas2:~ # truncate -s 2T /root/sparsefile
Then create the GPT partition table and the necessary partitions on da18:
Code:
root@freenas2:~ # gpart create -s gpt /dev/da18 root@freenas2:~ # gpart add -i 1 -b 128 -t freebsd-swap -s 2g /dev/da18 da18p1 added root@freenas2:~ # gpart add -i 2 -t freebsd-zfs /dev/da18 da18p2 added
Repeat for the other disk(s). Then get the gptids:
Code:
root@freenas2:~ # glabel status Name Status Components (snip) gptid/d326a289-c056-11e8-90eb-002590caf340 N/A da18p1 gptid/d508abf6-c056-11e8-90eb-002590caf340 N/A da19p1 gptid/dee8fa86-c056-11e8-90eb-002590caf340 N/A da18p2 gptid/e1e2ba67-c056-11e8-90eb-002590caf340 N/A da19p2
You'll use the gptids for the second partition on each of the disks (da18p2 and da19p2), in the following command:
Code:
root@freenas2:~ # zpool create -f testpool raidz1 /root/sparsefile gptid/dee8fa86-c056-11e8-90eb-002590caf340 gptid/e1e2ba67-c056-11e8-90eb-002590caf340
The pool will be created:
Code:
root@freenas2:~ # zpool status -v testpool pool: testpool state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM testpool ONLINE 0 0 0 raidz1-0 ONLINE 0 0 0 /root/sparsefile ONLINE 0 0 0 gptid/dee8fa86-c056-11e8-90eb-002590caf340 ONLINE 0 0 0 gptid/e1e2ba67-c056-11e8-90eb-002590caf340 ONLINE 0 0 0 errors: No known data errors
Then offline the sparsefile, and check the pool status again:
Code:
root@freenas2:~ # zpool offline testpool /root/sparsefile root@freenas2:~ # zpool status -v testpool pool: testpool state: DEGRADED status: One or more devices has been taken offline by the administrator. Sufficient replicas exist for the pool to continue functioning in a degraded state. action: Online the device using 'zpool online' or replace the device with 'zpool replace'. scan: none requested config: NAME STATE READ WRITE CKSUM testpool DEGRADED 0 0 0 raidz1-0 DEGRADED 0 0 0 5574075682424664614 OFFLINE 0 0 0 was /root/sparsefile gptid/dee8fa86-c056-11e8-90eb-002590caf340 ONLINE 0 0 0 gptid/e1e2ba67-c056-11e8-90eb-002590caf340 ONLINE 0 0 0 errors: No known data errors
Now export the pool using
zpool export testpool
, and import it through the GUI. Once the missing disk is available, you can replace it into the pool using the GUI.