I recently moved all our production files servers from FreeNAS to FreeBSD 12.0-RELEASE. One thing that I have never been able to determine is whether or not to mirror swap. None of my research here or elsewhere concluded with a solid answer. Well, based on some recent experiences, I'm even more confused than ever.
I know the installer warns that if you mirror swap it disables crash dumps or something. What is the significance of this? What other issues might come up if I mirror swap? I haven't been able to find a definitive resource on this.
I've had issues with swap on two systems recently. One system has zroot on six spindles (no dedicated OS drives). I chose not to mirror swap so the installer created one swap partition per drive. I lost one of the drives the other day and the system became unstable and had to be rebooted. The drive was "stuck." "swapoff -a" wasn't working. Processes were dying with the following error:
There was no way around this that I could find except a reboot. Not good. Luckily this was just a backup system, but my production system is set up similarly so now I'm nervous.
Another system has dedicated 16GB SATA DOMs for boot and eight data drives. I believe what I did there was to create NO swap on the OS drives then later I set up geli + gmirror on the data drives. One day I pulled a drive in order to test something. After I put the drive back and onlined it ZFS was fine, but it messed up swap just like what happened with the system above so I had to reboot the box. This was very surprising to me.
The swap setup should have looked something like this:
But it looked something like this:
da0 being the drive I pulled and replaced. It looks like it broke the mirror and then grabbed the raw device for some reason. I was getting the same "pagein failed" errors above and had to reboot like I said.
So now I'm not sure what to do. On my Linux systems, I always like to keep a little swap and then I tune it so swapping is very rare (and everything has plenty of memory of course). I could probably run without swap and so far I have on the second system without any problems, but it's just a backup system.
What are your real world experiences with swap? My primary goal is to be able to lose a drive and not have the system become unstable, needing a reboot, of course. Mirroring swap doesn't seem to work as expected either! I'm inclined to remove swap at this point from all of my systems. Thoughts?
I know the installer warns that if you mirror swap it disables crash dumps or something. What is the significance of this? What other issues might come up if I mirror swap? I haven't been able to find a definitive resource on this.
I've had issues with swap on two systems recently. One system has zroot on six spindles (no dedicated OS drives). I chose not to mirror swap so the installer created one swap partition per drive. I lost one of the drives the other day and the system became unstable and had to be rebooted. The drive was "stuck." "swapoff -a" wasn't working. Processes were dying with the following error:
Code:
Dec 17 05:30:19 kern.crit backups01 kernel: swap_pager: I/O error - pagein failed; blkno 2622072,size 4096, error 6
Dec 17 05:30:19 kern.crit backups01 kernel: vm_fault: pager read error, pid 26086 (inetd)
There was no way around this that I could find except a reboot. Not good. Luckily this was just a backup system, but my production system is set up similarly so now I'm nervous.
Another system has dedicated 16GB SATA DOMs for boot and eight data drives. I believe what I did there was to create NO swap on the OS drives then later I set up geli + gmirror on the data drives. One day I pulled a drive in order to test something. After I put the drive back and onlined it ZFS was fine, but it messed up swap just like what happened with the system above so I had to reboot the box. This was very surprising to me.
The swap setup should have looked something like this:
Code:
# swapinfo
Device 1K-blocks Used Avail Capacity
/dev/mirror/swap0.eli 2097152 6716 2090436 0%
/dev/mirror/swap1.eli 2097152 6716 2090436 0%
/dev/mirror/swap2.eli 2097152 6716 2090436 0%
/dev/mirror/swap3.eli 2097152 6716 2090436 0%
Total 8388608 26864 8361744 0%
But it looked something like this:
Code:
# swapinfo
Device 1K-blocks Used Avail Capacity
/dev/mirror/swap0.eli 2097152 6716 2090436 0%
/dev/mirror/swap1.eli 2097152 6716 2090436 0%
/dev/da0p1
/dev/mirror/swap3.eli 2097152 6716 2090436 0%
Total 8388608 26864 8361744 0%
da0 being the drive I pulled and replaced. It looks like it broke the mirror and then grabbed the raw device for some reason. I was getting the same "pagein failed" errors above and had to reboot like I said.
So now I'm not sure what to do. On my Linux systems, I always like to keep a little swap and then I tune it so swapping is very rare (and everything has plenty of memory of course). I could probably run without swap and so far I have on the second system without any problems, but it's just a backup system.
What are your real world experiences with swap? My primary goal is to be able to lose a drive and not have the system become unstable, needing a reboot, of course. Mirroring swap doesn't seem to work as expected either! I'm inclined to remove swap at this point from all of my systems. Thoughts?