What could be eating up my entire hard drive space ? (650GB)

6,129

Solution 1

Yes, your binlogs take up a lot of space - especially right after setting up replication.

You can configure how long these are kept around in /etc/mysql/my.cnf, using expire_log_days

Note that if there is a problem with your binlog index file, this setting will appear to not work. I believe you can just manually ensure the contents of the index file match all of the existing binlog file names to resolve this.

Solution 2

This tends to work better (start in / if you're root):

du -sm * | sort -nr

That way you get your top offenders at the top of the list. Then you can drill down on the obvious offenders first and find the true source of your full disk issues.

In general, it is real handy to set up cron scripts using that to audit things like home and share directory trees. Run that in home, and you can easily identify the logins of the file hogs...

Things like running find are ok, but what happens if you have an app that is rotating (but not deleting) logs on a daily basis, no one knew about it, and 3 years have gone by? Small files add up too...

Solution 3

The du (disk usage) command is your friend. Try something like:

du -h --max-depth=1 /home

...where -h is "human readable" and -max-depth controls how many subdirectories deep you'd like to go.

Share:
6,129

Related videos on Youtube

Alex
Author by

Alex

Updated on September 17, 2022

Comments

  • Alex
    Alex over 1 year

    I only have a database , which is around 40G. I did have some problems with replication earlier....could it be some sort of log/files that are eating it up?

    How do I check why the space is taken up?

    I'm using Ubuntu, the latest version. I don't have a GUI. everything is command line. The only thing that is running is mysql.

    • jscott
      jscott over 14 years
      May help to indicate which OS [and apps] you're running. :)
  • Alex
    Alex over 14 years
    How do I know where my bin-logs are located?
  • Alex
    Alex over 14 years
    How do I sort it by sizez?
  • Knut Haugen
    Knut Haugen over 14 years
    Doing a 'df -h' first to see which file system is more full can narrow it down some more, and the running the above command to find the culprits.
  • phirschybar
    phirschybar over 14 years
    Look in your /etc/mysql/my.cnf file for a log_bin variable. That will tell you where they are being stored. I think for Ubuntu they are under /var/log/mysql by default.
  • phirschybar
    phirschybar over 14 years
    also, you could run "du -cks *|sort -rn|head" in your /var/log subdirectory to determine exactly how much space your logfiles are actually taking up - and confirm whether or not this is your problem.