

If you still haven't enough space than you can repeat step 4 in the larges subdirectories which are displayed at the bottom of the list.īut what happened if the du output is not approximately the available space displayed by df? It won't solve your problem if you delete them. Don't bother about the small directories on the top of the output. If you have found a large file/directory that you don't need anymore you can remove it in an appropriate way. The largest files/subdirectories will be shown at the bottom of the output. The -k option forces du to output the sie in kilobyte without any unit. To find the largest subdirectories of a directory /./dir use du -sk /./dir/*|sort -n If so, you can start to find the large files/directories of the /myfilesystem filesystem to clean up. Now check if the du of the visible files is approximately the size of the used space displayed by df.

Then you have to use some workarounds to find the du of your filesystem. Solaris) do not know the -x option for du. The -x option may be used to guarantee that only the files that are member of this filesystems are taken into account. If so, the following speps must be adapted to this situation.įind out how much space is used by the files of this filesystem du -sh /myfilesystem check the df output if there are filesystems mounted on subdirs of /myfilesystems.
#Windows needs more disk space full#
Assume that the full filesystem is /myfilesystem. You only waste time if you investigate filesystems that have enough space.
#Windows needs more disk space free#
Will list all filesystem, their size and their free space. I don't know Ubuntu and can't check my answer but post here my answer based on my experience as unix admin long time ago.įind out which filesystem runs out of space df -h Just append this to the end of the command: | sort -h You can sort the output of the du command so that the highest value is at the bottom. Skip directories on different file systems Man page description of that flag: -x, -one-file-system If you know which drive is the issue and it has other mounted drives on top of it that you don't want to waste time including in your search, you could add the -x flag to your du command. If you absolutely don't want any of the K valued directories showing up you'd want to up your regex game to be more creative and complex.

However, it should still provide valid output for the rest of the directories in root. You may get some errors on /proc, /sys, and/or /dev since they are not real files on disk. If your disks are big enough, you could add |T as well to include Terabyte amounts. The grep is to limit the returning lines to those which return with values in the Megabyte or Gigabyte range.

I start by running this as root or with sudo: du -cha -max-depth=1 / | grep -E "M|G" However, if you need to do it from CLI, this is my preferred method: As always in Linux, there's more than one way to get the job done.
