kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: andrzej-kardas@o2.pl (Andrzej Kardas)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How to limit the total size used by core files or automatically delete old corefiles.
Date: Thu, 26 May 2011 18:05:20 +0200	[thread overview]
Message-ID: <4DDE7A40.9020408@o2.pl> (raw)
In-Reply-To: <BANLkTikZCT-cpUbqyNw98jrQOcJ-b_0Qvw@mail.gmail.com>



On 26.05.2011 14:31, SADA SIVA REDDY S wrote:
> My Questions:
>
>    1. Is there a provision in Linux to automatically cleanup the old
>       corefiles when we reach a certain limit ?
>
I  think there is no such feature. Core dump is regular file saved in 
default process directory, and system doesn't trace these files, it 
simply generates core dump and forget about it (on other words, system 
treats core dumps as regular file and doesn't know that is a core dump 
file).
>
>    1. Is there a provision in Linux to set a upper limit for space
>       occupied by all core files (not individual core files) ?
>
I think no, you can limit size of generated core dump per file, per user 
(ulimit -c).


But, you can change destination of all core dump files by add line

kernel.core_pattern = /vol/allcoredumps/%u/%e

in /etc/sysctl.conf


After that, you can write a simple script to check amount of free space, 
schedule it into crontab. When free space will be below certain limit, 
script should remove oldest or biggest files from above location.

Below, list of available patterns:
|
%p: pid
%: '%' is dropped
%%: output one '%'
%u: uid
%g: gid
%s: signal number
%t: UNIX time of dump
%h: hostname
%e: executable filename
%: both are dropped|

--
regards
Andrzej Kardas
http://www.linux.mynotes.pl


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110526/a0ea1a7f/attachment.html 

  reply	other threads:[~2011-05-26 16:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26 12:31 How to limit the total size used by core files or automatically delete old corefiles SADA SIVA REDDY S
2011-05-26 16:05 ` Andrzej Kardas [this message]
2011-05-26 21:55 ` Manish Katiyar
2011-05-27  8:11   ` SADA SIVA REDDY S

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DDE7A40.9020408@o2.pl \
    --to=andrzej-kardas@o2.pl \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).