LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   interpreting output of "du" command? (https://www.linuxquestions.org/questions/linux-newbie-8/interpreting-output-of-du-command-816145/)

junglepunk 06-24-2010 11:23 AM

interpreting output of "du" command?
 
I am trying to figure out the dir size of one of my dirs, and as far as I can tell the du command is the most appropriate for the job. However it doesn't appear to scan recursively correctly so I'm running the command independently on my 3 most important subfolders. One of them produces this output:

Code:

DiskStation> du -sh /volume1/video/MOVIES
16777215.1T        /volume1/video/MOVIES

That seriously almost looks like the folder is 16777215 Terabytes in size!!! That can't be right? What's going on here?

Btw, if I run the "du" command on the parent directory, which is really what I'd like to do, then I only get this output:
Code:

DiskStation> du -sh /volume1/video
86.0G        /volume1/video

Note: This is NOT on my mac. This is a linux system.

pixellany 06-24-2010 11:28 AM

Do you really have a directory at the root level named "volume1"?

Try also "du -h <path>"---see if there is a particular subdirectory that's causing the issue

junglepunk 06-24-2010 11:36 AM

Yup, I do have a directory at root named "volume1" and the video dir is really inside of it.

Also, inside of the video dir there are an insane amount of sub-dirs when you get below the first two levels. The video dir has only 5 sub-dirs and all except one of them are larger than the 86G that the du command prints when I point it directly at the video dir. What am I looking for to spot an issue exactly?

mark_alfred 06-24-2010 11:39 AM

Your results are strange. Doing the the same thing on my system, it gives a larger size for the parent directory than for the subdirectory (which is what is expected if the parent directory contains additional items to the subdirectory):
Code:

mark@debian:~$ du -sh /home/mark/stuff
14G    /home/mark/stuff
mark@debian:~$ du -sh /home/mark
du: cannot read directory `/home/mark/board': Permission denied
19G    /home/mark
mark@debian:~$


druuna 06-24-2010 11:42 AM

Hi,

Only thing that comes to mind: Is MOVIES a none linux file system (NTFS maybe)?

I've read about issues with du and NTFS file systems, something to do with the way NTFS reports the asked information to du. Haven't seen any solutions though.

If MOVIES is a mounted FS, you can also use the df command df -h | grep MOVIES

Hope this helps.

junglepunk 06-24-2010 11:59 AM

Everything is ext3 formatted. As per your suggestion I tried using "df" instead of "du" but it produced the exact same result as "du". No change at all.

druuna 06-24-2010 12:15 PM

Hi,

Can I assume from your answer (#6) that MOVIES is indeed a mounted partition?

If so: Unmount it and check it using fsck, it could be that some repair work is needed.

Something like: fsck -y /dev/sxy0 (replace sxy0 with correct device). -y tells fsck to always try to repair found errors (if any).

Hope this helps.

junglepunk 06-24-2010 12:29 PM

No, sorry, it's not a mounted partition.

druuna 06-24-2010 12:37 PM

Hi,

Quote:

I tried using "df" instead of "du" but it produced the exact same result as "du".
The same as in the correct or the incorrect output?

If the incorrect output is shown, you should make sure that that specific partition is clean. Run the fsck command on that partition (do unmount it first).

Hope this helps.

junglepunk 06-24-2010 01:09 PM

Quote:

Originally Posted by druuna (Post 4013815)
Hi,

The same as in the correct or the incorrect output?

If the incorrect output is shown, you should make sure that that specific partition is clean. Run the fsck command on that partition (do unmount it first).

Hope this helps.

I don't quite follow you here. Basically this system has 3 HDD running in RAID 5. There is a couple of small system partitions and then there is a large file/storage partition where I keep all my files.

As per your first suggestion I tried copying the command you had written with "grep" and everything. That produced no output what so ever. So I simply wrote "df" into the terminal and it spat out a list of all my folders and their sizes, same as the du command does. And the filesizes of the du command and df command are the same.

druuna 06-24-2010 01:18 PM

Hi,

Ok, with the extra info given (this system has 3 HDD running in RAID 5. Should have been in your first post ;) ) my solution will not work.

Maybe this new info will trigger some other responses.

junglepunk 06-24-2010 04:22 PM

I just thought of something. What about symbolic links? Previously, the files that now exist in the video folder were only reference there by symbolic links. That is, there were no actual files in that dir previously, but then I moved all the files into the "video" directory without ever removing the symbolic links. Of course, the folder the symbolic links pointed to is now deleted so even if they were there they wouldn't point anywhere right? And besides, the "du" command is by defualt not supposed to follow symbolic links. Right?


All times are GMT -5. The time now is 11:58 PM.