PDA

View Full Version : Analyzing Disk Storage Usage



bpk
12-11-2007, 08:05 AM
I've noticed in the past week or so, the disk usage on a site has really spiked. I've had to allocate more space to this specific account. The site is running off MySQL and PHP. There haven't been any significant changes to the site, no public FTP or anything like that. So how would be the best way to figure out what is using up the most of the storage space? Anyone have any analysis techniques?

wildjokerdesign
12-11-2007, 02:46 PM
Has email increased on this account? Remember that counts against disk usage. What type of PHP are you running? Is it a membership site or forum where perhaps people are uploading attached images? Has bandwidth usage also increased? That would increase the size of the logs although that should not have affected your diskspace usage so much that you had to increase it unless for some reason log rotate is not running.

hpham
12-11-2007, 03:00 PM
You can login via SSH and run 'du' to find directory sizes and figure out which one is using the most space. Only issue is that du will be a pain to run on individual directories, so you may want to pipe the output to sort to sort by largest directories...

To sort directory sizes (ascending order):

du / -b | sort -n

To sort, and only return the top 50 largest directories:

du / -b | sort -n | tail -n 50

Note that du will take a while to run (around 1 minute for me). It will then take a while to dump everything to your screen...

Harrison

WestHost - MCox
12-18-2007, 01:30 PM
bpk,

The most common directories for disk usage to start accumulating are the following:

/var/spool/mail/ (POP mail accounts)
/var/spool/imap/ (IMAP mail accounts)
/var/log/ (log files)
/ftp/pub/anonymous/ (anonymous ftp)

Also, any directories where images are stored often tend to start holding a lot of data if not well maintained.