# RAID-Z syntax issue



## fred974 (Oct 21, 2013)

Hello everyone,

I'm trying to set up a RAID-Z root filesystem with two disks and I'll like some help with the syntax. Should I be using `zpool create -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache zroot raidz /dev/gpt/disk0.nop /dev/gpt/disk1.nop` or
`zpool create -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache zroot raidz1 /dev/gpt/disk0.nop /dev/gpt/disk1.nop`?

It seems that RAID-Z2 is faster, but is it possible with two disks?

Fred


----------



## usdmatt (Oct 21, 2013)

RAID-Z1 is similar to RAID 5 and provides one disk of redundancy (i.e. you can lose one disk and still have your data). I'm not sure it's possible to create a RAID-Z1 pool with two disks but I'm not 100% sure without checking.

I'm not sure if raidz, as in your first example, actually works, but if it does  it with just be an alias for raidz1, meaning that both your commands will probably do the same thing.

Creating a RAID-Z2 pool, which provides two disks of redundancy, when you only have two disks, would be quite an achievement. I'm not sure why you think RAID-Z2 is faster. Due to the 2 pieces of parity it has to calculate, it's usually expected to be slower on the same number of disks.

What you want is a mirror. And to learn a bit more about how RAID, and more specifically ZFS, works before you start getting yourself into trouble.

`zpool create -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache zroot mirror /dev/gpt/disk{0,1}.nop`

*Edit:*
I've now had a chance to test, and yes it is possible to create a RAID-Z1 pool with two disks, and using raidz and raidz1 in the command produce exactly the same result, as expected.

Of course, with only 2 disks, it's highly advisable to use a mirror, not RAID-Z1.


----------



## fred974 (Oct 22, 2013)

Ho @usdmatt

Thank you very much for you time 

So if I use mirror, both disk will have a ZFS filesystem?

Fred


----------



## usdmatt (Oct 22, 2013)

As far as your system is concerned, you will have one ZFS 'pool', and your ZFS filesystems (whether you have 1 or 100) will sit on top of that. You don't have a ZFS filesystem per disk.

All data written to your pool will be copied to both disks, meaning that you can lose either one and your system will continue to function as normal. This is transparent to you though, the 2 disks effectively act as one.


----------

