Fact-checked by Grok 2 weeks ago

Sparse file

A sparse file is a type of designed to optimize disk space usage by not allocating physical storage blocks for sections filled entirely with zeros, referred to as "holes" or gaps. When reading from these unallocated regions, the transparently returns zero bytes without storing data on disk, while the file's logical size includes the holes as if they were fully allocated. This feature is supported in various modern file systems, including on Windows, ext4 and on , JFS on AIX, and APFS on macOS, making it a standard mechanism for handling files with sparse data patterns. Sparse files originated as an efficiency feature in operating systems, where file systems like the Veritas File System (VxFS) allowed programs to seek to distant offsets and write data, creating holes without consuming storage for the intervening space. They are particularly beneficial for applications that generate large files with extensive zero-filled areas, such as database files, disk images, and scientific datasets, enabling terabyte-scale files to occupy only a fraction of the actual disk space needed for their non-zero content. Unlike file , sparse file handling incurs no decompression overhead, providing direct access to data while conserving storage. File systems maintain metadata, such as a list of hole ranges in or block allocation maps in Unix variants, to track sparse regions without writing zeros to disk. Tools for creating sparse files include the dd command with the seek option on and AIX (e.g., dd if=/dev/zero of=file.img bs=1M seek=1024 count=0), or Windows APIs like FSCTL_SET_SPARSE to mark ranges as sparse. However, operations like copying or archiving with standard tools (e.g., cp, tar) may expand holes into full zero blocks unless sparseness-preserving options are used, potentially leading to unexpected disk space consumption or file system full errors when gaps are later filled. In Windows , quotas count the logical file size including holes, while in many systems, they count only allocated space; backups may vary depending on tools and options used, requiring careful management in enterprise environments.

Definition and Principles

Definition

A sparse file is a type of that appears to occupy a certain logical size but uses less physical disk space than expected, as regions filled with zeros (known as holes) are not allocated on the medium. Instead, the records these empty regions in , ensuring that reads from holes return zero bytes without requiring actual storage allocation. This mechanism allows the file to maintain its full apparent size while minimizing wasted space for inherently empty sections. The concept of sparse files has been part of operating systems since the late 1970s, enabled by the introduced in (1979), which allows programs to seek beyond the current file size and write , creating unallocated holes without storing intervening zeros. Sparse files are designed to efficiently handle patterns with extensive zero-filled areas, which are prevalent in various scenarios. Common applications include virtual machine disk images, where large portions of the virtual storage remain uninitialized; and their snapshots, which may have sparse distributions; and scientific datasets containing vast empty regions amid sparse non-zero values. By avoiding allocation for these zeros, sparse files conserve disk space and can enhance performance in I/O-bound operations. In contrast to dense files, which allocate full blocks or contiguous space for every byte in the logical , sparse files rely on metadata to denote and skip over unallocated ranges, enabling more economical representation of files with irregular or minimal content density.

Storage Mechanism

File systems represent sparse files through structures, such as inodes in systems, which separately track the logical and the allocation map of data blocks. Unallocated ranges, known as holes, correspond to regions of logical zeros and are explicitly marked in this map without assigning physical data blocks, thereby avoiding storage of redundant zero-filled blocks on disk. When data is written to a , the allocates physical blocks on demand to store the new content, which may introduce fragmentation if writes occur in scattered locations across the file. This on-demand allocation ensures that only non-zero data consumes disk space, while reads from transparently return zero bytes without accessing physical storage. In extent-based file systems like , the extent tree maps logical block ranges to physical locations, efficiently representing both allocated extents and holes as unallocated portions of the tree to minimize metadata overhead. Similarly, uses extent-based storage to handle holes without explicit allocation, further optimizing metadata usage through features like no_holes, which avoids storing hole extents altogether for sparse files. The apparent size of a sparse file reflects its full logical length, as reported by system calls like stat() in Unix, encompassing both allocated data and holes. In contrast, the actual size measures the occupied disk space, calculated from the number of allocated blocks (e.g., via the du command), excluding holes but including . For instance, a 1 GB sparse file containing only 100 MB of non-zero data would store just the 100 MB plus minimal for the block map, with holes spanning the remaining zero regions. Support for this mechanism requires an underlying file system capable of handling sparse allocation, such as the inode-based or extent-based .

