savecore in FreeBSD

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.



Do we need to explicitly specify savecore /data/cores in /etc/rc.conf?
 
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).
 
Do we need to explicitly specify savecore /data/cores in /etc/rc.conf?
savecore is already enabled by default,:

/etc/defaults/rc.conf
Code:
savecore_enable="YES"   # Extract core from dump devices if any

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

Not sure from where you get that, but if you mean to limit the saved cores to the 4 most recent, set savecore_flags:
Code:
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
 
dumpon -l

With an installation of FreeBSD that used GELI from the outset, for swap (in addition to encrypting the OS):

Code:
% dumpon -l
ada1p2
% lsblk ada1
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
ada1             0:136 932G GPT                                               - -
  ada1p1         0:138 260M efi                                    gpt/efiboot0 -
  <FREE>         -:-   1.0M -                                                 - -
  ada1p2         0:140  16G freebsd-swap                              gpt/swap0 SWAP
  ada1p2.eli     1:18   16G freebsd-swap                                      - SWAP
  ada1p3         0:142 915G freebsd-zfs                                gpt/zfs0 <ZFS>
  ada1p3.eli     0:148 915G -                                                 - -
  <FREE>         -:-   708K -                                                 - -
%

Lateness is important.

Code:
% grep -v \# /etc/fstab
tmpfs                   /tmp                    tmpfs      rw,mode=1777               0     0
fdescfs                 /dev/fd                 fdescfs    rw                         0     0
proc                    /proc                   procfs     rw                         0     0
/dev/ada1p2.eli         none                    swap       sw,late                    0     0
%

fstab(5)

geli(8)
 
Last edited:
Back
Top