# savecore in  FreeBSD



## kavitakr (May 29, 2022)

We want to dump kernel cores to different directory in /etc/rc.conf

dumpdev="AUTO"
dumpdir=/data/cores
dumps=4
I did go through, but its not clear if its implicitly called.





						dumpon
					






					www.freebsd.org
				









						savecore
					






					www.freebsd.org
				





Do we need to explicitly specify savecore /data/cores in /etc/rc.conf?


----------



## Bobi B. (May 29, 2022)

`dumpdev="AUTO"` depends on a swap device to be listed in /etc/fstab. For savecore(8) to automatically extract the core add `savecore_enable="YES"` to /etc/rc.conf. Also verify with `dumpon -l` if `dumpdev` configuration is properly applied (i.e. prints different than `/dev/null`).


----------



## T-Daemon (May 29, 2022)

kavitakr said:


> Do we need to explicitly specify savecore /data/cores in /etc/rc.conf?


`savecore` is already enabled by default,:

/etc/defaults/rc.conf

```
savecore_enable="YES"   # Extract core from dump devices if any
```



kavitakr said:


> dumpdev="AUTO"


Instead of "AUTO" a device, (swap) partition can be defined, i.e.:

```
dumpdev="ada0p4"
```



kavitakr said:


> dumps=4


Not sure from where you get that, but if you mean to limit the saved cores to the 4 most recent, set `savecore_flags`:

```
savecore_flags="-m 10"  # Used if dumpdev is enabled above, and present.
                        # By default, only the 10 most recent kernel dumps
                        # are saved.
```

To test the kernel dump configuration, drop to single user mode, make sure the file system is read-write, execute

`sysctl debug.kdb.panic=1`


----------