Advantages and Disadvantages

Advantages

Sparse files offer substantial disk space efficiency by allocating physical storage only for regions containing non-zero data, leaving "holes" for zero-filled areas unallocated on disk. This approach is especially advantageous for files exhibiting predictable sparse patterns, such as virtual disk images or scientific datasets with large empty sections, allowing systems to store logically large files without consuming equivalent physical space. They enable faster file creation and initialization compared to dense files, as tools like the can preallocate space for large files—such as a 10 file—in seconds without writing zeros across the entire range, preventing failures due to insufficient disk space during subsequent writes. Sparse files improve I/O by returning zeros instantaneously when reading from holes, avoiding actual disk access and reducing in data-intensive applications like and virtual machines. In network transfers and backups, sparse-aware tools transmit only the non-hole data, yielding bandwidth savings; for instance, protocols like NFS benefit from this by handling out-of-order writes more efficiently without unnecessary zero padding.

Disadvantages

One significant limitation of sparse files arises from discrepancies between their logical (apparent) size and actual physical storage usage, which can lead to unexpected out-of-space conditions. When writing data to previously unallocated regions (holes) in a sparse file, the file system must allocate physical disk blocks at that moment, potentially consuming more space than anticipated based on free space reports that account only for currently allocated blocks. If insufficient physical space is available, the write operation fails with an error such as ENOSPC (no space left on device), even if the logical file size suggests ample room. Additionally, disk quotas often charge against the nominal (logical) file size rather than the actual allocated space, which can prematurely exhaust user or volume quotas without reflecting true storage consumption. Backup and data migration processes present another challenge, as many tools and utilities are not designed to preserve sparseness. Standard copy operations typically expand holes by writing explicit zero bytes to those regions, converting the sparse into a dense one and dramatically increasing the and requirements—sometimes by orders of magnitude for files with large empty sections. This expansion can overwhelm media or network transfers, leading to failures or excessive resource use, particularly for images or database files where sparseness is common. Sparse files also carry risks of increased fragmentation due to their on-demand allocation mechanism. As data is written to scattered holes over time, the file can develop numerous non-contiguous extents (allocated regions), complicating management and potentially degrading read/write performance on file systems without advanced support. Random writes, in particular, exacerbate this by proliferating extents, which can reduce throughput significantly compared to dense files with patterns. Compatibility issues further limit the utility of sparse files across diverse environments. Not all file systems support sparseness; for instance, FAT32 and treat sparse files as dense upon access or copy, allocating full space for holes and wasting storage. Similarly, certain applications and older tools fail to handle sparse files efficiently, either by ignoring their structure or triggering unintended expansions during operations like archiving or transmission.

Implementation in Unix-like Systems

Creation

In Unix-like systems, sparse files can be created using command-line utilities and system calls that extend the file size without allocating physical disk space for the entire length, resulting in "holes" that are treated as zero-filled regions on read. One common method is the truncate utility, which sets a file's size to a specified value, extending it with sparse data if necessary. For example, the command truncate -s 1G file.sparse creates a new file or extends an existing one to 1 , using only metadata overhead on the disk rather than full allocation. This approach is efficient for initializing large files, such as disk images, where initial content is minimal or absent. The fallocate utility provides additional flexibility for sparse file creation and modification, particularly on supported filesystems. While its default mode preallocates contiguous disk space (non-sparse), options like --punch-hole (-p) can deallocate specific ranges in an existing , creating and thus making it sparse. For instance, after creating a file and setting its size with truncate -s 2G file.sparse, running fallocate -p -o 0 -l 1G file.sparse punches a 1 GB hole from the start, leaving a sparse file with a 1 GB followed by another unwritten region. Similarly, the --dig-holes (-d) option detects and removes zero-filled blocks across the file, converting dense zero regions to in-place. These operations require filesystems that support hole punching, such as , , and . Programmatically, sparse files are created using system calls like lseek() in conjunction with write(), allowing applications to skip offsets and write only non-zero data. , a is opened with open(), the is advanced beyond the current end using lseek(fd, offset, SEEK_SET), and then data is written; the skipped region becomes a . For example:
c
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>

