0

The linux programming interface says, file hole don't take up disk space in general, I did google but didn't found answer to following question:

If it don't take up space, then how the file system record the byte count of file hole? Does it store an integer somewhere?


@Update

I read the book a little more, and got "Section 14.4 describes how holes are represented in a file", I will read that.

1
  • 2
    Another key phrase that may be useful for your searches is that a file with holes in is often called a "sparse" file. Mar 30, 2015 at 10:14

1 Answer 1

2

The exact answer depends on your filesystem - but in short, your data is stored in blocks. Your filesystem's metadata contains pointers to those blocks. It's OK if those blocks aren't consecutive - if your pointers are to block 3,4,5,6 it's no different than if they point to 3,28,110,45. It's only the number of blocks that determines how much space is taken up.

Not the answer you're looking for? Browse other questions tagged .