Reputation:
I have used du -h
and df -h
, but I cannot seem to determine what actual files are taking up space. When I remove the files df -h
still says that the disk is full. Also when I delete the files based on du -h
, the space for sda2 does not decrease.
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 13G 12G 0 100% /
/dev/sda1 251M 21M 218M 9% /boot
tmpfs 1006M 0 1006M 0% /dev/shm
Upvotes: 3
Views: 9104
Reputation: 803
You can recursively search for files that are bigger than a certain size. For me, this command was very nice to resolve a disk-space problem:
find / -type f -size +100M -exec du -h {} \;
find /
: This part tells the find command to search the entire filesystem starting from the root directory (/).type f
: This option specifies that find should only look for regular files (not directories, symbolic links, etc.).size +100M
: This option tells find to only find files larger than 100 Megabytes (M). The + sign indicates "greater than".exec du -h {}
;: This part executes the du -h command for each file found by find.
exec
: This option tells find to execute a command for each matched file.
du -h: This is the command to be executed. du calculates disk usage, and -h makes the output human-readable (e.g., shows sizes in GB, MB, etc.).{}
: This is a placeholder for the filename found by find. The ; terminates the command passed to -exec.Upvotes: 0
Reputation: 754450
The trick for finding the big files (that have names) is usually du -a
, often piped into sort -n
. This gives you the biggest files last (so it doesn't matter that the small files disappear off the top of the page).
You may have a process still running with a nameless file open that it is writing to when it gets the chance, that is eating up the space. This could be a temporary file that it opened to store data, or it could be a log file that someone removed. The space it uses won't show as free space, but neither will it show up as in use with du -a
(or any other options) because there isn't a file name. If you don't know which process it is, you could use a reboot to stop the process (all processes), thereby releasing the space.
Upvotes: 5
Reputation: 5392
Referring to the df
man page:
`--no-sync'
Do not invoke the `sync' system call before getting any usage data.
This may make `df' run significantly faster on systems with many
disks, but on some systems (notably SunOS) the results may be
slightly out of date. This is the default.
Since this is the default, I'm guessing that you're getting a cached view of free space.
Upvotes: 0