Truncating wtmp{,x}

wtmp{,x} files can grow to massive sizes on systems that do not rotate the files using log rotation software (e.g., logrotate, logadm).

# ls -l /var/adm/wtmp{,x}
-rw-r--r--   1 root     other   57193488 Aug  6 10:43 wtmp
-rw-r--r--   1 root     other  591931980 Aug  6 10:43 wtmpx

The shell commands listed here are an excellent way to reduce the size of wtmp{,x} with minimal system impact.


# cd /var/adm
# mkdir x; touch x/wtmp x/wtmpx; chmod 644 x/*; chown root:other x/*; ln wtmpx wtmpx.OLD; ln wtmp wtmp.OLD; mv x/* .; rmdir x
# gzip --best wtmp.OLD wtmpx.OLD

Back to
Last modified: 2007/08/06