| Although every care has been taken to provide accurate information, I do not warrant the accuracy or completeness of the information included in this website. Any use, or reliance on, such information is entirely at user's own risk. |
Disk Space Reclamation
Over time, you will lose disk space to several causes. To recover some space, look at the following:
Trimming Log Files
There are many log files that need to be trimmed from time to time.
|
/var/adm/syslog/syslog.log
/var/adm/syslog/mail.log
/var/adm/wtmp
/var/adm/cron/log
/var/adm/lp/log
|
Temporary Files
There are many reasons why temporary files aren't cleaned up automatically after they are no longer needed; therefore you may have to manually delete them to recover disk space.
|
/var/tmp/
/tmp/
/var/spool/mqueue/ #Undelivered mail
You can have cron clean-up temporary files on regular intervals. Add the following line below to /usr/spool/cron/crontabs/root to have cron every morning at 3am delete temporary files older than 7 days (based on modified date). You can always add other temporary directories if you have them.
NOTE: Use crontab -e instead of vi when editing cron jobs.
G in a vi (or crontab -e) editing session puts you at the end of the file.
o tells the editor to add a line below the cursor.
:wq! tells the editor you want to (w)rite (q)uit (!)readonly file.
First column, 0, tells cron to run the job at 0 minutes past the hour.
Second column, 3, tells cron to run the job at 3am (cron uses military time, 0-24hours).
Third column, *, tells cron to run the job every day of the month.
Fourth column, *, tells cron to run the job every month.
Fifth column, *, tells cron to run the job every day of the week.
Sixth column, find /var/tmp -name -mtime +7 | xargs rm, is the actual command that will be executed (always use absolute paths in cron commands).
To verify that the new job has been scheduled, issue crontab -l to list the cron jobs.
|
|
|
Core Files
Core files are created after an unexpected application or system crash. If you don't plan on analyzing core files, you can delete them to recover space. Core files can be very large (they are the size of the amount of memory that the process took up).
|
To prevent core files from being created (and possibly eating up all available disk space in the /home file system), create symbolic link in users home directories called core and point it to /dev/null. That way when a core file is created, it is sent to limbo (/dev/null).
|
|
|