where is my disk space?

If you delete an open file, the file itself is not deleted, only its name. The space is only reclaimed when the file is closed by whatever process is writing to it, therefore the deleted file continues to exist and to grow.

If a process still has the file open after you 'deleted' it, you can find out what process is using it:

lsof | ( grep -n 1 '.' ; grep '.xsessions-errors' )

The output will be something like this:

COMMAND                PID   USER  FD   TYPE  DEVICE  SIZE/OFF     NODE  NAME
problematic-program   1234  auser   4u   REG   252,2         0  1967438  /home/auser/.xsession-errors (deleted)

To see how much space the 'deleted' file is now taking:

ls -l /proc/1234/fd/4

Where 1234 is the PID shown above, and 4 is the FD. Once you know the problematic-program, you can troubleshoot from there.


Having used lsof to identify a list of programs that have .xsession-errors open for writing, you need to shut down and restart each of those programs. If necessary you can shutdown and restart the system though this isn't strictly necessary.

If a log file grows fast, the ideal solution is to find out why and address that problem (e.g. some resources are missing). However if you prefer you can redirect the errors to /dev/null using the method described at https://askubuntu.com/questions/93718/how-do-i-prevent-xsession-errors-from-eating-disk-space