Help, Where did all my drive space go?
Saturday, August 11th, 2007I noticed this week a big problem with my OS X Server. The finder was telling me that I only had 3 gb available. I counted the size of all the folders in my drive and it looked like I only had used about 15 gb so I should have 45 gb of free space. Some how I was losing 45 gb of space I no mater what tools I used I could not find was was stealing my hard drive space. On top of this my drive was filling up fast. Each day I lost more and more of the drive space. Soon this drive would be full.
I tried calling apple and their only suggestion was to format the drive. Since this was my server I dreaded this option. Luckily before I reported the brutality of a reformat I did a little creative googling. I found a few different forum posts that when used together saved my sanity..
The first command which found where the problem files were is:
In the terminal type (this command takes a long time to complete):
sudo /usr/bin/find -x / -size +40000000c -exec /bin/ls -lh “{}” \;
That command will find and list all the large files on your hard drive.
In my case the problem was a bunch of MYSQL Replication bin log files that were over 1 gig each.
To delete the old mysql_binary_log files I ran this command in mysql:
Login to mysql: mysql -u username -p
Then type
PURGE MASTER LOGS BEFORE DATE_SUB( NOW(), INTERVAL 5 DAY);
That command will remove any bin that are older then 5 days.
Running that one line command save me countless hours of work.
I has a similar problem with my relay logs on one of my slave servers.
running the command:
sudo /usr/bin/find -x / -size +40000000c -exec /bin/ls -lh “{}” \;
showed me that my problem was with my relay logs.
Im not sure that this is the right way to fix the relay log problem but it worked in my situation:
type in mysql:
change master to master_host='’”;
This changes the master host and deletes the old logs. This may not be how you want to do this because you might need restart replication.
