du shows completely different folder size for * and folder name

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I'm trying to move some data over and to start with I'd like to make sure that the size is ok. I run into a problem however, if I check the folder with



du -sh myfolder/
780M myfolder/


but



du -sh *
..
71M myfolder
..


I thought it might be something to do with hidden files but this particular folder does not have any inside.



Am I missing something?







share|improve this question






















  • Do you have a ~709 MB file being added to / deleted from myfolder between operation? A file being written to? A file being linked to myfolder? If you don't then it looks like a bug in your du.
    – Satō Katsura
    Mar 29 '17 at 15:25











  • Do you have hidden files? ls -lhA myfolder
    – Giacomo Catenazzi
    Mar 29 '17 at 16:41














up vote
1
down vote

favorite












I'm trying to move some data over and to start with I'd like to make sure that the size is ok. I run into a problem however, if I check the folder with



du -sh myfolder/
780M myfolder/


but



du -sh *
..
71M myfolder
..


I thought it might be something to do with hidden files but this particular folder does not have any inside.



Am I missing something?







share|improve this question






















  • Do you have a ~709 MB file being added to / deleted from myfolder between operation? A file being written to? A file being linked to myfolder? If you don't then it looks like a bug in your du.
    – Satō Katsura
    Mar 29 '17 at 15:25











  • Do you have hidden files? ls -lhA myfolder
    – Giacomo Catenazzi
    Mar 29 '17 at 16:41












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm trying to move some data over and to start with I'd like to make sure that the size is ok. I run into a problem however, if I check the folder with



du -sh myfolder/
780M myfolder/


but



du -sh *
..
71M myfolder
..


I thought it might be something to do with hidden files but this particular folder does not have any inside.



Am I missing something?







share|improve this question














I'm trying to move some data over and to start with I'd like to make sure that the size is ok. I run into a problem however, if I check the folder with



du -sh myfolder/
780M myfolder/


but



du -sh *
..
71M myfolder
..


I thought it might be something to do with hidden files but this particular folder does not have any inside.



Am I missing something?









share|improve this question













share|improve this question




share|improve this question








edited Mar 29 '17 at 10:08









Jeff Schaller

31.9k848109




31.9k848109










asked Mar 29 '17 at 7:13









Bart C

1354




1354











  • Do you have a ~709 MB file being added to / deleted from myfolder between operation? A file being written to? A file being linked to myfolder? If you don't then it looks like a bug in your du.
    – Satō Katsura
    Mar 29 '17 at 15:25











  • Do you have hidden files? ls -lhA myfolder
    – Giacomo Catenazzi
    Mar 29 '17 at 16:41
















  • Do you have a ~709 MB file being added to / deleted from myfolder between operation? A file being written to? A file being linked to myfolder? If you don't then it looks like a bug in your du.
    – Satō Katsura
    Mar 29 '17 at 15:25











  • Do you have hidden files? ls -lhA myfolder
    – Giacomo Catenazzi
    Mar 29 '17 at 16:41















Do you have a ~709 MB file being added to / deleted from myfolder between operation? A file being written to? A file being linked to myfolder? If you don't then it looks like a bug in your du.
– Satō Katsura
Mar 29 '17 at 15:25





Do you have a ~709 MB file being added to / deleted from myfolder between operation? A file being written to? A file being linked to myfolder? If you don't then it looks like a bug in your du.
– Satō Katsura
Mar 29 '17 at 15:25













Do you have hidden files? ls -lhA myfolder
– Giacomo Catenazzi
Mar 29 '17 at 16:41




Do you have hidden files? ls -lhA myfolder
– Giacomo Catenazzi
Mar 29 '17 at 16:41










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










Chances are that myfolder contains 709 MB worth of files that have another hard link in a subdirectory that is sorted lexicographically before myfolder. The du command reports each distinct file only the first time it sees it, so if a file has multiple links inside the tree(s) covered by a run of du, it's reported only once, under whichever directory was traversed first.



Here are a few ways you can look for hard links:




  • find myfolder -links +1 -type f lists all the files that have at least a second hard link under myfolder (+1 means “more than one”), regardless of where that link is.


  • find . -samefile myfolder/foo (with GNU find) lists all the hard links to myfolder/foo under the current directory. Since myfolder is under the current directory, this includes myfolder/foo itself.


  • find -type f -links +1 -printf '%i %pn' | sort -k1n (with GNU find) produces a list of hard-linked files under the current directory, grouped by inode number. Two files are the same if they are located on the same filesystem and they have the same inode number.





share|improve this answer






















  • This might be the case, I'll check this out. Thanks @Gillles
    – Bart C
    Mar 30 '17 at 11:22










  • Yes, with find . -samefile ... I found multiple hard links all over the place, thanks again.
    – Bart C
    Mar 30 '17 at 11:38










  • Following on the subject, ls -l displays a number next to the permissions which indicates a count of hard links on the file
    – Bart C
    Apr 3 '17 at 9:50










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f354508%2fdu-shows-completely-different-folder-size-for-and-folder-name%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










Chances are that myfolder contains 709 MB worth of files that have another hard link in a subdirectory that is sorted lexicographically before myfolder. The du command reports each distinct file only the first time it sees it, so if a file has multiple links inside the tree(s) covered by a run of du, it's reported only once, under whichever directory was traversed first.



Here are a few ways you can look for hard links:




  • find myfolder -links +1 -type f lists all the files that have at least a second hard link under myfolder (+1 means “more than one”), regardless of where that link is.


  • find . -samefile myfolder/foo (with GNU find) lists all the hard links to myfolder/foo under the current directory. Since myfolder is under the current directory, this includes myfolder/foo itself.


  • find -type f -links +1 -printf '%i %pn' | sort -k1n (with GNU find) produces a list of hard-linked files under the current directory, grouped by inode number. Two files are the same if they are located on the same filesystem and they have the same inode number.





