大网数据广告活动
Windows排障命令

fsutil sparse

· 52CE 我爱测

Reference article for the fsutil sparse command, which manages sparse files.

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 with a zero value and that there's no disk space representing these zeros. 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 deallocated from anywhere in the file.

Syntax

fsutil sparse [queryflag] <filename>
fsutil sparse [queryrange] <filename>
fsutil sparse [setflag] <filename>
fsutil sparse [setrange] <filename> <beginningoffset> <length>

Parameters

Parameter Description
queryflag Queries sparse.
queryrange Scans a file and searches for ranges that may contain nonzero data.
setflag Marks the indicated file as sparse.
setrange Fills a specified range of a file with zeros.
<filename> Specifies the full path to the file including the file name and extension, for example C:\documents\filename.txt.
<beginningoffset> Specifies the offset within the file to mark as sparse.
<length> Specifies the length of the region in the file to be marked as sparse (in bytes).
Remarks
  • All meaningful or nonzero data is allocated, whereas all non-meaningful data (large strings of data that is composed of zeros) is not allocated.

  • In a sparse file, large ranges of zeroes may not require disk allocation. Space for nonzero data is allocated as needed when 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 named sample.txt in the c:\temp directory as sparse, type:

fsutil sparse setflag c:\temp\sample.txt

Related links

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 10/16/2017
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。