Bug 126112 - du -h gives size in KB on lastlog file
Summary: du -h gives size in KB on lastlog file
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-16 07:52 UTC by Gregory Petit
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-06-25 10:54:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Gregory Petit 2004-06-16 07:52:39 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7)
Gecko/20040614 Firefox/0.8

Description of problem:
du -h gives the output in KB where it should be MB on the lastlog file.

Eg:
[root@homer log]# ll lastlog
-r--------  1 root root 19136220 jun 16 06:34 lastlog
[root@homer log]# ll -h lastlog
-r--------  1 root root 19M jun 16 06:34 lastlog
[root@homer log]# du -h lastlog
21K     lastlog

Same problem on RedHat 9 (i386):

[root@superpc log]$ rpm -qf /usr/bin/du
coreutils-4.5.3-19.0.2
[root@superpc root]# cd /var/log
[root@superpc log]# ll lastlog
-r--------    1 root     root     19136220 jun 16 09:45 lastlog
[root@superpc log]# ll -h lastlog
-r--------    1 root     root          18M jun 16 09:45 lastlog
[root@superpc log]# du -h lastlog
23K     lastlog

-> Problem doesn't occurs on other files bigger than 1MB.
-> Problem doesn't exists on RedHat 7.0
[greggy@mission-control greggy]$ rpm -qf /usr/bin/du
fileutils-4.0x-3.1
[greggy@mission-control greggy]$ cat /etc/redhat-release
Red Hat Linux release 7.0 (Guinness)

Version-Release number of selected component (if applicable):
coreutils-5.2.1-7

How reproducible:
Always

Steps to Reproduce:
1. execute du -h on /var/log/lastlog

Actual Results:  Output shows K (kilobytes)

Expected Results:  K should be M (megabytes)

Additional info:

lastlog seems to be the only file for which the du output is not
correct. Renaming the file doesn't solve the problem.

Comment 1 Tim Waugh 2004-06-25 10:54:14 UTC
It's a sparse file, and du is telling the truth: it really does only
take up that much disk space.  The file is largely zeros, and the
filesystem has an efficient way of representing that.


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