4

Sparse files can significantly reduce the storage requirements for a file that has large "empty" portions. But does the increased bookkeeping for these sparse regions materially impact access performance?

This will, of course, depend on the file system implementation -- I am specifically asking about NTFS and ext4.

Tony the Pony
  • 40,327
  • 71
  • 187
  • 281
  • The reduced disk storage is only the obvious benefit, what sparse files can really help with is to reduce the seek time. The truly expensive operation on a large spindle disk, mechanical motion is orders of magnitude more expensive than the book-keeping. – Hans Passant Mar 26 '19 at 15:02
  • @HansPassant Good point about seek times, this is a clear advantage for read-only files. I'm concerned about what will happen when write operations over time fill in the sparse regions, i.e., the sparse file becomes increasingly dense. Wouldn't the sparse file then suffer from fragmentation? – Tony the Pony Mar 26 '19 at 16:16
  • Any file can get fragmented when you write to it. Doesn't matter that much when it happens, its just as likely to occur when you do it early with a file that isn't sparse. Assuming it is less likely because the disk isn't as full yet merely gets you a disk that always ends up full. – Hans Passant Mar 26 '19 at 16:22

0 Answers0