share|improve this answer






















  • This might be the case, I'll check this out. Thanks @Gillles
    – Bart C
    Mar 30 '17 at 11:22










  • Yes, with find . -samefile ... I found multiple hard links all over the place, thanks again.
    – Bart C
    Mar 30 '17 at 11:38










  • Following on the subject, ls -l displays a number next to the permissions which indicates a count of hard links on the file
    – Bart C
    Apr 3 '17 at 9:50














up vote
4
down vote



accepted










Chances are that myfolder contains 709 MB worth of files that have another hard link in a subdirectory that is sorted lexicographically before myfolder. The du command reports each distinct file only the first time it sees it, so if a file has multiple links inside the tree(s) covered by a run of du, it's reported only once, under whichever directory was traversed first.



Here are a few ways you can look for hard links:




  • find myfolder -links +1 -type f lists all the files that have at least a second hard link under myfolder (+1 means “more than one”), regardless of where that link is.


  • find . -samefile myfolder/foo (with GNU find) lists all the hard links to myfolder/foo under the current directory. Since myfolder is under the current directory, this includes myfolder/foo itself.


  • find -type f -links +1 -printf '%i %pn' | sort -k1n (with GNU find) produces a list of hard-linked files under the current directory, grouped by inode number. Two files are the same if they are located on the same filesystem and they have the same inode number.





share|improve this answer






















  • This might be the case, I'll check this out. Thanks @Gillles
    – Bart C
    Mar 30 '17 at 11:22










  • Yes, with find . -samefile ... I found multiple hard links all over the place, thanks again.
    – Bart C
    Mar 30 '17 at 11:38










  • Following on the subject, ls -l displays a number next to the permissions which indicates a count of hard links on the file
    – Bart C
    Apr 3 '17 at 9:50












up vote
4
down vote



accepted







up vote
4
down vote



accepted






Chances are that myfolder contains 709 MB worth of files that have another hard link in a subdirectory that is sorted lexicographically before myfolder. The du command reports each distinct file only the first time it sees it, so if a file has multiple links inside the tree(s) covered by a run of du, it's reported only once, under whichever directory was traversed first.



Here are a few ways you can look for hard links:




  • find myfolder -links +1 -type f lists all the files that have at least a second hard link under myfolder (+1 means “more than one”), regardless of where that link is.


  • find . -samefile myfolder/foo (with GNU find) lists all the hard links to myfolder/foo under the current directory. Since myfolder is under the current directory, this includes myfolder/foo itself.


  • find -type f -links +1 -printf '%i %pn' | sort -k1n (with GNU find) produces a list of hard-linked files under the current directory, grouped by inode number. Two files are the same if they are located on the same filesystem and they have the same inode number.





share|improve this answer














Chances are that myfolder contains 709 MB worth of files that have another hard link in a subdirectory that is sorted lexicographically before myfolder. The du command reports each distinct file only the first time it sees it, so if a file has multiple links inside the tree(s) covered by a run of du, it's reported only once, under whichever directory was traversed first.



Here are a few ways you can look for hard links:




  • find myfolder -links +1 -type f lists all the files that have at least a second hard link under myfolder (+1 means “more than one”), regardless of where that link is.


  • find . -samefile myfolder/foo (with GNU find) lists all the hard links to myfolder/foo under the current directory. Since myfolder is under the current directory, this includes myfolder/foo itself.


  • find -type f -links +1 -printf '%i %pn' | sort -k1n (with GNU find) produces a list of hard-linked files under the current directory, grouped by inode number. Two files are the same if they are located on the same filesystem and they have the same inode number.






share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 3 '17 at 11:33

























answered Mar 29 '17 at 23:58









Gilles

507k12010031530




507k12010031530











  • This might be the case, I'll check this out. Thanks @Gillles
    – Bart C
    Mar 30 '17 at 11:22










  • Yes, with find . -samefile ... I found multiple hard links all over the place, thanks again.
    – Bart C
    Mar 30 '17 at 11:38










  • Following on the subject, ls -l displays a number next to the permissions which indicates a count of hard links on the file
    – Bart C
    Apr 3 '17 at 9:50
















  • This might be the case, I'll check this out. Thanks @Gillles
    – Bart C
    Mar 30 '17 at 11:22










  • Yes, with find . -samefile ... I found multiple hard links all over the place, thanks again.
    – Bart C
    Mar 30 '17 at 11:38










  • Following on the subject, ls -l displays a number next to the permissions which indicates a count of hard links on the file
    – Bart C
    Apr 3 '17 at 9:50















This might be the case, I'll check this out. Thanks @Gillles
– Bart C
Mar 30 '17 at 11:22




This might be the case, I'll check this out. Thanks @Gillles
– Bart C
Mar 30 '17 at 11:22












Yes, with find . -samefile ... I found multiple hard links all over the place, thanks again.
– Bart C
Mar 30 '17 at 11:38




Yes, with find . -samefile ... I found multiple hard links all over the place, thanks again.
– Bart C
Mar 30 '17 at 11:38












Following on the subject, ls -l displays a number next to the permissions which indicates a count of hard links on the file
– Bart C
Apr 3 '17 at 9:50




Following on the subject, ls -l displays a number next to the permissions which indicates a count of hard links on the file
– Bart C
Apr 3 '17 at 9:50












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f354508%2fdu-shows-completely-different-folder-size-for-and-folder-name%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay