text
stringlengths
0
4.23k
<shortname>
Specifies the file's short name.
setvaliddata
Sets the valid data length for a file on an NTFS volume.
<datalength>
Specifies the length of the file in bytes.
setzerodata
Sets a range (specified by offset and length) of the file to zeroes, which empties the file. If the file is a sparse file, the underlying allocation units are decommitted.
<length>
<username>
<directory>
<offset>
<length>
<filename>
<startingvcn>
<numvcns>
<volume>
<fileid>
<shortname>
<datalength>
Remarks
In NTFS, there are two important concepts of file length: the end-of-file (EOF) marker and the Valid Data Length (VDL). The EOF indicates the actual length of the file. The VDL identifies the length of valid data on disk. Any reads between VDL and EOF automatically return 0 to preserve the C2 object reuse requirement.
The setvaliddata parameter is only available for administrators because it requires the Perform volume maintenance tasks (SeManageVolumePrivilege) privilege. This feature is only required for advanced multimedia and system area network scenarios. The setvaliddata parameter must be a positive value that is greater than the current VDL, but less than the current file size.
It is useful for programs to set a VDL when:
Writing raw clusters directly to disk through a hardware channel. This allows the program to inform the file system that this range contains valid data that can be returned to the user.
Creating large files when performance is an issue. This avoids the time it takes to fill the file with zeroes when the file is created or extended.
Examples
To find files that are owned by scottb on drive C, type:
fsutil file findbysid scottb c:\users
To query the allocated ranges for a file on an NTFS volume, type:
fsutil file queryallocranges offset=1024 length=64 c:\temp\sample.txt
To optimize metadata for a file, type:
fsutil file optimizemetadata C:\largefragmentedfile.txt
To query the extents for a file, type:
fsutil file queryextents C:\Temp\sample.txt
To set the EOF for a file, type:
fsutil file seteof C:\testfile.txt 1000
To set the short name for the file, longfilename.txt on drive C to longfile.txt, type:
fsutil file setshortname c:\longfilename.txt longfile.txt
To set the valid data length to 4096 bytes for a file named testfile.txt on an NTFS volume, type:
fsutil file setvaliddata c:\testfile.txt 4096
To set a range of a file on an NTFS volume to zeros to empty it, type:
fsutil file setzerodata offset=100 length=150 c:\temp\sample.txt
fsutil fsinfo
Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows 10, Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8
Lists all drives, queries the drive type, queries volume information, queries NTFS-specific volume information, or queries file system statistics.
Syntax
fsutil fsinfo [drives]
fsutil fsinfo [drivetype] <volumepath>
fsutil fsinfo [ntfsinfo] <rootpath>
fsutil fsinfo [statistics] <volumepath>
fsutil fsinfo [volumeinfo] <rootpath>
Parameters
Parameter
Description
drives
Lists all drives in the computer.
drivetype
Queries a drive and lists its type, for example CD-ROM drive.
ntfsinfo
Lists NTFS specific volume information for the specified volume, such as the number of sectors, total clusters, free clusters, and the start and end of the MFT Zone.
sectorinfo
Lists information about the hardware's sector size and alignment.
statistics
Lists file system statistics for the specified volume, such as metadata, log file, and MFT reads and writes.
volumeinfo
Lists information for the specified volume, such as the file system, and whether the volume supports case-sensitive file names, unicode in file names, disk quotas, or is a DirectAccess (DAX) volume.
<volumepath>: