Swap on ZFS - bad idea? (swap_pager: indefinite wait buffer)
John Nielsen
lists at jnielsen.net
Tue Dec 10 23:34:49 UTC 2013
On Dec 10, 2013, at 2:50 PM, Shane Ambler <FreeBSD at ShaneWare.Biz> wrote:
> On 11/12/2013 04:06, Oscar Prieto wrote:
>> Personally I still have to read an announcement telling that swap on zfs is
>> relliable. I'm still using a dedicated swap partition on every install due
>> to that kind of behaviour.
>
>> On Tue, Dec 10, 2013 at 11:41 AM, Benjamin Lutz <benjamin.lutz at biolab.ch>wrote:
>>
>>> This sort of hang seems to happen every couple of months. I'd really like
>>> some pointers on how to increase the stability of this system. Maybe there
>>> are some more tunables I need to adjust? Or is swap on ZFS maybe just not
>>> a great idea?
>
> I did read somewhere that it is not recommended to use a zvol for swap.
>
> Personally I did setup swap on a zvol when I first started with zfs.
> Turning it off showed a performance boost but I never had any errors
> from it. I had only setup a single disk zpool so maybe its swap on zfs
> raidz that causes the errors.
I've never seen a problem with swap on a zvol in any currently-supported version of FreeBSD but as always, YMMV. I use the below commands to create and activate a swap volume (2G in this example):
zfs create -V 2G -o org.freebsd:swap=on -o checksum=off -o compression=off -o dedup=off -o sync=disabled -o primarycache=none ${rootzpool}/swap
echo "/dev/zvol/${rootzpool}/swap none swap sw 0 0" >> /etc/fstab
swapon -a
Most of those options are from https://wiki.freebsd.org/RootOnZFS#ZFS_Swap_Volume, other bits are from elsewhere. Using both "org.freebsd:swap=on" and /etc/fstab is redundant but doesn't hurt anything.
HTH,
JN
More information about the freebsd-stable
mailing list