int main() {
    int fd = open("file.sparse", O_WRONLY | O_CREAT | O_TRUNC, 0644);
    lseek(fd, 1024 * 1024 * 1024LL, SEEK_SET);  // Seek to 1 GB offset
    write(fd, "data", 4);  // Write 4 bytes; 0-1GB is a hole
    close(fd);
    return 0;
}
This method transparently creates sparse regions on compatible filesystems, as the handles the gaps without physical allocation until written. Sparse file creation requires a supporting filesystem, as not all formats handle holes efficiently. Modern filesystems like (since 3.0), (since 2.6.38), and (since 3.7) fully support sparse files, including hole creation and punching via fallocate operations. In contrast, filesystems do not support sparse files, allocating full space for extended regions. Older filesystems support sparse files but with limitations due to block-based mapping, unlike extent-based systems. To verify successful sparse creation, use ls -ls, which displays the apparent file size alongside the actual allocated blocks. For a 1 GB sparse file with minimal data, the output shows a large size (e.g., 1073741824) but small block count (e.g., 8), confirming the presence of holes. This distinction highlights the space savings, with best practices recommending such checks post-creation to ensure the filesystem treated the extension as sparse.

Detection and Inspection

In systems, sparse files can be detected by comparing the apparent (logical) size of a , which includes regions of bytes known as holes, against the actual disk space allocated to it. A common method involves using the ls command: the -l option displays the file's size in bytes (st_size from the underlying inode), representing the full logical extent, while -ls (or -l -s) shows the allocated space in blocks (typically 1 units by default, reflecting st_blocks scaled appropriately). If the block allocation reported by -s is significantly less than the byte size from -l, the file is likely sparse, as holes do not consume physical blocks. The du utility provides another straightforward inspection approach, particularly for estimating usage. Without options, du file reports the actual disk space consumed, accounting only for allocated blocks and excluding holes in sparse files. In contrast, du --apparent-size file displays the logical size, mirroring the apparent byte count from ls -l. This discrepancy highlights sparsity, as the apparent size includes unallocated hole regions that do not contribute to on-disk storage. At the level, the [stat](/page/STAT) function retrieves inode details for precise examination. The st_size field indicates the total logical in bytes, encompassing any holes, while st_blocks reports the number of 512-byte blocks actually allocated on disk, excluding unallocated regions. A is sparse if st_blocks * 512 < st_size, as this inequality reveals that the physical allocation falls short of the reported size due to holes. Specialized tools offer deeper insights into sparse file structure, especially on Linux filesystems like . The filefrag -v file command, part of the e2fsprogs package, uses the FIEMAP ioctl to map extents and explicitly lists hole extents (unallocated ranges of zeros) alongside physical block allocations, quantifying fragmentation and sparsity in detail. For filesystems supporting extended attributes, such as , lsattr file can reveal related flags like the 'e' extent attribute, which indicates use of extent-based mapping that enables efficient sparse storage, though sparsity itself is a default feature rather than a toggleable attribute. Programmatically, applications in languages like C can detect sparsity by invoking stat or fstat on a file descriptor and applying the block-size comparison. For instance, after calling stat(filename, &st), checking if (st.st_blocks * 512 < st.st_size) identifies sparse files, allowing code to handle them appropriately, such as when computing true disk usage or seeking through holes. This method is portable across Unix-like systems supporting the POSIX .

Manipulation and Copying

