I recently found a (cPanel) server was generating over 100Gb of core dumps every time a bad PHP script died or Apache died. Writing these generally useless (who actually debugs these on a live web server) to disk is a pointless waste of disk I/O, especially in a VPS environment.
Here is two methods of disabling core dumps;cPanel/WHM
- Login to WHM
- Select ‘Tweak Settings’
- Search for ‘core’
- Turn ‘Generate core dumps’ off.
I usually do this on cPanel servers also, just to be double sure!
1. Disable core dumps for all users.
Edit /etc/security/limits.conf and check that * hard core 0 exists
2. Disable core dumps for setuid programs
echo ‘fs.suid_dumpable = 0’ >> /etc/sysctl.conf
3. Finally, set a soft limit to stop core dumps being created
echo ‘ulimit -S -c 0 > /dev/null 2>&1’ >> /etc/profile
No reboot required.