Nas4Free is a great Nas Operation System which works extremely well with the ZFS filesystem. ZFS is a very powerful filesystem (or actually it is more like a combination of a file system and a logical volume manager). It has many great features, but it is not very strong in expanding its pool (when compared to Readynas' XRAID).
A pool??? Yes, a pool... or actually a zpool. If you have no idea what I am talking about here, then it is time to first read about ZFS, for example here, here, here and here.
To test these procedures I used Virtualbox. In the virtualbox environment I installed Nas4Free version 188.8.131.52 (Sandstorm). I prepared the Virtualbox setup with 1 disk for the OS, 2 disks of 2GB and 2 disks of 3 GB. At the first boot, the OS disk, and the two 2GB disks are available to the Virtual-Machine (VM).
Nas4Free installed without issues on the OS disk. Then I added the other 2 disks as a ZFS pool (zpool):
First the disks are formatted as ZFS disks. The VM has access to 3 virtual disks ada0, ada1, ada2. The OS disk is ada0. All disks are 2GB. I have 1 zpool with 1 vdev with ada1 and ada2 as ZFS Mirrors.
Now the zpool is ready to store data on. Great, lets put some files and folders on the disk... for fun!
Options to grow the zpool
In ZFS a zpool can grow in (at least) 2 ways: 1) add an extra vdev (created from new disks), and 2) grow an existing vdev.
This acticle will focus on the second option. Simply put, we will "pull" the two virtual harddisks in Virtualbox and replace them with the bigger versions.
How does the growing work
First it is advisable to read this as it explains a lot of stuff as well.
Switch of the VM. Then remove one of the disks, in this case ada0. If we bootup the VM then Nas4Free will report that the zpool is in a degraded state, however all the data is still perfectly fine and accessable.
Now we switch the VM off again and add the first 3GB disk on the same location, in this case ada0. Then we will bootup the VM. The zpool is still in a degraded state! Yes it is, we did not tell ZFS yet that we (had to) replace the disk. So that is the first thing we will do. So we go to [Disks->ZFS->Tools] where we select 'replace' as the command. We select the correct device and pool. Then we select the disk we removed from the Devices set. Finally we choose the disk which is the replacement. In this case the one in ada0. CLick 'Send command' and.... Tadaaah! If you check now the status of the zpool it will tell you that it is online (and wait untill it tells you it is online)!
If the commands above do not work, you might want to check this page.
So that worked very well... and nicely. We can repeat this story for the second disk. After the disk is online again we have the two 3GB disks in the place of the two 2GB disks.
Now it is time to tell the Nas4Free GUI that we are dealing with some new disks. To do this go to [Disks->Management] and click on 'Clear config and Import disks'. This is a GUI thing and should not change anything in the actual device or filesystem setup.
Now we need to tell ZFS that it may use all the space it want from the two disks. This cannot be done using some standard button in the Nas4Free GUI. For this we either have to connect using SSH, or use the Command tool. We will use the latter, so go to [Advanced->Command]. The command we will provide is build as:
zpool online -e <pool> <disk>
In my case this is:
zpool online -e myzpool ada1 zpool online -e myzpool ada2
The expansion should be instantanious. If you check the zpool size it should now be 3GB.
Some notes on ZFS, disks, vdevs, and zpools
- Note that vdevs and zpools can only grow, they cannot shrink. Meaning: growing them is a irreversable step to take. If you add a vdev to a zpool, you cannot remove it anymore. If you have resized the disks within the vdev (and thus the vdev), it becomes impossible to go back to smaller disksizes.
- Note that the data in the zpool needs to resilver after every replace. Make sure that the resilvering is finished before replacing a second disk (or you will loose data).