Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

My OS is Ubuntu 12.04. As System Monitor shows, "free" for my $HOME is 1.6GiB, but "Available" is 222.7 MiB and is keeping slowly decreasing from around 750 MiB yesterday. I am not aware that I am adding more data to $HOME.

So I would like to know

  • how to find out the reason that causes that, e.g.,is there some running application that is using the space of $HOME as temporary storage place and therefore can be freed up?

  • how to find out which directory or file is increasing its size?


To Ignacio

~/.xsession-errors is only 21330862 bytes. Some of its last content is

> ** (zeitgeist-datahub:2116): WARNING **: recent-manager-provider.vala:133: Desktop file for
> "file:///windows-d/academic%20discipline/study%20objects/areas/formal%20systems/logic/generalize%20to%20when%20inference%20is%20uncertain/uncertainlize%20deductive%20logic/statistics/general/Kalbfleisch/vol2/all.djvu"
> was not found, exec: plugin-container, mime_type: image/vnd.djvu
> 
> ** (zeitgeist-datahub:2116): WARNING **: recent-manager-provider.vala:133: Desktop file for
> "file:///windows-d/academic%20discipline/study%20objects/areas/formal%20systems/logic/generalize%20to%20when%20inference%20is%20uncertain/uncertainlize%20deductive%20logic/statistics/general/Montgomery/prob%20and%20stat%20in%20Eng/4ed.pdf"
> was not found, exec: plugin-container, mime_type: application/pdf

To Karlson

$ df -kh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda7        21G   15G  4.8G  76% /
udev            949M   12K  949M   1% /dev
tmpfs           383M  988K  382M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            956M  184K  956M   1% /run/shm
/dev/sda2        71G   47G   24G  68% /windows-c
/dev/sda3       110G  101G  9.9G  92% /windows-d
/dev/sda6        27G   26G  223M 100% /home
/dev/sda1       1.2G  658M  543M  55% /media/SYSTEM_DRV
share|improve this question
    
What else is using the same filesystem as your $HOME? –  Karlson Jul 1 '13 at 16:54
    
I am not sure. I am running evince, djview, gedit, terminal, firefox. The first three are dealing files on other partitions than $HOME. –  Tim Jul 1 '13 at 16:57
    
Can you post output of df -kh? and cd $HOME ; df -kh . –  Karlson Jul 1 '13 at 17:00
    
@Karlson: see my edit –  Tim Jul 1 '13 at 17:02

4 Answers 4

You have to apply some science to this. Since /home is on a separate filesystem you should start running checks where the space actually is:

cd $HOME
cd ..
sudo du -skh .[!.]* *

Which will give you the largest users of the filesystem. Then you drill down in the each of the users of the system and repeat the:

sudo du -skh .[!.]* *

Which eventually will give you the files or the bottom level directories with largest usage, which may need to be cleaned up.

Further, there are occasions when you run the system that you may remove log files that are still open, which will create "ghost" files which will take up space while the process is up and running. But as soon as it is killed the space will be released you can use:

lsof | sort -n -k7

You can play with lsof options to have the formatting correct and see the largest file(s).

share|improve this answer
    
Thanks! sudo du -skh * doesn't output those directories started with ., i.e. those hidden directories? The sum of sizes of those output by the command is much less than the "Used" size shown by System Monitor. –  Tim Jul 1 '13 at 17:23
    
Edited the command to include the hidden directories. And if the size used is much less then the one in the monitor you're likely to have a "ghost" –  Karlson Jul 1 '13 at 17:26
    
Can the output of sudo du -skh .[!.]* * be sorted from large size to small size? –  Tim Jul 1 '13 at 17:35
    
One suspicious item is du: cannot access .gvfs': Permission denied. Other items seem to have moderate sizes. But I cd into it and there are not files there. –  Tim Jul 1 '13 at 17:37
    
@Tim sudo du -skh .[!.]* * | sort -h should be useful. sort -h or --human-numeric-sort is explained as compare human readable numbers (e.g., 2K 1G). Using it just like that will sort the largest files or directories toward the bottom, which should give you a good starting point since it's the biggest ones that you are interested in. –  Michael Kjörling Jul 1 '13 at 21:25

Make sure that lsof -s | grep deleted is not showing something in /home that has been deleted.

If it is, just kill that pid according to what lsof -s output (second column is pid), then delete the file according to the inode given (inode being the 8th column of lsof -s) by doing find . -inum inode_number -exec rm -i {} \;.

This could happen if you were logging something or running a tail -f on a file and then removed it.

share|improve this answer

I found a while back that one of my GUI applications was generating gigabytes of errors and outputting them to stderr, which under X goes to ~/.xsession-errors. Do a tail -f against it to see if it's exploding.

share|improve this answer
    
Thanks. ~/.xsession-errors is only 21330862 bytes. Some of its last content see edit to my post. –  Tim Jul 1 '13 at 17:00
    
how to find out which directory or file is increasing its size? –  Tim Jul 1 '13 at 17:08

While du and friends are handy on the command line, sometimes it's useful to use GUI apps to easily visualize the problem.

I suggest you take a look at the GNOME Disk Usage Analyzer to get an idea of where the most space is being consumed. This of course assumes you have a GNOME desktop running (unity works fine also).

If you're in unity, open the search lens and start typing "disk" and the utility should pop-up.

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.