Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a file "xyz.log" which is of size 1.72MB

In FLASH file system : If I run du -k xyz.log output is 1761 xyz.log.

I copied the same file to RAM storage and run the du -k xyz.log output is 221 xyz.log.

If I run ls -lrth, the file size in both file systems is same (-rw-r--r-- 1 root aspa 1.7M Jan 1 00:25 xyz.log).

RAM file system is pramfs and FLASH file system is jffs2.

Why the disk usage of same file is different in different file systems and how to get the same disk usage in all file systems?

share|improve this question
add comment

1 Answer 1

use du --apparent-size -k

from the manual:

‘--apparent-size’

Print apparent sizes, rather than disk usage. The apparent size of a file is the number of bytes reported by wc -c on regular files, or more generally, ls -l --block-size=1 or stat --format=%s. For example, a file containing the word ‘zoo’ with no newline would, of course, have an apparent size of 3. Such a small file may require anywhere from 0 to 16 KiB or more of disk space, depending on the type and configuration of the file system on which the file resides. However, a sparse file created with this command:

          dd bs=1 seek=2GiB if=/dev/null of=big

has an apparent size of 2 GiB, yet on most modern systems, it actually uses almost no disk space.

share|improve this answer
    
du --help is not showing --apparent-size option in my machine. linux version is Linux 135.250.15.70 2.6.27.39. –  Jagan Aug 14 '13 at 10:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.