OSx, core files and disk space
July 2010
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
About
This site is an effort to share some of the base knowledge I have gathered through all this years working with Linux, FreeBSD, OpenBSD, Python or Zope, among others. So, take a look around and I hope you will find the contents useful.
Recent Entries
Recent Comments

collective.solr 1.0rc1 (Release candidate)
2010-07-30 plone.org releases

Products.cron4plone 1.1.5rc1 (Release candidate)
2010-07-30 plone.org releases

vs.dashboardmanager 0.2.6.1
2010-07-30 plone.org releases

Heads up! OpenBSD now supports multi-byte characters!
2010-07-30 OpenBSD Journal (undeadly.org)

Setting the Focus Distance on the Epson V700 Scanner
2010-07-29 betabug

Gnome Census Released (and Red Hat 16% vs Canonical 1% Flame)
2010-07-29 Ramble on

Cómo conectarse a bases de datos SQLite desde NetBeans
2010-07-29 vaites (dmnet)

Diferencias cambiando de Perl a Python
2010-07-28 blackshell

Monos y cacahuetes
2010-07-28 userlinux.net

No Gazoline
2010-07-28 betabug

[c2k10] (Part 5)
2010-07-28 OpenBSD Journal (undeadly.org)

Cómo evitar fbc_channel=1 con Facebook Fan/Like Box
2010-07-28 vaites (dmnet)

Copyright Nonsense
2010-07-28 Ramble on

New Plone Usergroup in Charlottesville, VA kicks off July 29th
2010-07-28 plone.org news

Redimensionar la ventana de Firefox sin extensiones
2010-07-27 vaites (dmnet)

ἀφορισμός XII: Silencio
2010-07-27 emereci

New committer: Baptiste Daroussin (ports)
2010-07-27 FreeBSD latest news

[c2k10] The Hackathon BBQ (Part 4) - June 25 - July 3, 2010, Edmonton, Alberta, Canada
2010-07-26 OpenBSD Journal (undeadly.org)

Setting up Bacula
2010-07-26 Evilcoder

Plone 4 upgrade coming to plone.org
2010-07-25 plone.org news

So I bought a Scanner
2010-07-24 betabug

FreeBSD 8.1 RELEASED
2010-07-24 Evilcoder

FreeBSD 8.1-RELEASE Available
2010-07-23 FreeBSD latest news

Announcing Tornado 1.0
2010-07-23 Ramble on

Sauna Sprint just around the corner
2010-07-22 plone.org news

April-June, 2010 Status Report
2010-07-22 FreeBSD latest news

O culeiro
2010-07-21 emereci

Limitando usuarios ssh en Mercurial
2010-07-21 userlinux.net

The Wire
2010-07-20 emereci

Comienza la mudanza, nos vamos a Reading
2010-07-18 blackshell

Recent Trackbacks
Categories
OpenBSD (8 items)
BSD (0 items)
FreeBSD (12 items)
Linux (2 items)
Security (3 items)
Python (18 items)
Zope (13 items)
Daily (120 items)
e-shell (8 items)
Hacks (7 items)
PostgreSQL (3 items)
OSX (7 items)
Nintendo DS (0 items)
enlightenment (0 items)
Apache (3 items)
Nintendo Wii (0 items)
Django (23 items)
Music (9 items)
Plone (7 items)
Varnish (0 items)
Lugo (1 items)
Sendmail (-1 items)
europython (7 items)
Archives

Syndicate this site (XML)

RSS/RDF 0.91

05 noviembre
2007

OSx, core files and disk space

or how you will miss your disk space...
[OSX] 

OSx has its roots in the Unix world. It is based on Mach 3.0 and FreeBSD 5, so you could expect some Unix-like behaviour from it.

One of those things that have been laying around in the Unix lair for a loooong time are cores or core dumps. A core is a file that appears when an application crashes, usually with a segmentation fault or some other kind of ugly error. Inside that file, if you use some proper application to examine it, you will find a memory dump, that is, the in-memory space using by the application while it was running.

As I've said, using tools like ddd or gdb you could learn a lot about how and why the application crashes, and that information is very important when doing software development.

The problem with that core files is that they are usually very big, that is, something between 300Mb and 1Gb (depending on the ammount of memory in your computer). That means that when a core appears, a lot of space is wasted (well, at least wasted if you are not a developer debugging some app).

In other systems like FreeBSD, OpenBSD or some Linux distributions, those core files appeared inside the directory from which the application is called, which in most cases is the home of the user running the application. That's fine, because you will notice those big files and you can delete them whenever you want.

In OSx the core files are saved somewhere else, in a someway hidden directory, called /cores (well, not completely hidden, but difficult to find for non-expert users). That was my case 2 days ago, while doing some housekeeing work in my Macbook, I found that directory wasting around 1Gb of disk space:

snowball:/ Wu$ sudo du -sh *

[ ... ]

1.0G    cores

[ ... ]

snowball:/ Wu$ ls -l cores/
total 2110848
-r--------   1 Wu  admin  152924160 Feb 27  2007 core.1216
-r--------   1 Wu  admin  168681472 Feb 21  2007 core.24998
-r--------   1 Wu  admin  168681472 Feb 21  2007 core.25018
-r--------   1 Wu  admin  590467072 Apr 16  2007 core.8464
snowball:/ Wu$

As you probably noticed, the core files are quite older, from February and April, and I do not need them anymore, so I deleted them directly:

snowball:/ Wu$ rm -f cores/*
snowball:/ Wu$

(remember to use the -f switch, because they are protected read-only)

In my case it wasn't a big deal, it was only a matter of 1Gb, but getting more crashes will mean more core files, and the filesystem being filled with some data probably you will never use. So it is a good idea to take a look inside /cores from time to time, and delete the cores you do not need.

The other option is to prevent OSx from creating core files at all, we can achieve that using sysctl:

snowball:~ Wu$ sysctl kern.coredump
kern.coredump = 1
snowball:~ Wu$

That means core dump creation is activated, we can disable it manually:

snowball:~ Wu$ sudo sysctl -w kern.coredump=0
kern.coredump: 1 -> 0
snowball:~ Wu$ sysctl kern.coredump
kern.coredump = 0
snowball:~ Wu$

And then adding one line to /etc/sysctl.conf so dump creation keeps disabled on the next reboot:

kern.coredump=0

Posted by wu at 18:59 | Comments (0) | Trackbacks (0)
<< Problems with COREBlog and page encoding | Main | MiniPlanet, a Mini Feed Aggregator for Zope >>
Comments
Re: OSx, core files and disk space

Great tip, I dunno about the /cores/ dir, I must check that when I arrive at home.

Posted by: r0sk at noviembre 07,2007 12:10
Trackbacks
Please send trackback to:http://blog.e-shell.org/14/tbping
There are no trackbacks.
Post a comment