Initial Status:
Because I have had trouble with the way ZFS on Linux (ZOL) handles failing drives, I have decided to create a software
RAID set of my drives before creating my zpool.
This means that my zpool is created with a single device (/dev/md0). If I remember correctly, it was created like this:
zpool create pool0 md0
EXPANSION:
By default pool’s are not set to autoexpand so it is needed to set the autoexpand to on:
zpool set autoexpand=on pool0
Before I could get the pool expanded I needed to grow my RAID set. It is done by first adding a device to the existing
RAID set and then “growing” it with the new amount of devices.
mdadm /dev/md0 --add /dev/sdd
mdadm --grow /dev/md0 --raid-devices=4
After the RAID set have reshaped, the extra space is available for use. According to all information I could find, it should be possible to expand the pool by either exporting and importing it
zpool export pool0
zpool import pool0
or by expanding the online pool
zpool online -e pool0 md0
I tried both several times and in different order, but to no avail. My pool was fixed at its original size.
REBOOT:
Finally I decided to do a reboot to see if that would change anything. Remember to save the new mdadm configuration before rebooting.
# Remove existing array configuration from mdadm.conf file
grep -v ARRAY /etc/mdadm/mdadm.conf > /tmp/mdadm.conf
# Add new array configuration to mdadm.conf
cat /tmp/mdadm.conf > /etc/mdadm/mdadm.conf
mdadm --examine --scan >> /etc/mdadm/mdadm.conf
After the reboot, the pool was still the original size, but now it actually worked to do an online expansion.
zpool online -e pool0 md0
And that solved the problem. Unfortunately I do not know why I could not perform the online expansion without a reboot.