Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am building an OpenSolaris box to attempt to use ZFS and RAIDZ. I am starting simple with the OS on one drive and wanting to store all my data on the RAIDZ volume. I am a bit confused on RAIDZ is handling parrity. I created a pool using the command "zpool create pool_1 raidz drive1 drive2 drive3" and when i did a zpool list it shows the available size of the three drives together. I figure if the parity was automatically calculated it should be short the size of 1 drive. So I deleted that pool and created one using "zpool create pool_1 raidz drive1 drive2 spare drive3" and the available size was what I expeceted to see. To me a hotspare isn't parity though it is a disk that is ready to fill in for parity in the event that your raid loses a drive. I don't want to get down the road and have one of those two drives fail and find out no parity.

Any explanation on this would be much appreciated.

share|improve this question

migrated from stackoverflow.com Mar 10 '11 at 14:56

This question came from our site for professional and enthusiast programmers.

    
so i think i figured it out. When I moved on to creating my volume and did zfs list the mount for pool_1 only showed the size of one disk so I guess I was originally right that the parity was right there. The size of the pool just confused me. I recreated the pool using all three disks and no spares and the pool size is 5.44T but in zfs list you only see 3.56T. Any one want to confirm that this is right I would appreciate it :) –  Red Mar 9 '11 at 21:14
    
This is a common confusion with ZFS. The zpool command shows the aggregate capacity of the included drives. The zfs command shows their effective capacity. Gets people all the time. –  mfe Apr 12 '11 at 22:21
add comment

2 Answers

The "pool" size of a RAID-Z is the entire physical space available to the pool - not the space for a filesystem.

For that you should examine the "zfs list" command.

# zpool list
NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
storage  5.32T  2.23T  3.09T    41%  1.00x  ONLINE  -

# zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
storage                   1.49T  2.00T  38.6K  /storage

RAID-Z (or RAID-Z1) is, as you rightly surmise, (N-1)*size space, and RAID-Z2 is (N-2)*size space, where N is the number of drives and size is the capacity of one drive.

Unlike RAID-5, RAID-Z doesn't use one specific drive for the parity, but it rotates the parity around different disks. This makes the system more efficient and prevents the parity disk from wearing out as fast:

In this example dw is a data write operation and pw is a parity write operation. D3 is the parity disk in the raid 5 arrangement

Raid 5:

D1   D2   D3
dw        pw
     dw   pw
     dw   pw
dw        pw 
dw        pw
dw        pw
     dw   pw

You can see how every write operation to either disk 1 or disk 2 results in a write to disk 3.

Raid-Z:

D1   D2   D3
dw   pw
dw        pw
pw   dw
     pw   dw
dw        pw
pw   dw
     pw   dw  

You can see a much more even disk write pattern.

The zpool's spare vdev is a reserved disk which can be swapped for any of the other disks on the fly - a hot spare. This disk is not used until you tell it to.

share|improve this answer
    
RAID-Z will write to ALL devices in the pool on every write, not some of them as shown above. The size of the stripe is determined dynamically based on the amount of data being written, but the stripe, including parity bit(s), is written across all devices. –  Yedric Sep 12 '12 at 14:38
add comment

RAID 4 uses a dedicated parity drive. RAID 5 stripes the parity.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.