Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Jul 2009 09:54:50 +0200
From:      "Frank Batschulat (Home)" <Frank.Batschulat@Sun.COM>
To:        =?utf-8?B?xaBpbXVuIE1pa2VjaW4=?= <numisemis@yahoo.com>, Dan Naumov <dan.naumov@gmail.com>
Cc:        "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org>
Subject:   Re: ZFS: swap on a ZVOL
Message-ID:  <op.uwotloct046apg@opteron>
In-Reply-To: <354003.91539.qm@web37307.mail.mud.yahoo.com>
References:  <354003.91539.qm@web37307.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 07 Jul 2009 09:21:54 +0200, Šimun Mikecin <numisemis@yahoo.com> wrote:

>
> 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.

Right, we do use a zvol as swap device, and we also do use a dedicated zvol as the dump device for
the kernel crash dump.
 
http://www.opensolaris.org/os/community/zfs/boot/zfsbootFAQ/#zfsswap
http://www.solarisinternals.com/wiki/index.php/ZFS_Troubleshooting_Guide#ZFS_Swap_and_Dump_Devices
http://docs.sun.com/app/docs/doc/819-5461/zfsboot-1?a=view
http://www.opensolaris.org/os/community/zfs/boot/zfsboottalk.0910.pdf
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=5008936

was part of the ZFS boot project: http://www.opensolaris.org/os/community/zfs/boot/

afai remember neither the dump nor swap part itself required changes to the ondisk format,
zpool version 6 just covered storing some new pool properties like 'bootfs' ->  
http://www.opensolaris.org/os/community/zfs/version/6/

hth
frankB




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.uwotloct046apg>