Search code examples
zfs

Why is a ZFS RAIDZ giving me such a small pool size?


sda is my system disk that I don't want included in my ZFS pool. the disks that are involved are printed below.

$ lsblk | grep disk | grep -v sda

sdb      8:16   0 465.8G  0 disk
sdc      8:32   0 465.8G  0 disk
sdd      8:48   0   149G  0 disk
sde      8:64   0 298.1G  0 disk
sdf      8:80   0 931.5G  0 disk
sdg      8:96   0   1.4T  0 disk
sdh      8:112  0 465.8G  0 disk
sdi      8:128  0 465.8G  0 disk
sdj      8:144  0 232.9G  0 disk
sdk      8:160  0 298.1G  0 disk
sdl      8:176  0 232.9G  0 disk
sdm      8:192  0  74.5G  0 disk

I wrote a script to calculate the sum of the entire disks:

#!/bin/bash
math=0
array2=($(lsblk -b | grep disk | grep -v sda | awk '{print $4}'))
for i in ${array2[@]}
    do
        let math+=$i
    done
echo "$math b"
let math=$math/1024
echo "$math kB"
let math=$math/1024
echo "$math mB"
let math=$math/1024
echo "$math gB"
let math=$math/1024
echo "$math tB"

the output of the script is:

5881143460864 b
5743304161 kB
5608695 mB
5477 gB
5 tB

but when I create a RAIDZ, see the following output:

$ sudo zpool create castle raidz sdb sdc sdd sde sdf sdg sdh sdi sdj sdk sdl sdm -f

$ sudo zpool list
NAME     SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
castle   888G   106K   888G         -     0%     0%  1.00x  ONLINE  -

How can I troubleshoot what is happening here?

Thanks!


Solution

  • You are creating a RAIDZ with 12 devices, all of them align their usable space to the smallest one which is 74.5 GB, thus the resulting smaller than expected pool size and a lot of disk space wasted.