# How to use a partition for kernel dumps, but not swap?



## vadipp (Jun 18, 2013)

Hi forums!

My setup is a FreeBSD 9.1-RELEASE with a ZFS mirror pool on fast disks and a UFS partition on a slow disk (2/5", 5400 RPM). I want to enable kernel dumps. I can't repartition the fast drives to make a dump partition there, because that would require moving too much data. I really should have thought of this before creating the pool  But if I create the dump partition on the slow drive, it will also act as swap and slow down my system 

Handbook says that I should call `swapon` before calling `dumpon`. But maybe it's possible to somehow prevent swapping on this device?


----------



## SirDice (Jun 18, 2013)

vadipp said:
			
		

> But if I create the dump partition on the slow drive, it will also act as swap and slow down my system


Your system will only slow down if there is excessive swapping. When that happens you usually just need to add more memory to the system. Just having swap will not slow down the system. Modern operating systems will actually run better if there is some swap, even if it's not really needed.


----------



## vadipp (Jun 18, 2013)

Thanks @SirDice for the reply. I already have a swap ZVOL on my ZFS pool and I'm happy with that  I would rather not add a new swap, if that's possible.


----------



## jem (Jun 18, 2013)

Set the DUMPDEV variable in /etc/rc.conf to point at your slow disk.


----------



## vadipp (Jun 18, 2013)

@jem, your advice will help me make the slow disk the dump device, but as far as I understand, will not prevent it from being used as swap, which is the crucial part of my question. Am I wrong?


----------



## fonz (Jun 18, 2013)

Is there any possibility for you to repartition the slow drive and have separate partitions for swap and dump?


----------



## vadipp (Jun 18, 2013)

@fonz, yes, but why are you asking? I don't want to have swap on the slow drive, I only want to have a "dump device" there.


----------



## fonz (Jun 18, 2013)

vadipp said:
			
		

> I don't want to have swap on the slow drive, I only want to have a "dump device" there.


In that case, see @jem's post #4. The dump device doesn't necessarily have to be a swap partition. So either follow @jem's suggestion or create a partition on the slow disk, create a UFS filesystem on it and have it mounted under /var/crash.


----------



## vadipp (Jun 18, 2013)

@fonz, thanks. 

For history, I've now done the following:

Created /var/crash directory with permissions `drwxr-x--- root wheel`.
Created partition /dev/ada3s1a of size 8 GB (= size of my RAM) and type freebsd-swap on my slow disk.
Added these lines `dumpdev="/dev/ada3s1a"` and `dumpdir="/var/crash"` to /etc/rc.conf.
Executed `dumpon /dev/ada3s1a` to apply the change without reboot.

I'll see if it works after the next crash 

Actually the kernel debugging handbook page confused me. It says:


> The dumpon(8)() program must be called after the swap partition has been configured with swapon(8)().



But it turns out that it's not strictly true.


----------



## vadipp (Jul 31, 2014)

> I'll see if it works after the next crash


Actually, this never worked.

But after I upgraded my system to 9.2-RELEASE, the crashes disappeared. So I'm happy now


----------

