ZFS the use of swap

This has made me wonder for a while now, I've got a system with 32gb of ecc ram, .. and 2gb of geli mirrored swap space. What made me wonder is once the system starts using swap space the memory is not ecc checked anymore, so I was wondering does it have an effect on zfs, or is the kernel designed to only use real ram when it comes to zfs.
 
What made me wonder is once the system starts using swap space the memory is not ecc checked anymore
Correct, then it's basically up to the filesystem to prevent any data corruption from happening.

, so I was wondering does it have an effect on zfs, or is the kernel designed to only use real ram when it comes to zfs.
Not sure I understand the question, but using ZFS doesn't affect the requirement for any swap space. My swap space resides within my ZFS pool so it also gets all the data protective benefits which you'd expect from ZFS usage:

Code:
breve:/home/peter $ zfs list zroot/swap
NAME         USED  AVAIL  REFER  MOUNTPOINT
zroot/swap  5.38G  6.97G  1.26G  -

But this isn't the only way to set this up. I also know of systems where a slice is reserved for swap (freebsd-swap), in which cases ZFS isn't involved at all.
 
Well my swap is not on the zfs layer it is a partition slice on the same disk, though. What I was wondering about, does the freebsd kernel know when it's using swap or memory and if so does it use swap when it deals with zfs or only memory.

Basically does it reserve memory just for zfs operations.
 
ZFS uses "wired" memory for most part of its caches and data structures, wired memory can not be swapped out under any circumstances.
 
So is it ok to use swap or not, because this is not making any sense to me, why would anyone create swap space on systems with zfs and ecc memory if this is the case. What is the point. An other question PCBSD uses zfs as default file system, not one desktop motherboard that I know of even supports ECC memory. I mean desktop systems do support ECC memory, but it's degraded back to normal memory.

So tell me why would anyone with a desktop even use zfs or with a server use swap, if it's a sliced partition which does not reside within the zfs system it self. It doesn't make any sense to me.
 
PCBSD's decision to use ZFS by default is an uninformed one in my opinion. ZFS is a mature filesystem but requires attention and expertise from the user in such extent that most PCBSD users just don't have, UFS would do that job more than well enough on PCBSD in my opinion.

The swap space is there because the virtual memory system works better if there is one, it allows the vm system to swap out unused pages in case free memory is getting sparse. Technically it's not needed if you have enough physical memory and you know that none of your applications or services are going to use so much memory memory that free memory is exhausted. However, you never know this in advance well enough so it's better to have some swap in case something goes wrong and a runaway application or service starts eating free memory.
 
So is it ok to use swap or not, because this is not making any sense to me, why would anyone create swap space on systems with zfs and ecc memory if this is the case.

You can use swap if you want to. If your concern is that data paged out to swap space loses the protections of both ECC RAM and ZFS, then I would say your concern is valid. (Data corruption may be unlikely, but it does not make much sense to deliberately make a swap partition that circumvents the protections you deliberately put in place.) The proper way to use swap on a ZFS-based system is to either create a swapfile, or create a zvol with its own swap partition. It doesn't seem proper to create a separate swap partition on-disk, or a second zpool just for swap.

PCBSD's decision to use ZFS by default is an uninformed one in my opinion.

I would have to agree, for pretty much the same reason. Using ZFS on a desktop is just fine, but requires the sort of knowledge and attention not typically found in PC-BSD's target audience.

An other question PCBSD uses zfs as default file system, not one desktop motherboard that I know of even supports ECC memory.

The recommendation to use ECC RAM is just that: a recommendation. Some overly zealous ZFS advocates have blown it out of proportion. The general reasoning is this: if you're already taking the extra step of using ZFS to protect your data on-disk, wouldn't you also want to take one more step and protect it before it's written to disk? If so, ECC RAM can provide an extra layer of protection, so if your data is really, really important, you should use it. But there is nothing inherent to the design of ZFS that makes using it without ECC RAM dangerous or stupid.

Here's something to consider: the most vocal and vehement insistence that ECC RAM (and other really expensive server-grade hardware) is a requirement for ZFS comes from the FreeNAS community. FreeNAS is a server-oriented operating system. PC-BSD uses ZFS as its default filesystem. PC-BSD is a desktop-oriented filesystem. FreeNAS and PC-BSD are developed by the same people---ix Systems. Thing is, ix Systems doesn't sell a pre-built desktop system with their branding stamped on it and PC-BSD installed. But you can certainly give them half a month's pay for a pre-built FreeNAS server, complete with ECC RAM.
 
The proper way to use swap on a ZFS-based system is to either create a swapfile, or create a zvol with its own swap partition. It doesn't seem proper to create a separate swap partition on-disk, or a second zpool just for swap.
Agreed on the separate ZFS pool, however there is a very solid reason why some administrators prefer the use of a separate 'swap slice' (freebsd-swap), even though I'm convinced the whole thing is redundant now.

But there was a time around FreeBSD 9.1 and 9.2 where the use of swap space within a ZFS pool had the potential to crash your entire system. Needless to say that it was a much safer approach to simply use a separate slice. So if you come across a server which has been set up around that time and utilizes ZFS then it's really not that surprising if they use a separate slice.

Of course things got patched in the mean time and right now there is no such risk anymore.
 
Back
Top