0

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?

2
  • Do you have the privileges to install lsof?
    – cjc
    Commented May 16, 2012 at 9:47
  • Yes, but there is no disk space...
    – Joe
    Commented May 16, 2012 at 10:19

4 Answers 4

2

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)

2
  • Is there a way to limit the size of access.log file, so I can avoid this mess?
    – Joe
    Commented May 16, 2012 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
    Commented May 16, 2012 at 11:28
0

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
1
  • 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
    Commented May 16, 2012 at 10:48
0

/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/*
2
  • /dev/xvda is mounted on /
    – Joe
    Commented May 16, 2012 at 10:22
  • sudo du -sm / results with: cannot access '/proc/22858...' errors
    – Joe
    Commented May 16, 2012 at 10:23
0

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);}'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .