0

I have a file and I want to know its size. On computer 1, I get:

$ ls -lh file
> -rw-r--r--. 1 user group 441 May 30 15:41 file

On computer 2, I get

$ ls -lh file
> -rw-r--r--. 1 user group 441 May 30 15:41 file

Okay. They agree. The filesize is 441 bytes. But now I use du on computer 1:

$ du -h file
> 1.0K    file

and on computer 2:

$ du -h file
> 32K    file

Why do they not agree? I assume it has something to do with the cluster size on the filesystem. Now a folder with several subfolders and files and a total size of several 100 Megabytes is about twice as large on computer 2 than it is on computer 1. Why would one use the cluster size as it is on computer 2? It will take up much more space, depending on the typical file sizes.

Filesystem on computer 1 is afs, filesystem on computer 2 is nfs.

pfnuesel
  • 5,837
  • 1
    There is a little explanation here: http://www.howtogeek.com/136078/what-should-i-set-the-allocation-unit-size-to-when-formatting/ If you have lots of small files, then it’s a good idea to keep the allocation size small so your harddrive space won’t be wasted. If you have lots of large files, keeping it higher will increase the system performance by having less blocks to seek. – A.L Jun 01 '16 at 16:43

1 Answers1

2

The block sizes on storage devices with slower access times (such as NFS in your example) or, storage devices housing data which require high performance, such as a database table with very high number of transactions, require/need a file system with larger block sizes to minimize the disk I/O, hence, minimizing delays due to I/O performance. Consequentially, higher the block size, higher the possibility of having "slack" space at the end of each file, a.k.a., wasted space.

MelBurslan
  • 6,966