Swap space is always striped, even on mirrored volumes
When creating a mirrored volume, [[FreeNAS]] currently creates an independent swap partition on every drive, resulting in the swap space effectively being striped. This completely eliminates the availability benefits of mirroring, as a drive failure will now result in the unexpected disappearance of swap space, panicking the system if that swap space was in use.
For mirrored volumes, if you absolutely must create swap partitions on all drives (see #207), please create them on top of a gmirror so drive failure can be tolerated as one would expect from a mirrored volume.
#1 Updated by Josh Paetzel almost 8 years ago
The additional complexity of having gmirror on volumes is fairly risky, furthermore several [[FreeBSD]] developers are of the feeling that in use swap failing will not result in a kernel panic, but rather failure of the app using the swap.
In addition to this, by reserving a small piece of disks, it is possible to replace drives with drives that have slightly different geometry by adjusting the swap size.
Jury is still out, however, we are attempting to ascertain what the real risk is.
#2 Updated by Daniel Becker almost 8 years ago
If nothing else, if such a situation were to lead to the web server and/or SSH daemon getting killed, this could leave the box inaccessible and without a way to initiate a graceful shutdown. And of course there's the potential for data loss in the failing app. In any case, would it be unreasonably complex to simply provide an option to opt out of creating swap partitions on all drives?
#3 Updated by Jason L almost 8 years ago
Josh and razzfazz,
Thanks for being open to discussing this.
An additional $.02:
I would also appreciate an option to either disable swap or find an alternative to swap on every drive that's resilient to drive failures (more on that below).
At the end of the day, it probably depends on the administrator's use case, reliability or consolidation. While some people might look to consolidate and install a significant number of extra services on their [[FreeNAS]] box and expect to swap at some point, others will go out of their way to assure high reliability/availability in the face of expected hardware failures (RAM and disk).
On the reliability/availability side: With 7 drives, I anticipate drive failures at some point in my system's lifetime, and prefer to be a little paranoid that swap loss leading to an app failure doesn't take down daemons associated with samba, afp/netatalk, or iscsi. My current approach to reliability is to install minimal extra services and load up on ECC RAM. :-)
Some bits to discuss would be:
(1) Swap management - even if minimally tailored to two use cases: max reliability vs max services
(2) ZFS/zpool-hosted swap - either managed on a file, or via "zfs set org.freebsd:swap=on"
Some combination of the above might be the best of both worlds? Offers the option of swap while insulated from individual drive failures.
Maybe this could turn into an enhancement request for [[FreeNAS]] 8.1?
#4 Updated by Neil MacLeod almost 8 years ago
Reserving space to allow for variance in replacement disk geometries sounds like it might be a good idea for some users, but there must be a better solution than creating an active swap partition on each disk which may have implications for the OS when part of the overall swap disappears.
Even if it's just the application using swap that fails, it's an application that has failed because [[FreeNAS]] 8 is mandating swap that I don't want or need.
Can't the disk space just be reserved, without creating it as swap, and with the user having the option of not reserving any space at all since they would most likely replace a failed disk with an identical make/model or, one or two years down the road, a disk with significantly larger capacity?
As I say, it sounds like a good idea for some users, but reckon most would rather use the space for storage, with the added benefit of not having to worry what happens when a disk with swap on it disappears.
#5 Updated by Xin Li over 7 years ago
Mark down this issue since the system is capable of putting no swap on drives now due to popular request.
By the way I don't personally view having swap stripped as a big problem here. Swap is like a backup tire on a car and if you're already on that, it's more wise to get service as soon as you can (add more memory) and not expecting the system would be reliable. Note that going without swap is like going on road without a backup tire, it's an adventure but never be fun when one really needs the tire.