Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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?
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572
Rep:
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:~$
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
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.
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).
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.
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.