Sample Header Ad - 728x90

What happens to a sparse file's holes when the space is needed?

9 votes
2 answers
1599 views
## The scenario Let's say you have a 1GB sparse file in a 2 GB filesystem and the sparse file is taking only 0.1 GB of space. ## The question(s) I guess you would have 1.9 GB to store data on disk, is that right? If there's actually 1.9 GB of free space in disk, what if I stored 1.5 GB outside the sparse file, leaving only 0.4 GB of free space (1.5 GB outside the sparse file + 0.1 GB of the sparse file)? Would that mean that even if I see the sparse file as 1GB I would only be able to store 0.5 GB in total inside it (the 0.1 GB in use + 0.4 GB available)? What would the OS do in this case? ## Thoughts If the above is true, using a sparse file sounds nice because of the saved space, but let's say I'm using this file as a storage point (loop device) and I want to count on that space, I guess using the sparse file wouldn't be a good idea because in case I needed the whole 1 GB I wouldn't be able to use it. I may be better off using a non sparse file.
Asked by loco.loop (213 rep)
Jul 22, 2024, 05:24 AM
Last activity: Aug 3, 2024, 01:22 AM