du의 출력이 잘못되었나요?

du의 출력이 잘못되었나요?

내 du 명령이 혼란스러운 것 같아요.

% du -shc DIR ...
...
6123941496      total

% du -shc DIR ...
...
6.1G    total

% du -sc --si DIR ...
...
6.6G    total

LANG=C스프레드시트에서 결과를 제공하고 다시 확인해 보았습니다 . -h는 이미 1000의 거듭제곱(--si)을 사용하여 출력하고 --si는 잘못된 대답을 제공하는 것 같습니다. -h의 경우 5.7G, --si의 경우 6.1G가 정답이 되어야 한다고 생각합니다. 그러면 여기서 무슨 일이 일어나는가?

% du --version
du (GNU coreutils) 8.20
...

% uname -a
Linux XXX 3.9-1-amd64 #1 SMP Debian 3.9.8-1 x86_64 GNU/Linux

답변1

스위치 를 사용하여 테스트를 반복하십시오 --apparent-size.

$ du -shc --apparent-size DIR ...

du 맨 페이지에서 발췌

--apparent-size
       print  apparent sizes, rather than disk usage; although the apparent size is
       usually smaller, it may be larger due to holes in (`sparse') files, internal 
       fragmentation, indirect blocks, and the like

관련 정보