Bug 126112 - du -h gives size in KB on lastlog file
du -h gives size in KB on lastlog file
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Depends On:
  Show dependency treegraph
Reported: 2004-06-16 03:52 EDT by Gregory Petit
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-06-25 06:54:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Gregory Petit 2004-06-16 03:52:39 EDT
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.

[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
[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
[greggy@mission-control greggy]$ cat /etc/redhat-release
Red Hat Linux release 7.0 (Guinness)

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

How reproducible:

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 06:54:14 EDT
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.