In Unix-like systems, manipulating sparse files involves tools that can preserve, create, or modify holes without unnecessarily allocating disk space. Common operations include copying, punching holes, resizing, and archiving, each supported by standard utilities that interact with the filesystem's sparse file capabilities. Copying sparse files with the cp command requires explicit options to maintain holes. By default, cp detects sequences of zero bytes in the source and may create a sparse destination, but using --sparse=always ensures holes are preserved regardless, creating a sparse destination file for any sufficiently long zero sequences in the source. Without this option or if using --sparse=never, the copy may allocate full blocks for zeros, densifying the file and consuming more space. For example, cp --sparse=always source dest efficiently replicates the sparse structure. Hole punching allows deallocation of specific ranges within an existing sparse file to introduce or extend holes. The fallocate utility supports this via the -p or --punch-hole option, combined with --keep-size to avoid shrinking the apparent file size. The syntax is fallocate -p offset length file, where offset specifies the starting byte position and length the size of the range to deallocate; this works on filesystems supporting the FALLOC_FL_PUNCH_HOLE flag, such as ext4 and XFS. For instance, fallocate -p 0 1M file punches a 1 MiB hole at the file's beginning, freeing underlying blocks while the file reads as zeros in that range. Partial blocks are zeroed as needed. Resizing sparse files is handled by the truncate command, which adjusts file length and interacts with sparsity based on the new size. To set a file to a specific size, use truncate -s size file; if the new size exceeds the current length, the extension becomes a hole (reading as zeros without allocation until written). Shrinking discards data beyond the new size, potentially deallocating blocks if they were sparse, though the exact behavior depends on the filesystem. For example, truncate -s 500M file expands or contracts the file to 500 MiB, creating holes for growth or trimming excess for reduction. This operation is efficient for sparse files, as it leverages the filesystem's hole management. Archiving sparse files with tar preserves sparsity through the --sparse option, which detects holes and stores only non-zero data blocks, reducing archive size. When creating an archive, tar --sparse -cf archive.tar files identifies sparse regions via seeks or extent maps and represents them efficiently in the tar format. During extraction, it recreates the holes, maintaining the original structure. This is particularly useful for backups of large sparse files like virtual machine images, avoiding the need to store zero-filled blocks. Common pitfalls arise when using tools without sparse-aware options, potentially expanding files unintentionally. For instance, rsync without --sparse writes all blocks, including zeros, which densifies the destination; specifying --sparse (or -S) handles holes efficiently by seeking instead of writing NUL blocks. Similarly, for manual low-level copies, dd can preserve sparsity using conv=sparse, which skips output for input zero blocks; combining with seek allows positioning, as in dd if=source of=dest conv=sparse,notrunc. Omitting these can lead to full allocation, consuming unexpected disk space.

Implementation in Other Operating Systems

Windows

Microsoft Windows supports sparse files natively through the file system, where they are implemented as sparse streams to optimize storage for files containing large regions of zero bytes. This feature was introduced with in , allowing the file system to avoid allocating physical disk space for zero-filled areas while presenting a contiguous file to applications. Files designated as sparse are marked with the FILE_ATTRIBUTE_SPARSE_FILE attribute, enabling the I/O subsystem to handle reads from unallocated regions by returning zeros transparently. To create a sparse in Windows, administrators typically use the fsutil command-line tool. First, a new is created with a specified size using fsutil file createnew <filename> <length_in_bytes>, which initializes an empty without filling it with . Then, the sparse attribute is enabled via fsutil sparse setflag <filename>, and (zero regions) are explicitly defined with fsutil sparse setrange <filename> <offset> <length>, which deallocates the specified range without writing zeros to disk. For example, to create a 1 sparse entirely as a :
fsutil file createnew sparse.txt 1073741824
fsutil sparse setflag sparse.txt
fsutil sparse setrange sparse.txt 0 1073741824
can also interface with these operations through .NET APIs like DeviceIoControl for FSCTL_SET_SPARSE, though command-line tools remain the standard for manual creation. Applications can leverage Win32 APIs such as SetFileValidDataLength to set the valid data length without allocating space for trailing zeros. Detection of sparse files involves querying and sizes. The fsutil file queryvaliddata <filename> command retrieves the valid data length (non-hole portions), which can be compared to the total obtained via dir or GetFileSize API. If the valid data length is less than the , the file contains sparse regions. Additionally, fsutil sparse queryflag <filename> checks if the sparse attribute is set, returning "The file is sparse" if enabled. For programmatic detection, GetFileAttributesEx retrieves the FILE_ATTRIBUTE_SPARSE_FILE flag, while FSCTL_QUERY_ALLOCATED_RANGES via DeviceIoControl lists allocated (non-sparse) ranges. WMI queries, such as through Win32_ShortcutFile, can also expose sparse properties in enterprise environments. Manipulation of sparse files is handled through fsutil for command-line tasks and Win32 APIs for applications. To punch a hole in an existing sparse file, use fsutil sparse setrange <filename> <offset> <length>, which marks the range as unallocated zeros. For example, clearing bytes to 2048: fsutil sparse setrange file.txt 1024 1024. Queries like fsutil sparse queryrange <filename> <offset> <length> identify allocated ranges within a specified area. Copying sparse files with tools like defaults to expanding holes (using /J for unbuffered I/O), consuming full disk space; preservation requires custom scripts invoking FSCTL_SET_ZERO_DATA or third-party utilities to maintain sparsity. Defragmentation tools, such as those in Windows, handle sparse files correctly on volumes. Sparse file support is limited to and volumes; it is not available on FAT32 or file systems, which lack the necessary structures. On , sparse files are supported via sparse valid data length (VDL) mechanisms, including the fsutil sparse commands; features like block cloning provide additional optimizations for copying rather than differing in core manipulation from sparse streams, affecting compatibility with legacy tools. Disk quotas count the nominal , not the allocated space, potentially leading to unexpected limits.

