LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-24-2010, 11:23 AM   #1
junglepunk
Member
 
Registered: Jun 2010
Posts: 41

Rep: Reputation: 15
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.

Last edited by junglepunk; 06-24-2010 at 11:24 AM.
 
Old 06-24-2010, 11:28 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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
 
Old 06-24-2010, 11:36 AM   #3
junglepunk
Member
 
Registered: Jun 2010
Posts: 41

Original Poster
Rep: Reputation: 15
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?
 
Old 06-24-2010, 11:39 AM   #4
mark_alfred
Senior Member
 
Registered: Jul 2003
Location: Toronto, Ontario, Canada
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572

Rep: Reputation: 210Reputation: 210Reputation: 210
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:~$
 
Old 06-24-2010, 11:42 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 06-24-2010, 11:59 AM   #6
junglepunk
Member
 
Registered: Jun 2010
Posts: 41

Original Poster
Rep: Reputation: 15
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.
 
Old 06-24-2010, 12:15 PM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 06-24-2010, 12:29 PM   #8
junglepunk
Member
 
Registered: Jun 2010
Posts: 41

Original Poster
Rep: Reputation: 15
No, sorry, it's not a mounted partition.
 
Old 06-24-2010, 12:37 PM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 06-24-2010, 01:09 PM   #10
junglepunk
Member
 
Registered: Jun 2010
Posts: 41

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by druuna View Post
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.
 
Old 06-24-2010, 01:18 PM   #11
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 06-24-2010, 04:22 PM   #12
junglepunk
Member
 
Registered: Jun 2010
Posts: 41

Original Poster
Rep: Reputation: 15
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?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
square brackets in output of "ps aux" not matching output of "ps -ejH" alirezan1 Linux - Newbie 14 07-14-2010 04:17 AM
Question about "ls -f -l" command output in RHEL 5.2 and Red Hat 6 eaerhard Linux - Newbie 2 06-11-2009 06:48 AM
Feeding the output of "diff" or "cat" command to dpkg --purge kushalkoolwal Debian 9 06-19-2008 07:27 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
Interpreting "sar -n DEV" output rfrancis Red Hat 0 01-07-2005 11:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration