ZFS: swap on a ZVOL

Šimun Mikecin numisemis at yahoo.com
Tue Jul 7 07:21:55 UTC 2009


Dan Naumov wrote:
As far as I know, using swap on top of a "non-trivial" filesystem like
ZFS is considered "unsupported", but it does in fact work. You can
create a ZVOL of arbitrary size (say, 4G) and then do the following:
zfs set org.freebsd:swap=on pool/swapvolname
to have /etc/rc.d/zfs enable swap on said ZVOL on every boot. You can
also do this in an ugly way: put swapon
/dev/zvol/<poolname>/<swapvolname> into your /etc/rc.local (without
having to pass the "org.freebsd:swap=on" option to the ZVOL).

Now the question remains, what kind of issues are expected to arise
when using swap on a ZVOL and is there any work going to in order to
resolve them? One of the issues mentioned is that ZVOL swap cannot
handle kernel dumps and another, more serious potential issue is a
race condition where "more swap is needed to swap". Assuming I have a
machine with 2gb ram, if I use a 4gb ZVOL swap, am I likely to run
into any serious issues assuming that under normal operation, the
system uses from none to very little swap?

AFAIK, it was said that race condition you mentioned also exists in OpenSolaris (that was back in the ZFS v6 days).
But, AFAIK new versions of OpenSolaris do use swap on ZFS volume as by default (correct me if I'm wrong).
Somebody more knowledgeable should answer this, but this made me thinking that maybe, just maybe that race condition was solved in some ZFS version >v6.




      


More information about the freebsd-fs mailing list