macOS and BSD Variants

In macOS, support for sparse files evolved with changes to its default file systems. Prior to in 2017, the Hierarchical File System Plus (HFS+) did not natively support sparse files, requiring workarounds like sparse bundle disk images for efficient storage of files with large zero-filled regions. Since , the (APFS) provides built-in support for sparse files through mechanisms like extended attributes and block-level hole detection, allowing files to allocate space only for non-zero data while reporting a larger logical size. Sparse files in macOS APFS can be created using commands like mkfile -n 1g file.sparse, which allocates the specified size without writing zeros to disk, or by seeking beyond the current end of file with tools such as dd before writing data. In BSD variants like FreeBSD, the Unix File System (UFS) and ZFS both support sparse files, with UFS using inode-based hole tracking and ZFS employing hole records within its block pointers to represent unallocated regions efficiently. Creation in FreeBSD typically involves truncate to extend the file size without filling it, or dd of=file bs=1 count=0 seek=1g to punch holes by skipping to an offset. In ZFS, enabling compression further optimizes sparse files by automatically converting all-zero blocks into holes during writes. Detection of sparse files across macOS and BSD systems relies on standard Unix tools that compare logical and physical sizes. The ls -ls command displays the apparent size alongside the allocated blocks, revealing discrepancies for sparse files on both APFS and UFS/ZFS. In macOS, stat -f %z file reports the logical size, while stat -f %k file indicates the number of 512-byte blocks actually used, and APFS-specific inspection can use diskutil apfs list or diskutil info for volume-level details on allocation patterns. In FreeBSD, similar stat output applies, with ZFS providing additional visibility via zdb -bbbb pool/dataset to examine block-level holes. Manipulation of sparse files in these systems emphasizes preserving holes to avoid unnecessary expansion. In macOS, cp -c (or cp --reflink where available) clones files while maintaining sparsity on APFS volumes, and cp -P follows symlinks without dereferencing, helping retain structure. The fallocate command is not native, but equivalents like truncate suffice for allocation; for archiving, libarchive-based tools such as tar handle holes via GNU/BSD sparse extensions, ensuring extraction recreates sparsity. The chflags ufsdump or UF_SPARSE flag can mark files for sparse handling in UFS contexts across BSDs. In FreeBSD ZFS, standard cp may expand holes unless using --sparse=always with GNU variants, but libarchive preserves them in tar archives. Differences among BSD variants include varying degrees of optimization. OpenBSD's UFS implementation offers limited sparse support, primarily through basic inode hole punching without advanced ZFS-like features, relying on dd or truncate for creation but lacking native compression-induced holes. emphasizes its Fast File System (FFS) with sparse inodes enabled via options like -Z in makefs for creating hole-aware images, supporting efficient storage for virtual machines while maintaining compatibility with traditional UFS structures.

