[olug] Reduce Directory Size

Jon H. Larsen relayer at omahadirect.net
Tue May 20 16:10:10 UTC 2003


Actually, Logrotate is how I noticed that the directory was getting rather 
large.  Due to the large number of mgetty.log.ttyS0.* files in the 
/var/log/ folder, logrotate was having problems parsing the directory to 
work on the log files.

I found a paper yesterday that mentioned the need for 'Planned Coalesce on 
Delete'.  <http://lwn.net/2001/0412/a/index-format.php3>

An excerpt reads:
"[9] One can imagine a directory-compacting utility but in practice it
would probably be seldom used and not worth the effort, a possible
exception being embedded applications.  Even in that case, what we
probably want is a compressed filesystem."

As well as:
Planned Coalesce on Delete
--------------------------
Historically, Ext2 directories have been "grow-only"; deleting files
never shortens the directory.  The current implementation ...

I'll go with the create new folder method.

Jon L.

On Mon, 19 May 2003, Vincent wrote:

> Date: Mon, 19 May 2003 12:57:22 -0500
> From: Vincent <vincentr at cox.net>
> Reply-To: Omaha Linux User Group <olug at olug.org>
> To: Omaha Linux User Group <olug at olug.org>
> Subject: Re: [olug] Reduce Directory Size
> 
> Are you using logrotate?  Logrotate (properly configured) will cycle out old data and gzip them if you want.
> For compression, I would prefer to let the kernel (ext# filesystems) handle it so I don't have to manually uncompress old files to
> view them.  Check out the "c" option in the chattr/ lsattr man pages.
> 
> Here's an example of how I make sshd log separately and rotate the log files with logrotate:
> [user at host ~] cat /etc/logrotate.conf
> # rotate log files weekly
> weekly
> # keep 12 weeks worth of backlogs
> rotate 12
> # create new (empty) log files after rotating old ones
> create
> # uncomment this if you want your log files compressed
> #compress
> # RPM packages drop log rotation information into this directory
> include /etc/logrotate.d
> # no packages own wtmp -- we'll rotate them here
> /var/log/wtmp {
>     monthly
>     create 0664 root utmp
>     rotate 1
> }
> 
> [user at host ~] cat /etc/logrotate.d/sshd
> /var/log/sshd {
>     missingok
>     notifempty
>     sharedscripts
>     postrotate
>         /bin/kill -HUP `cat /var/run/sshd.pid 2>/dev/null` 2> /dev/null || true
>     endscript
> }
> 
> [user at host ~] grep LOCAL6 /etc/ssh/sshd_config:
> SyslogFacility LOCAL6
> 
> [user at host ~] grep LOCAL6 /etc/syslog.conf:
> local6.*;auth.*;authpriv.*                              /var/log/sshd
> 
> ----- Original Message ----- 
> From: "Jon H. Larsen" <relayer at omahadirect.net>
> To: <olug at olug.org>
> Sent: Monday, May 19, 2003 9:47 AM
> Subject: [olug] Reduce Directory Size
> 
> 
> > Howdy,
> >
> > I discovered this morning that my /var/log directory had grown to 18 Meg,
> > mostly due to many thousands of mgetty.log.ttyS0.* entries.  I found a
> > great perl script to clean out the files, but now I'm left with a rather
> > large directory structure that I would like to reduce in size.
> >
> > Here is what the directory looks like:
> >
> > drwxr-xr-x    6 root     root     19300352 May 19 09:13 log
> >
> > Here is where I found the perl script to help clean the dir:
> >
> > http://rattler.cajuninc.com/pipermail/pbml/2003-February/000095.html
> >
> > One way I thought about was to drop to runlevel 1, make sure the
> > syslog daemon isn't running, move /var/log/ to /var/oldlog, create a new
> > /var/log folder, and move the proper files back from /var/oldlog and go
> > back to runlevel 3.
> >
> > Is there another way to do this? Will running e2fsck on the filesystem
> > reduce the directory size?  Is there a switch that is used?
> >
> > Any way to tell mgetty to stop all the logging?
> >
> > This box is headless, with Serial Console enabled.
> >
> > Jon L.
> >
> >
> >
> > -- 
> >  [ Jon H. Larsen  - email: relayer at omahadirect dot net         ]
> >  [ ICQ#: 10412618 - http://www.animesunday.org/jonl               ]
> >  [ PGP Pubkey - http://www.animesunday.org/jonl/relayerpubkey.txt ]
> >  [ OpenOffice.org - Freedom at Work - http://www.openoffice.org   ]
> >
> > _______________________________________________
> > OLUG mailing list
> > OLUG at olug.org
> > http://lists.olug.org/mailman/listinfo/olug
> >
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
> 

-- 
 [ Jon H. Larsen  - email: relayer at omahadirect dot net         ]
 [ ICQ#: 10412618 - http://www.animesunday.org/jonl               ]
 [ PGP Pubkey - http://www.animesunday.org/jonl/relayerpubkey.txt ]
 [ OpenOffice.org - Freedom at Work - http://www.openoffice.org   ]



More information about the OLUG mailing list