My FreeNAS box has 6x2TB drives in it, all configured as a RAIDZ volume.
When a disk dies, I know how to replace it from the web interface, but I'm having a bit of trouble finding the proper way to do it through CLI.
It seems that a lot of people are doing this from the CLI to replace a dead drive:
The problem with that is:
1. After it completes resilvering, the output of 'zpool status' shows gptid labels for the old drives, and a GEOM label for the new drive:
2. Much worse, the new drive does not appear to have a GPT partition table, or any GPT partitions, unlike the other drives:
I know that it's possible to manually use gpart to create the proper partitions on the new drive like so:
and then do this:
But that involves manually creating partitions on the new drive. While it seems fairly simple, the lines above don't take into account partition alignment at all, and also might be causing other problems I don't know about. Is there any way to tell FreeNAS from the CLI to partition a new disk like it normally would (give it a GPT partition table, align the partitions, create a swap partition based on the "Swap Size" setting in FreeNAS's web interface, etc)? Or is doing it manually, like I did above, the only way?
Also, if the way I've seen many people doing it:
isn't creating a GPT partition table, what is it doing? Is it bad to do it that way?
When a disk dies, I know how to replace it from the web interface, but I'm having a bit of trouble finding the proper way to do it through CLI.
It seems that a lot of people are doing this from the CLI to replace a dead drive:
Code:
zpool replace test_vol /dev/gptid/5eb4c0a6-d556-11e3-9741-000c292f28a4 /dev/da2
The problem with that is:
1. After it completes resilvering, the output of 'zpool status' shows gptid labels for the old drives, and a GEOM label for the new drive:
Code:
freenas# zpool status pool: test_vol state: ONLINE scan: resilvered 941G in 10h4m with 0 errors on Sun May 4 02:04:08 2014 config: NAME STATE READ WRITE CKSUM blackhole ONLINE 0 0 0 raidz1-0 ONLINE 0 0 0 gptid/8a4fffb2-33bc-11e3-957d-000000000000 ONLINE 0 0 0 gptid/8b7af956-33bc-11e3-957d-000000000000 ONLINE 0 0 0 gptid/8c46b5b8-33bc-11e3-957d-000000000000 ONLINE 0 0 0 da2 ONLINE 0 0 0 gptid/8e26eecc-33bc-11e3-957d-000000000000 ONLINE 0 0 0 gptid/8edfc5cb-33bc-11e3-957d-000000000000 ONLINE 0 0 0
2. Much worse, the new drive does not appear to have a GPT partition table, or any GPT partitions, unlike the other drives:
Code:
freenas# gpart show da2 gpart: No such geom: da2. freenas# gpart show da1 da3 da4 => 34 3907029101 da1 GPT (1.8T) 34 94 - free - (47k) 128 4194304 1 freebsd-swap (2.0G) 4194432 3902834696 2 freebsd-zfs (1.8T) 3907029128 7 - free - (3.5k) => 34 3907029101 da3 GPT (1.8T) 34 94 - free - (47k) 128 4194304 1 freebsd-swap (2.0G) 4194432 3902834696 2 freebsd-zfs (1.8T) 3907029128 7 - free - (3.5k) => 34 3907029101 da4 GPT (1.8T) 34 94 - free - (47k) 128 4194304 1 freebsd-swap (2.0G) 4194432 3902834696 2 freebsd-zfs (1.8T) 3907029128 7 - free - (3.5k)
I know that it's possible to manually use gpart to create the proper partitions on the new drive like so:
Code:
gpart create -s gpt /dev/da2 gpart add -t freebsd-swap -s 2G da2 gpart add -t freebsd-zfs da2
and then do this:
Code:
zpool replace test_vol /dev/gptid/5eb4c0a6-d556-11e3-9741-000c292f28a4 /dev/gptid/5eb4c0a6-d556-11e3-9741-000c292f28b5
But that involves manually creating partitions on the new drive. While it seems fairly simple, the lines above don't take into account partition alignment at all, and also might be causing other problems I don't know about. Is there any way to tell FreeNAS from the CLI to partition a new disk like it normally would (give it a GPT partition table, align the partitions, create a swap partition based on the "Swap Size" setting in FreeNAS's web interface, etc)? Or is doing it manually, like I did above, the only way?
Also, if the way I've seen many people doing it:
Code:
zpool replace test_vol /dev/gptid/5eb4c0a6-d556-11e3-9741-000c292f28a4 /dev/da2
isn't creating a GPT partition table, what is it doing? Is it bad to do it that way?