News for hackers. Stuff that matters.
Re:What Is Unraid? by vermaden on Monday April 04, 2022 @04:28AM (#30904418)
With ZFS you can just partition larger and smaller disks to fir your needs.

Lets assume you have 3 disks:

- 10 TB - 5 TB - 8 TB

Here is how you would partition them:

    disk A - 10 TB <_ZFS RAIDZ - disk 1/3 - 5 TB SIZE_> | <_ZFS MIRROR - disk 1/2 - 3 TB SIZE_> | <_ZFS STRIPE - disk 1/1 - 2 TB SIZE_>
    
    disk B -  5 TB <_ZFS RAIDZ - disk 2/3 - 5 TB SIZE_>
    
    disk C -  8 TB <_ZFS RAIDZ - disk 3/3 - 5 TB SIZE_> | <_ZFS MIRROR - disk 2/2 - 3 TB SIZE_>
    
This way you can create three separate pools:

    5 TB each disk ZFS RAIDZ = 10 TB effective space with redundantion
    3 TB each disk ZFS MIRROR = 3 TB effective space with redundantion
    2 TB single disk ZFS STRIPE = 2 TB effective space without redundantion
    
You can of course 'connect' the two redundant ZFS pools into one with these commands below on creation.

This is a test that I just did on FreeBSD but with GB units instead of TB as with real disks:

    # truncate -s 10G disk10
    # truncate -s  5G disk5  
    # truncate -s  8G disk8
    
    # mdconfig.sh -c disk10
    IN: created vnode at /dev/md0
    # mdconfig.sh -c disk5 
    IN: created vnode at /dev/md1
    # mdconfig.sh -c disk8
    IN: created vnode at /dev/md2
    
    # gpart create -s GPT md0
    md0 created
    # gpart add -t freebsd-zfs -s 5g md0     
    md0p1 added
    # gpart add -t freebsd-zfs -s 3g md0
    md0p2 added
    # gpart add -t freebsd-zfs md0      
    md0p3 added
    
    # gpart create -s GPT md1           
    md1 created
    # gpart add -t freebsd-zfs md1
    md1p1 added
    
    # gpart create -s GPT md2     
    md2 created
    # gpart add -t freebsd-zfs -s 5g md2
    md2p1 added
    # gpart add -t freebsd-zfs  md2     
    md2p2 added
    
    # zpool create HYBRID raidz /dev/md0p1 /dev/md1p1 /dev/md2p1 mirror /dev/md0p2 /dev/md2p2
    # zpool create NONRED       /dev/md0p3

    # zpool list HYBRID
    NAME     SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
    HYBRID  17.2G   161K  17.2G        -         -     0%     0%  1.00x    ONLINE  -

    # zfs list HYBRID
    NAME     USED  AVAIL     REFER  MOUNTPOINT
    HYBRID   126K  12.0G     27.3K  /HYBRID
    
    # zpool status HYBRID
      pool: HYBRID
     state: ONLINE
    config:
    
            NAME        STATE     READ WRITE CKSUM
            HYBRID      ONLINE       0     0     0
              raidz1-0  ONLINE       0     0     0
                md0p1   ONLINE       0     0     0
                md1p1   ONLINE       0     0     0
                md2p1   ONLINE       0     0     0
              mirror-1  ONLINE       0     0     0
                md0p2   ONLINE       0     0     0
                md2p2   ONLINE       0     0     0
    
    errors: No known data errors

    # zpool list NONRED
    NAME     SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
    NONRED  1.88G   108K  1.87G        -         -     0%     0%  1.00x    ONLINE  -

    # zfs list NONRED
    NAME     USED  AVAIL     REFER  MOUNTPOINT
    NONRED   108K  1.75G       24K  /NONRED
    
    # zpool status NONRED 
      pool: NONRED
     state: ONLINE
    config:
    
            NAME        STATE     READ WRITE CKSUM
            NONRED      ONLINE       0     0     0
              md0p3     ONLINE       0     0     0
    
    errors: No known data errors
This means that instead of that 12 GB space on real 10/8/5 TB disks you would get 12 TB of redundant space and 2 TB of non-redundant space.

Instructions for real SATA disks on FreeBSD:

   # gpart create -s GPT ada0
    ada0 created
    # gpart add -t freebsd-zfs -s 5t ada0
    ada0p1 added
    # gpart add -t freebsd-zfs -s 3t ada0
    ada0p2 added
    # gpart add -t freebsd-zfs ada0
    ada0p3 added
    
    # gpart create -s GPT ada1           
    ada1 created
    # gpart add -t freebsd-zfs ada1
    ada1p1 added
    
    # gpart create -s GPT ada2     
    ada2 created
    # gpart add -t freebsd-zfs -s 5t ada2
    ada2p1 added
    # gpart add -t freebsd-zfs ada2     
    ada2p2 added
    
    # zpool create HYBRID raidz /dev/ada0p1 /dev/ada1p1 /dev/ada2p1 mirror /dev/ada0p2 /dev/ada2p2
You can also create two separate ZFS pools like that:

    # zpool create RAID5    raidz  /dev/ada0p1 /dev/ada1p1 /dev/ada2p1
    # zpool create MIRRORED mirror /dev/ada0p2 /dev/ada2p2
The mdconfig.sh script is here:

- https://github.com/vermaden/scripts/blob/master/mdconfig.sh

Hope that helps.

After all the 'stable' years with ZFS/OpenZFS I would just not trust 'some new hybrid RAID' implementation ... not to mention all the ZFS features like compression/deduplication/snapshots/clones/copies/bookmarks/send/recv/...

Regards.

There are no comments on this comment yet.