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.

I use WinSCP to upload my website's pages to a remote Ubuntu Linux server (VPS xen hosting). When I copy a file, it is written in the server with size=0. When I checked the free disk space: df -h I got: /dev/xvda with Avail=0% and Used=100% I tried to check for deleted files with: lsof | grep '(deleted)' But the lsof command is not found. What can I do next?

share|improve this question
    
Do you have the privileges to install lsof? –  cjc May 16 '12 at 9:47
    
Yes, but there is no disk space... –  Joe May 16 '12 at 10:19

4 Answers 4

up vote 2 down vote accepted

I tried: sudo du -h --max-depth=1 ./ And iterating down the tree, found that /srv/www/mysite.com/logs/access.log has size of 13G!!!! I deleted access.log with rm access.log. But df -h steel reports /dev/xvda 0% avail... Should I do anything else to finally delete the file?????

Now lsof should report deleted file. You should send HUP signal to http server using

/etc/init.d/apache2 reload

In the future avoid this by editing /etc/logrotate.d/apache2 (enter correct path for your logs)

share|improve this answer
    
Is there a way to limit the size of access.log file, so I can avoid this mess? –  Joe May 16 '12 at 11:20
    
As I mentioned look at logrotate file. It will hold only logs for the last XX days (rotate XX). Moreover logs older than 2 days will be archived. –  krogon May 16 '12 at 11:28

The lsof command looks like it only lists files that are about to be deleted (because they are in use). Maybe lsof exists but is not in your path - try searching for it.

You could:

  • delete files you don't need: try looking for large directores or files - see the command 'du'.
  • ask for more space from the provider
share|improve this answer
    
I tried: sudo du -h --max-depth=1 ./ And iterating down the tree, found that /srv/www/mysite.com/logs/access.log has size of 13G!!!! I deleted access.log with rm access.log. But df -h steel reports /dev/xvda 0% avail... Should I do anything else to finally delete the file????? –  Joe May 16 '12 at 10:48

/dev/xvda is a disc path. Partitions should end with some number (ex. /dev/xvda1). Check in df in the last column if it is your root or home partition. "Avail=0%" tells you probably run out of free space. Check what is taking to much space using

du -sm <path>

For your home directory it would be

du -sm $HOME/*
share|improve this answer
    
/dev/xvda is mounted on / –  Joe May 16 '12 at 10:22
    
sudo du -sm / results with: cannot access '/proc/22858...' errors –  Joe May 16 '12 at 10:23

You can use this command to find out what file or directory is using most of disk space

du -hsx * | sort -rh | head -10

The command work in the directory where you will start it. It shows 10 biggest files/directorys.

Use it on directory that you have suspicion that files in there are to big ie /var/log/ your home directory.

If you find nothing then something maybe wrong with your hdd.

UPDATE: If you have perl installed you can use this one liner:

du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'

share|improve this answer

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.