Fsutil: sparse
Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
Fsutil: sparse
Manages sparse files. A sparse file is a file with one or more regions of unallocated data in it. A program will see these unallocated regions as containing bytes with the value zero, but there is actually no disk space used to represent these zeros. In other words, all meaningful or nonzero data is allocated, whereas all non-meaningful data (large strings of data composed of zeros) is not allocated. When a sparse file is read, allocated data is returned as stored and unallocated data is returned, by default, as zeros, in accordance with the C2 security requirement specification. Sparse file support allows data to be de-allocated from anywhere in the file.
Syntax
fsutil sparse [queryflag] FileName
fsutil sparse [queryrange] FileName
fsutil sparse [setflag] FileName
fsutil sparse [setrange] FileNameBeginningOffsetLength
Parameters
- queryflag
Queries sparse.
- queryrange
Scans a file looking for ranges that may contain nonzero data.
- setflag
Marks the indicated file as sparse.
- setrange
Fills a specified range of a file with zeroes.
- FileName
Specifies the full path to the file including the file name and extension, for example C:\documents\filename.txt.
- BeginningOffset
Offset within the file to mark as sparse.
- Length
Length of the region in the file to be marked as sparse, in bytes.
Remarks
In a sparse file, large ranges of zeroes may not require disk allocation. Space for nonzero data will be allocated as needed as the file is written.
Only compressed or sparse files can have zeroed ranges known to the operating system.
If the file is sparse or compressed, NTFS may de-allocate disk space within the file. This sets the range of bytes to zeroes without extending the file size.
Examples
To mark a file as sparse, type:
fsutil sparse setflag C:\Temp\sample.txt
Formatting legend
Format | Meaning |
---|---|
Italic |
Information that the user must supply |
Bold |
Elements that the user must type exactly as shown |
Ellipsis (...) |
Parameter that can be repeated several times in a command line |
Between brackets ([]) |
Optional items |
Between braces ({}); choices separated by pipe (|). Example: {even|odd} |
Set of choices from which the user must choose only one |
|
Code or program output |