How to Stop Ubuntu from Automatically Storing Core Dumps (Crash Files) on Your Hard Drive

When a software application crashes in Ubuntu Linux, the operating system can automatically generate a “core dump.” This is a massive, uncompressed file that contains a complete snapshot of the application’s working memory (RAM) at the exact millisecond the crash occurred. Developers use these core dumps to debug exactly what caused the segmentation fault.

While invaluable for software engineers, core dumps are a nightmare for standard desktop or server users. If a background daemon begins crash-looping, Ubuntu will silently generate a massive core dump file (often several gigabytes in size) every few seconds. Within hours, your entire hard drive will reach 100% capacity, causing the entire operating system to freeze.

If you are not actively debugging C++ applications, you should restrict the operating system from ever writing a core dump file to the disk.

How to Disable Core Dumps System-Wide

To permanently stop Ubuntu from saving crash memory, you must edit the system limits configuration file.

  1. Open your terminal application (Ctrl+Alt+T).
  2. Open the limits configuration file using a text editor with root privileges:

sudo nano /etc/security/limits.conf

  1. Scroll to the very bottom of the file. You will see several lines of configuration examples commented out. At the absolute bottom of the document, add the following two lines exactly as written:
* soft core 0
* hard core 0

(The asterisk * ensures this limit applies to all users on the system, and setting the size to 0 prevents any file from being written).

  1. Save the file (Ctrl+O, Enter) and exit nano (Ctrl+X).

How to Disable systemd-coredump

Modern Ubuntu installations also use a systemd daemon specifically designed to catch and compress these dumps. You should neuter this daemon as well to be absolutely safe.

  1. Open the systemd configuration file:

sudo nano /etc/systemd/coredump.conf

  1. Look for the line that says #Storage=external.
  2. Change it to read exactly:

Storage=none

  1. Save and exit nano.
  2. Reload the systemd daemon to apply the changes immediately:

sudo systemctl daemon-reload

Your Ubuntu system will now quietly discard all application crash memory, ensuring your hard drive never unexpectedly fills up with debugging data.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.