References

  1. [1]
    Sparse Files - Win32 apps - Microsoft Learn
    Jan 7, 2021 · A sparse file contains much data as zeros. The system only allocates space where non-zero data is present, using a list of zero locations.Missing: linux | Show results with:linux
  2. [2]
    About Sparse Files - IBM
    A sparse file is a file with empty space, or gaps, left open for future addition of data. If the empty spaces are filled with the ASCII null character and the ...
  3. [3]
    UNIX Filesystems: Evolution, Design, and Implementation - O'Reilly
    A sparse file is simply a file that contains one or more holes. This statement itself is probably the reason for the confusion. A hole is a gap within the file ...
  4. [4]
    How can I create sparse files under Red Hat Enterprise Linux?
    Sep 16, 2012 · Sparse files are files that have large amounts of space preallocated to them, without occupying the entire amount from the filesystem.
  5. [5]
    Sparse Database and Sparse Files - Oracle Help Center
    In a sparse database, such as an Exadata Snapshot database, its data files are sparse files. A database consists of the following files.Missing: virtual | Show results with:virtual
  6. [6]
    [PDF] A Fast File System for UNIX* - FreeBSD Documentation Archive
    This paper describes the changes from the original 512 byte UNIX file system to the new one released with the 4.2 Berkeley Software Distribution. It ...
  7. [7]
    File holes, races, and mmap() - LWN.net
    Oct 21, 2009 · Most filesystems are smart enough to mark the holes in the inode, and not store them physically on disk (these are also known as sparse files).Holes · Mmap · Data Loss
  8. [8]
    ext4(5) - Linux manual page - man7.org
    This feature requires that the sparse_super or sparse_super2 feature be enabled. sparse_super This file system feature is set on all modern ext2, ext3, and ext4 ...
  9. [9]
    BTRFS - The Linux Kernel documentation
    The main Btrfs features include: Extent based file storage (2^64 max file size). Space efficient packing of small files. Space efficient indexed directories.
  10. [10]
    btrfs(5) - BTRFS documentation!
    Btrfs supports transparent file compression. There are three algorithms available: ZLIB, LZO and ZSTD (since v4.14), with various levels. The compression ...
  11. [11]
    Storage Administration Guide | Red Hat Enterprise Linux | 7
    Sparse Files: It verifies space efficiency of a file and allows placeholder to improve storage efficiency. It is a file having one or more holes; holes are ...
  12. [12]
    fallocate(2) - Linux manual page
    ### Summary on `fallocate` for Sparse Files and Benefits
  13. [13]
    [PDF] The Case for Sparse Files
    We propose a return to the model present in the clas- sic operating system. We introduce the sparse file as a synchronization device between I/O and CPU ...
  14. [14]
    [JDK-4842430] File should support creation of sparse files
    Apr 3, 2003 · JUSTIFICATION : Sparse file support can drastically improve performance for applications that do long seeks beyond the end of the file. Write ...
  15. [15]
    Overview of Oracle ACFS
    The sparse files feature benefits NFS performance and also the performance and disk utilization of other applications that intentionally perform this type ...
  16. [16]
    [PDF] Oracle ACFS 23ai - Technical Brief
    for sparse files, metadata acceleration, file system freezing, and more. ... ACFS also benefits from ASM file extent striping and mirroring for performance ...
  17. [17]
    What happens to a sparse file's holes when the space is needed?
    Jul 22, 2024 · 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 ...How transparent are sparse files for applications?Sparse files/file holes and unexpected block sizeMore results from unix.stackexchange.com
  18. [18]
    Lightweight VMs are sparse files, and how to keep them compact
    Jan 5, 2023 · Virtual Machines for lightweight virtualisation on Apple silicon Macs rely on sparse files. Here are tips to ensure they stay small and ...
  19. [19]
    Exploring Sparse Files Across Windows, Linux, MacOS, and File ...
    Jun 15, 2025 · Sparse files are special files that use the file system more efficiently and keep the file system from taking up free disk space when it is not ...Missing: documentation | Show results with:documentation<|control11|><|separator|>
  20. [20]
    truncate(1) - Linux manual page
    ### Summary: Using `truncate` to Create Sparse Files
  21. [21]
  22. [22]
    fallocate(1) - Linux manual page
    ### Summary: Using `fallocate` to Create or Make Files Sparse in Unix-like Systems
  23. [23]
    lseek(2) - Linux manual page - man7.org
    lseek() repositions the file offset of the open file description associated with the file descriptor fd to the argument offset according to the directive ...
  24. [24]
    2. High Level Design - The Linux Kernel documentation
    An ext4 file system is split into a series of block groups. To reduce performance difficulties due to fragmentation, the block allocator tries very hard to ...Missing: sparse | Show results with:sparse
  25. [25]
    ls(1) - Linux manual page
    ### Summary: How `ls -ls` Shows Apparent Size vs. Actual Allocated Blocks for Sparse Files
  26. [26]
    du(1) - Linux manual page - man7.org
    Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set). The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units ...
  27. [27]
    stat(2) - Linux manual page - man7.org
    These functions return information about a file, in the buffer pointed to by statbuf. No permissions are required on the file itself.Missing: sparse | Show results with:sparse
  28. [28]
    filefrag(8) — e2fsprogs — Debian unstable
    Jul 30, 2025 · filefrag reports on how badly fragmented a particular file might be. It makes allowances for indirect blocks for ext2 and ext3 file systems, but can be used on ...
  29. [29]
    lsattr(1) - Linux manual page - man7.org
    lsattr lists the file attributes on an ext2/ext3/ext4 file system. See chattr(1) for a description of the attributes and what they mean.<|separator|>
  30. [30]
    cp(1) - Linux manual page - man7.org
    Specify --sparse=always to create a sparse DEST file whenever the SOURCE file contains a long enough sequence of zero bytes. Use --sparse=never to inhibit ...
  31. [31]
    tar(1) - Linux manual page - man7.org
    This manpage is a short description of GNU tar. For a detailed discussion, including examples and usage recommendations, refer to the GNU Tar Manual available ...
  32. [32]
    GNU tar 1.35: 8.1.2 Archiving Sparse Files
    The `--sparse` option in tar identifies holes in files, only archiving the real content, and tests for sparseness before archiving, useful for backups.
  33. [33]
    rsync(1) - Linux man page
    Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync ...
  34. [34]
    dd(1) - Linux manual page - man7.org
    Copy a file, converting and formatting according to the operands. bs=BYTES read and write up to BYTES bytes at a time (default: 512); overrides ibs and obs.<|control11|><|separator|>
  35. [35]
    NTFS Sparse Files
    NTFS includes full sparse file support for both compressed and uncompressed files. NTFS handles read operations on sparse files by returning allocated data and ...
  36. [36]
    fsutil file - Microsoft Learn
    Nov 1, 2024 · Reference article for the fsutil file command, which finds a file by user name, queries allocated ranges for a file, sets a file's short ...
  37. [37]
    fsutil sparse | Microsoft Learn
    Nov 1, 2024 · Manages sparse files. A sparse file is a file with one or more regions of unallocated data in it. A program sees these unallocated regions as containing bytes ...
  38. [38]
    Sparse File Operations - Win32 apps - Microsoft Learn
    Jan 26, 2022 · Defragmentation tools that handle compressed files on NTFS file systems will correctly handle sparse files on NTFS file system volumes.
  39. [39]
    Resilient File System (ReFS) overview - Microsoft Learn
    Jul 28, 2025 · Sparse VDL - Sparse VDL allows ReFS to zero files rapidly, reducing the time needed to create fixed VHDs from 10s of minutes to mere seconds.<|control11|><|separator|>
  40. [40]
    How do I create a sparse file programmatically, in C, on Mac OS X?
    Oct 9, 2008 · On MacOS, the default filesystem is HFS+ which does not support sparse files. ... Update: macOS now defaults to APFS, which does support it. :).
  41. [41]
  42. [42]
    Sparse files are common in APFS - The Eclectic Light Company
    Mar 29, 2021 · Sparse files are common in APFS · locally-copied files are often cloned, and only become full-sized when both copies are put on a different ...
  43. [43]
    What are sparse files and how to tell if a file is stored sparsely
    Feb 7, 2022 · Sparse files are files stored in a file system where consecutive data blocks consisting of all zero-bytes (null-bytes) are compressed to nothing.
  44. [44]
    What MacOS Sierra's New APFS File System Means to You - PCMag
    Jun 23, 2016 · APFS also builds in support for "sparse files"—files that don't fill all the allocated space on disk. (Older OS X versions already support ...
  45. [45]
    Mac OS X: create arbitrarily large sparse/dummy file - My Tech Notes
    On Mac OS X, you can use command dd or mkfile to create an arbitrarily large dummy file. The following examples create a 20GB file: dd ( ...
  46. [46]
    Understanding sparse files, dd, seek, inode block structure
    May 26, 2016 · The sparse aspect of a file should be totally transparent to a program, which sometimes means the sparseness may be lost when the program ...Finding sparse files? - Unix & Linux Stack ExchangeHow transparent are sparse files for applications?More results from unix.stackexchange.comMissing: BSD Fast
  47. [47]
    Punching holes into (sparse) files - porting Solaris fcntl(F_FREESP ...
    Mar 7, 2011 · I don't know why do you need this, but note that when compression is > enabled on a ZFS file system, all-zeros blocks are turned into holes, so ...Missing: UFS | Show results with:UFS
  48. [48]
    Create large files | The FreeBSD Forums
    Apr 7, 2021 · You create sparse files either by seeking to different positions before writing, or by calling the various forms of the truncate() system call ( ...Other - How to create a non-sparse file of 10G. | The FreeBSD ForumsTruncate dd img to remove unused space without corrupting GPT ...More results from forums.freebsd.org
  49. [49]
    Determine disk usage from the command line on macOS
    Jun 22, 2023 · macOS uses a file system called APFS (Apple File System) or HFS+ for older versions. Now, let's explore some commands to help determine disk ...
  50. [50]
    APFS File Clone doesn't work as expected with Sparse Files
    Oct 4, 2021 · When you clone a non sparse file, it shares the same blocks on disk instead of copying the blocks. But it seems that cloning a sparse file doesn't share the ...How do you create an APFS volume inside an ordinary file?Estimate "true" APFS disk usage of folder without counting cloned ...More results from apple.stackexchange.comMissing: diskutil | Show results with:diskutil
  51. [51]
    archive/tar: re-add sparse file support · Issue #22735 · golang/go
    Nov 15, 2017 · The two most common implementations, GNU tar and BSD tar, both understand sparse headers. ... archive/tar: add support for writing tar containing ...
  52. [52]
    chflags(2freebsd) — freebsd-manpages — Debian trixie
    Jul 22, 2024 · UF_SPARSE: The file has the Windows FILE_ATTRIBUTE_SPARSE_FILE attribute. This may also be used by a filesystem to indicate a sparse file.
  53. [53]
    FreeBSD and sparse files | [H]ard|Forum
    Mar 26, 2013 · Apparently, FreeBSD's version of cp doesn't handle sparse files (unlike GNU cp) and the resulting copy takes up a full 6TB of disk space. I've ...Missing: BSD | Show results with:BSD
  54. [54]
    Linux's SystemV Filesystem Support Being Orphaned - Phoronix
    Feb 20, 2023 · FFS is the term primarily used by OpenBSD and NetBSD and UFS by FreeBSD. In OpenBSD FFS2 is faster, supports faster fscks, bigger file ...Missing: inodes | Show results with:inodes
  55. [55]
    makefs(8) - NetBSD Manual Pages
    -Z Create a sparse file for ffs. This is useful for virtual machine images. Where sizes are specified, a decimal number of bytes is expected. Two or more ...