Date: Tue, 06 May 2014 20:56:48 -0400 From: Daniel Staal <DStaal@usa.net> To: freebsd-questions@freebsd.org Subject: Re: Swap on ZFS Message-ID: <C1DCD8EEE8523B91197B6D82@[192.168.1.50]> In-Reply-To: <53697D8B.2060906@gmail.com> References: <CAHAXwYA9NBsYTpUGCZ_5f%2B_qDuvS%2BbN9vE4GAZhpRhWVWCwi7g@mail.gmail.com> <53697D8B.2060906@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--As of May 7, 2014 2:25:47 AM +0200, Rolf Nielsen is alleged to have said: > On 2014-05-06 21:21, David Noel wrote: >> Is swap on ZFS still ill-advised? All the forum, list, and blog >> posts I find say it's a no-go. Is this still the case? The idea >> behind it not working is that ZFS needs memory to write to disk, so >> when you need to swap (are low on memory) ZFS won't be able to >> write. >> >> I found some talk of having a tunable added as a workaround that >> would reserve a certain amount of memory for ZFS so this wouldn't >> be a problem, but have no idea if anyone's made any progress >> towards implementing it. > > Just out of curiosity, why do you want it? > > To get swap on ZFS, you first need to create a ZFS filesystem on one > or more devices, then you create a dedicated volume inside that > filesystem and use that dedicated volume as swap. To me that seems to > add unnecessary complexity, similar to using a file backed md device > as swap. Please don't take this as criticism; you may very well have > good reasons for wanting to do this. I'm just curious about those reasons. --As for the rest, it is mine. Because it's actually simpler than the alternative, in many cases. The creating a ZFS filesystem is 'free' in this - you are only planning on doing this if you are already running a ZFS-based system, so you're already creating the filesystem. That leaves creating the dedicated volume inside that and using it as swap - which is as easy or easier than formatting and using a dedicated disk as swap. So, really using swap on ZFS is no harder or easier than using a dedicated swap disk, and no more complex. And if you *aren't* planning on a dedicated swap disk, it starts adding complexity: If you aren't using a dedicated swap disk, then you're probably sharing it with a disk that you'll be using in the ZFS filesystem - which means you now need to format and partition that disk, which you didn't need to do before. You also have to monitor and remember that the disk is partitioned, if you ever have to replace it. (Which otherwise ZFS would make easy - just swap in a new one, and tell ZFS to use it to replace the failed disk.) So your steps are: 1. Create ZFS filesystem. 2. Create swap inside filesystem. 3. Configure FreeBSD to use swap. vs. 1. Partition Disks. 2. Set up Swap partition. 3. Configure FreeBSD to use swap. 4. Create ZFS filesystem on other partition. Note of course that one of the points of using ZFS is the ease and flexibility of creating volumes inside it - a ZFS user is probably creating multiple at setup, and the swap volume isn't all that different to create. And again, you're giving up the ability to use ZFS to manage the device on the fly, which is one of ZFS's best benefits. Daniel T. Staal --------------------------------------------------------------- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. ---------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C1DCD8EEE8523B91197B6D82>