0

I have this:

$ sudo du -hxd1 /var/log
20K     /var/log/nginx
4.0K    /var/log/lxd
16K     /var/log/unattended-upgrades
108K    /var/log/apt
4.0K    /var/log/sysstat
4.0K    /var/log/dist-upgrade
421M    /var/log/postgresql
27G     /var/log

However, none of the directories or files takes even a Gb of space. How can I find out what takes these 27 Gb?

1
  • 1
    can you try this command. it will list out the hidden files as well. du -sch .[!.]* * |sort -h
    – Kamaraj
    Feb 22, 2017 at 5:43

5 Answers 5

6

du only displays directory total sizes, not file sizes. Therefore, the files taking up multiple gigabytes would be in the /var/log directory, since the total of the directory is being listed at the end, not just the totals of its subdirectories:

$ du -hxd1
184K ./proftpd
80K  ./apt
4.0K ./fsck
12M  ./nginx
155M .

du -axh will list all files with human-readability, which can be sorted: du -axh | sort -h.

$ du -axh | sort -h # some entries snipped for readability
4.0K    ./proftpd/proftpd.log
4.0K    ./proftpd/proftpd.log.2.gz
8.0K    ./auth.log.2.gz
8.0K    ./auth.log.3.gz
8.0K    ./auth.log.4.gz
8.0K    ./faillog
12K     ./mail.warn
53M     ./mail.info.1
53M     ./mail.log.1
155M    .
1

Have you tried running " ls -alhS" while root and while in /var/log ? It could be an archived rotate file or something else being hidden by one process or other.

The above command will show all files/permissions and sort them by size . File sizes in K/M/G

0

Ok lets execute some of the commands and see what results I am expecting .This is from my own Unix Directory

du -mh /data/project/seth_support/seth 

it is bringing out all the contents of the files and directories inside seth & showing the size in Mb . The last line shows the total size of the Directory in Mb which is 930 MB. If I add up the sizes of the files & directories then it is coming to 930 MB as well.

Now

du -sh /data/project/seth_support/seth

also shows the last line and brings out the size of 930 MB as well .

In your case I am not sure of the command option du -hxd1 . When I am executing it shows invalid option . Please ask your System Admin about the unclear space of 27 GB .

0

You could try using the program ncdu, a disk usage analyzer with an ncurses interface. ncdu homepage

It will recursively start scanning directories from the provided start path (or the current directory if none is provided).

Highlights:

  • Small install size
  • No desktop required
  • Graphical representation of relative size
  • Can navigate directory structure
  • Can delete items
-1

“du” (Disk Usage) is a standard Unix/Linux command, used to check the information of disk usage of files and directories on a machine. The du command also displays the files and directory sizes in a recursively manner.

du -h /directory name (-h is for Human readable format . Means you can see sizes in Bytes, Kilobytes, Megabytes, Gigabytes etc.)

du -sh /directory name ( summary of a grand total disk usage size of an directory )

du -ah /directory name ( almost the same as -h)

du - k / directory name (in kilobytes)

du -mh / directory name ( in Megabytes)

There are even more options but the above is more frequently used .

4
  • 1
    This does not answer the question How can I find out what takes these 27 Gb? Feb 22, 2017 at 9:04
  • Please check the answer if it suffices you or else ask Sys Admin of the Server. Feb 22, 2017 at 9:40
  • U&L is a knowledge base; answers should be such that users having similar question could benefit from the answer. ask Sys Admin of the Server. is not the kind of answer that is wanted here. Feb 22, 2017 at 11:37
  • Sorry to disappoint ... I tried out my own and even gave the answer whatever feasible . I told to ask admin bcoz sometimes we ourselves do it from our side . Feb 22, 2017 at 12:13

You must log in to answer this question.

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