Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

my server 99% full disk folders would like to know I can remove without damaging my server.

the problem I have esque 30GB disk space and I have no idea as me to run out of space on my drive, my website only 1GB of space

share|improve this question

migrated from stackoverflow.com Jan 30 '12 at 6:16

This question came from our site for professional and enthusiast programmers.

1  
It's your data. You decide what you want to destroy. –  sarnold Jan 30 '12 at 2:33
    
Yes, but the problem I have esque 30GB disk space and I have no idea as me to run out of space on my drive, my website only 1GB of space –  Pardo Gamez Gerson Jan 30 '12 at 2:57

1 Answer 1

up vote 4 down vote accepted

30GB disk space and I have no idea as me to run out of space on my drive, my website only 1GB of space

Okay, here we go, something concrete.

First things first, go find what is taking up all your space. If you're not properly expiring old logs, they are a prime candidate for taking up too much space without being too beneficial. Check /var/log/ or whatever else directories your might have configured to store your log files. (Some shared hosting environments may pick ~/httpd_logs/ or something similar. Look around.)

If you want to keep your old logs for analysis, compress them:

gzip -9 *.[1-9]

Many systems rotate logs through access.log to access.log.0, then move .0 to access.log.1, then move .1 to access.log.2, etc. So the above command compresses them all with gzip(1)'s highest compression level (plain text log files tend to compress really well). Then you can transfer them off your small storage hosting environment for analysis. Don't forget to delete them once you're done -- once you take them out of rotation, they'll never get cleaned up automatically.

Then go hunting for space more generally:

du -m | sort -n

The last line of this will represent the directory with the largest amount of stored data underneath it. Lines earlier in the output are less full. This output will show you which ones will give you the best improvements for your time. (This won't necessarily be the ones that you should delete, but getting rid of one needless one-gigabyte file is way more effective than getting rid of one hundred one-megabyte files.)

share|improve this answer
    
+1, partly for a good answer and partly because it felt wrong to leave you with a rep of 666. :) BTW, don't forget to check what's in /tmp. –  John Gardeniers Jan 30 '12 at 9:11
    
@John: Good point about /tmp, I learned some bad habits from my first ISP that let anyone use /tmp without quota and the full knowledge that it might all go away any second. It only takes losing everything in /tmp on reboot once to learn that those habits were mistakes. :) –  sarnold Jan 30 '12 at 22:36
    
I learned a slightly different lesson, cause by /tmp not being cleaned out periodically. :( –  John Gardeniers Jan 31 '12 at 0:18
    
@John: hehe, also a lesson worth learning. Hope it didn't cause too much trouble. –  sarnold Jan 31 '12 at 0:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.