Bug 182074 - du reports double values for 1K and 2K block sizes on ext2/3
du reports double values for 1K and 2K block sizes on ext2/3
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
rawhide
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Stephen Tweedie
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-20 03:07 EST by Russell Coker
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-02-20 15:10:08 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Russell Coker 2006-02-20 03:07:14 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.1 (like Gecko)

Description of problem:
When I create an ext2 file system with 1K block size a file that is only a few 
bytes long (well under 1K) will be reported by "du" as taking 2K of space. 
 
When I create an ext2 file system with 2K block size a file that is only a few 
bytes long (well under 1K) will be reported by "du" as taking 4K of space. 
 

Version-Release number of selected component (if applicable):
coreutils-5.93-7.2

How reproducible:
Always

Steps to Reproduce:
Create a file system with 1K or 2K block size, create a small file on it, run 
"du file" and observe that the value is twice what is expected. 

Additional info:
Comment 1 Tim Waugh 2006-02-20 04:41:50 EST
And does 'stat file' show different results?
Comment 2 Russell Coker 2006-02-20 04:51:16 EST
Hmm, seems that stat(2) is returning the wrong data, should we change the bug 
to the kernel? 
 
File system with 1K block size: 
# du b 
2       b 
# stat b 
  File: `b' 
  Size: 5               Blocks: 4          IO Block: 4096   regular file 
Device: fd06h/64774d    Inode: 12          Links: 1 
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root) 
Access: 2006-02-20 20:53:41.000000000 +1100 
Modify: 2006-02-20 20:53:41.000000000 +1100 
Change: 2006-02-20 20:53:41.000000000 +1100 
 
 
File system with 2K block size: 
 
# du b 
4       b 
# stat b 
  File: `b' 
  Size: 5               Blocks: 8          IO Block: 4096   regular file 
Device: fd06h/64774d    Inode: 13          Links: 1 
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root) 
Access: 2006-02-20 19:10:03.000000000 +1100 
Modify: 2006-02-20 19:10:03.000000000 +1100 
Change: 2006-02-20 19:10:03.000000000 +1100 
 
Comment 3 Stephen Tweedie 2006-02-20 14:37:09 EST
Are you using SELinux?  From the reporter's name, I expect this to be the case.
:-)  If so, then there's an extra attribute block being used for SELinux
contexts which is accounted for in "du".  This block can be shared between
different files, but it still takes some space and "du" is conservative in its
reporting in this case.
Comment 4 Russell Coker 2006-02-20 15:10:08 EST
I am using SE Linux, I feel so silly for not working this out myself.  On a FS 
with 4K block size 8K is reported for the same reason. 

Note You need to log in before you can comment on or make changes to this bug.