kern/118713: Display media size required for a kernel dump

Michael Haro mharo at
Fri Dec 14 19:40:01 PST 2007

>Number:         118713
>Category:       kern
>Synopsis:       Display media size required for a kernel dump
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 15 03:40:00 UTC 2007
>Originator:     Michael Haro
>Release:        7.0-beta4
My raw swap partition is smaller than the amount of ram on my system.  This is okay since freebsd now has minidump support and it doesn't require swap to be the same size as ram.  Unfortunately I was still unable to save a dump when a kernel panic occured.  The attached patch displays the size required.

I assume you could do a better job at making the output pretty, but this does the job and answered my question, allowing me to resize some partitions so I'd have enough swap space to capture dumps.
Enter a condition that causes a kernel panic and have a swap partition that's too small to dump to.
--- i386/i386/minidump_machdep.c.orig   2007-04-06 11:15:02.000000000 -0700
+++ i386/i386/minidump_machdep.c        2007-12-07 00:04:48.373609771 -0800
@@ -375,9 +375,12 @@

        if (error == ECANCELED)
                printf("\nDump aborted\n");
-       else if (error == ENOSPC)
+       else if (error == ENOSPC) {
                printf("\nDump failed. Partition too small.\n");
-       else
+               printf("media size (%llu) < required space (%llu)\n",
+                      (unsigned long long)di->mediasize,
+                      SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2);
+       } else
                printf("\n** DUMP FAILED (ERROR %d) **\n", error);


More information about the freebsd-bugs mailing list