What to expect if FreeNAS loses connection to disk shelf?

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Cape

Member
Oct 28, 2015
36
6
8
I just set up a FreeNAS VM to start experimenting with. VM on ESXi, passthrough of a LSI9200, connected to external disk shelf.
I figured it would be a good thing to know what would happen if my disk shelf lost power or similar, so I powered it down. This led to two unexpected things:
1. It took > 1 minute until FreeNAS seemed to notice (pop an alert in the UI, that is)
2. After it noticed, a lot of things seem to die. The UI no longer works, ssh doesn't work, and even console login stalls after giving the password.

Is this actually expected behavior, or something likely to be wrong with my install?
 

NathanM3

New Member
Dec 4, 2016
7
0
1
I had this same issue a couple weeks ago. What I found was that freenas was using swap. Freenas uses a 2gb partition on the pool drives for swap. So when the pool drives got disconnected, the swap partition that freenas was using also got disconnected.

There is a system tunable to adjust the amount of ram the ZFS leaves free. I adjusted this so that more ram is left free and I have not seen it swap since. This system has about 100gb of ram, so it was not caused by a lack of sufficient hardware.

I did not test whether this completely fixes the crashing problem when disconnecting drives, but it fixed the root cause that I saw. The system is in production so I didn't test it further.
 
Last edited:

Cape

Member
Oct 28, 2015
36
6
8
Oh, yeah, that would cause problems. This system probably hadn't swapped very much either, but I would expect it to be somewhat confused anyway if swap space goes away without notice.
Still, seems a bit fragile - I noticed FreeNAS will by default (and with strict warnings about not disabling it) add some swap on all pools, and if it crashes the entire system if it loses any of those? Otherwise I'd have just added another non-external disk as swap space.
 

Ixian

Member
Oct 26, 2018
88
16
8
Common practice with FreeNAS & ESXi is to move swap to an nvme, the same one you should already have for slog and cache.

For example I have an Intel DC3700 passed through that I've partitioned for swap, log, and cache. When using ESXi you'll most likely be using NFS to connect to your ZFS datasets and you're going to want something like that anyway for performance reasons. Check out page 3 of this thread for details (actually read the whole thing, it's fantastic and was a major help when I set my own up).
 

azev

Well-Known Member
Jan 18, 2013
768
251
63
I think the main issue is that by default zpool provisioning via GUI will always automatically create 2GB swap partition in each drive. I wish there is a way (maybe there is I just dont know how) to customize the swap partition location via gui instead of having to manually create the freebsd-zfs partition & freebsd-swap via gui which will simplify the initial zpool provisioning.
 

Ixian

Member
Oct 26, 2018
88
16
8
Fair enough. Though it's very simple to do via shell, or just add as a post-init command. This:
Code:
swapoff -a ; grep -v -E 'none[[:blank:]]+swap[[:blank:]]' /etc/fstab > /etc/fstab.new && echo "/dev/gptid/24642fd-1467-11e9-ad08-000c296d6423.eli none swap sw 0 0" >> /etc/fstab.new && mv /etc/fstab.new /etc/fstab ; swapon -a
where you obviously put the gptid of the device you will use for swap instead of the example I provide here, added as an post-init command via the GUI, will do it. You can also run it from the shell if you don't want to reboot right away.

That will delete the existing pool swaps and establish it on the device of your choosing.