Freeing up space in /var

{n00b questions}

Today I discovered that /var maxed out (i.e., 100% full). The space hogs were MySQL database files and the contents of /var/db/pkg/. So I did this to move the database files:

# /usr/local/etc/rc.d/mysql-server stop
# cd /var/db
# mv mysql /usr/local/
# ln -s /usr/local/mysql mysql
# cd /usr/local
# chown -R mysql mysql
# /usr/local/etc/rc.d/mysql-server stop

And this to move the pkg files:

# cd /var/db
# mv pkg /usr/local/
# ln -s /usr/local/pkg pkg

Then, back in /var I run # du -sk * and things look a LOT better. However, when I run # df, it still shows that /var is (nearly) full. I looked at # man df to see if it follows symbolic links, but I couldn't determine if it did.

So, two questions come from today's activities:

1. Did I "properly" move the database and pkg files? Is this a "best practice"?
2. Can # df report usage without following links?

Thanks!

- Larry
 
Did you stop MySQL before moving the files ? If you didn't, as the files are still opened by MySQL, the space they use on disk will not be reclaimed.
 
Yes...

# /usr/local/etc/rc.d/mysql-server stop
snip
# /usr/local/etc/rc.d/mysql-server stop

And MySQL started back up with no complaints.
 
Okay... I understand now. I did the quick and dirty method: # reboot

Now everything appears in order. I ordinarily don't like rebooting, but this server is just a week old and isn't used by many people yet.

Thanks!
 
Back
Top