3

I'm used to the du command. I often use it with -h option. I report the result in a text file which I use to track space consumers.

But I was wondered today to see a directory being reported as using 32 PB (PetaBytes). That's a lot on a 128 GB disk ....

So, my question is: Is this a bug in du command or in the du -h flag ? And what additional check might I conduct on the FS knowing that the ls command also reports some abnormal amount :


Shell = /bin/bash,
Path =  ~/.../data  > ls -la
total 39582418599960
drwxrwxr-x 2 user user  4096 jan  4 09:49 .
drwxrwxr-x 4 user user  4096 jan  4 09:49 ..
-rw-rw-r-- 1 user user 11330 jan  4 09:49 Fortress.dat
-rw-rw-r-- 1 user user    54 jan  4 09:49 villages.dat

If I use other options with the ls command, result differs :


Shell = /bin/bash
Path =  ~/.../data  > ls -l
total 16
-rw-rw-r-- 1 user user 11330 jan  4 09:49 Fortress.dat
-rw-rw-r-- 1 user user    54 jan  4 09:49 villages.dat

If I use du -a, I see the problem is on the current directory. That's why a simple ls -l doesn't report the problem (it doesn't include the current directory in its report) :


Shell = /bin/bash
Path =  ~/.../data  > du -a
12  ./Fortress.dat
4   ./villages.dat
39582418599956  .

Here are a few characteristics of my disk :


Disque /dev/sda : 128GB
Taille des secteurs (logiques/physiques): 512B/512B
Table de partitions : msdos

Numéro  Début   Fin    Taille  Type      Système de fichiers  Fanions
 1      1049kB  124GB  124GB   primary   ext4                 démarrage
 2      124GB   128GB  4083MB  extended
 5      124GB   128GB  4083MB  logical   linux-swap(v1)

Meanwhile, I read about "sparse" files which may change the reported size of the files. What I don't understand here is that the problem seems to be on a directory ... Are there sparse directories ??

Apart from this, there is no problem reproted on my SDD.

Thank for any advice ... Marc.

4
  • 2
    That looks like file system corruption to me; could you sudo touch /forcefsck and reboot to make sure? This will force a fsck of your file systems... Mar 25, 2015 at 13:26
  • Bingo ! This is it ! But where do I find the error message of fsck ? I looked at dmesg but didn't find anything convincing ... And in /var/log/fsck, the files are empty.
    – Marc
    Mar 25, 2015 at 13:50
  • While it's checking file systems, fsck doesn't really have anywhere to log messages; all you can do is read them as they are printed on screen. I'll add my comment above as a proper answer. Mar 25, 2015 at 13:58
  • Thanks for your answer, Stephen. Yes, it is obvious, nowhere to log during fsck as filesystem is not mounted. My Xubuntu just showed me a splashscreen during the fsck process. And I didn't get the time to swith to any console to check if something was written.... have a good day.
    – Marc
    Mar 25, 2015 at 14:11

1 Answer 1

3

That looks like file system corruption to me; to fix it, do

sudo touch /forcefsck

and reboot. This will force a fsck of your file systems.

You must log in to answer this question.

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