Some files with total size greater than disk size?

Forum Forums New users New Users and General Questions Some files with total size greater than disk size?

  • This topic has 3 replies, 2 voices, and was last updated Oct 5-8:43 am by sybok.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #68301
    Anonymous

      Although I still don’t fully understand the whole science behind it, I’m used to the fact that in file browsers displayed “total size” for a file is smaller than the “disk size”. What I think is, “total size” is just the “raw” (real?) size in bytes, while “disk size” is the size “adapted” to the current file system blocks. Or something like that.

      However, I just realized about an existing example of the opposite case: ~/.cache/mesa_shader_cache/index
      For me, this file reads 1.3 Mb “total size”, while “disk size” reads just some Kb!

      Even “du” command reads the same, though I think “du” always displays just the read “disk size” anyways…

      This can be seen by booting an Antix 19.4 Live system, or perhaps deleting the directory and waiting for it to be created again.

      It’s not making much sense for me, but maybe I’m missing something?
      Thanks.

      #68305
      Member
      sybok
        Helpful
        Up
        0
        ::

        Hi,

        could you please post the commands and results of your “size measurements”.

        My case:

        $ ls -lh .cache/mesa_shader_cache/index
        -rw-r--r-- 1 sybok sybok 1.3M Sep 15 09:58 .cache/mesa_shader_cache/index
        $ du -h .cache/mesa_shader_cache/index
        1.3M	.cache/mesa_shader_cache/index
        $ du -k .cache/mesa_shader_cache/index
        1284	.cache/mesa_shader_cache/index
        $ du .cache/mesa_shader_cache/index
        1284	.cache/mesa_shader_cache/index
        $ du --apparent-size .cache/mesa_shader_cache/index
        1281	.cache/mesa_shader_cache/index
        $ du -b .cache/mesa_shader_cache/index
        1310728	.cache/mesa_shader_cache/index

        ‘-k’ = 1K-units, i.e. the default units printed by ‘du’ are 1K.
        See no problem there.
        Did you mix up the units?

        Originally, I thought it could be related to “sparse file(s)” with “holes in it(/them)”, see e.g. this or that link.

        PS: Slightly differing sizes of files (base 2^10 = 1024 vs. 10^3 = 1000) were discussed in the forum elsewhere.

        • This reply was modified 1 year, 7 months ago by sybok. Reason: Emphasize unit issue
        #68363
        Anonymous
          Helpful
          Up
          0
          ::

          For me it’s like this:

          $ ls -lh .cache/mesa_shader_cache/index
          -rw-r--r-- 1 demo demo 1.3M Oct  4 10:09 .cache/mesa_shader_cache/index
          $ du .cache/mesa_shader_cache/index
          228	.cache/mesa_shader_cache/index
          $ du -k .cache/mesa_shader_cache/index
          228	.cache/mesa_shader_cache/index
          $ du -h .cache/mesa_shader_cache/index
          228K	.cache/mesa_shader_cache/index
          $ du --apparent-size .cache/mesa_shader_cache/index
          1281	.cache/mesa_shader_cache/index
          $ du -b .cache/mesa_shader_cache/index
          1310728	.cache/mesa_shader_cache/index
          $

          Does it show by chance what I’m talking about?

          #68378
          Member
          sybok
            Helpful
            Up
            0
            ::

            Hi,

            the man-page of ‘du’ states:

            –apparent-size
            print apparent sizes, rather than disk usage; although the apparent size is usually smaller, it may be larger due to holes
            in (‘sparse’) files, internal fragmentation, indirect blocks, and the like
            -b, –bytes
            equivalent to ‘–apparent-size –block-size=1’

            The observed discrepancy is indeed/most-likely related to sparse files as I have suggested in my 1st post.

            • This reply was modified 1 year, 7 months ago by sybok. Reason: Fix/Close formatting
          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.