FSUTIL.exe

File and Volume specific commands, Hardlink management, Quota management, USN, Sparse file, Object ID and Reparse point management.

Filename management options (for the Local System):

FSUTIL 8dot3name
    Show the current setting for shortname behaviour:
    FSUTIL 8dot3name query
          
    Scan for affected registry entries:
    FSUTIL 8dot3name scan [/s] [/l log_file] [/v] DirectoryPath       
         /s  Recurse to subdirectories.
         /l  Log to file.
         /v  Verbose, output log to the console.

    Change the setting for shortname behaviour:
    FSUTIL 8dot3name set [0 through 3] [volume_Path] 1 | 0]

        When a volume is not specified, this updates the registry.
        registry path: HKLM\SYSTEM\CurrentControlSet\Control\FileSystem  (NtfsDisable8dot3NameCreation)
        
          0 - Enable 8dot3 creation on all volumes
          1 - Disable 8dot3 creation on all volumes
          2 - Set 8dot3 creation on a per volume basis
          3 - Disable 8dot3 creation on all volumes other than the system volume.
          
        When a volume is  specified, this updates individual volume's on disk flag.
        This operation is only meaningful if the above registry value is set to 2.
          0 - Enable 8dot3 creation on this volume
          1 - Disable 8dot3 creation on this volume

          Eg :  fsutil 8dot3name set E: 1

    Remove the shortnames for all files within a directory:
    FSUTIL 8dot3name strip [/t] [/s] [/f] [/l log_file] [/v] DirectoryPath
    
        This command will permanently remove 8dot3 filenames from a volume. Stripping will not be performed on any
        files with full path names longer than the maximum path_length of 260 chars.

        This command will also list any registry keys pointing to the stripped filenames but will not
        modify the affected registry keys.

        **WARNING** If there are affected registry keys and you use the override switch /f
        it is recommended that you backup your volume as it may lead to unexpected
        application failures including the inability to uninstall.

          /t - Test mode, perform all operations except the actual stripping of filenames.
          /s - Recurse all subdirectories
          /f - Force, Strip the directory 8.3 filenames even if there are registry conflicts.
          /v - Verbose mode, output log to the console.
          /l - Specify an output log file, if not specified this will default
               to "%temp%\8dot3_removal_log@(GMT YYYY-MM-DD HH-MM-SS)"

          Eg :  fsutil 8dot3name strip /t /l SS64.log /s D:\datafiles

View or set File system Behavior:

FSUTIL behavior

View File system Behavior:

    FSUTIL behavior query option

Set File system Behavior:

    FSUTIL behavior set option

      Where option is one of:
       AllowExtChar {0|1}       Allow extended characters in filenames
       BugcheckOnCorrupt {0|1}  Enable bugcheck
       Disable8dot3 [volumePath] sfnNum
          sfnNum is between 0 and 3 
           0 = Create short file names (default).
           1 = don’t create short file names. 
           2 = Set 8.3 names on a per volume basis.
           3 = Disable 8.3 names on all volumes except the system volume.
       DisableCompression {0|1} Disable compression
       DisableCompressionlimit {0|1} 
       DisableEncryption {0|1}  Disable encryption
       DisableDeleteNotify {0| [NTFS|ReFS] 1} SSD TRIM Delete notifications for all volumes
                                 0=TRIM enabled, 1=TRIM disabled.
       DisableFileMetadataOptimization {0|1|2|3} 0=Enable, 1=Disable   file metadata optimization.
                                                 2=Disable incremental file metadata optimization only.
                                                 3=Disable all file metadata optimization
       DisableLastAccess {0|1|2|3}  0=Enable last-access updates  1=Disable / Don’t generate last-access times,
                                    2=System managed Enabled      3=System managed Disabled.
                                    When system managed, it allows system policy to control this.
                                    Which may in turn be overridden by Group Policy.
                                    This parameter can affect programs such as Backup and Remote Storage.
       DisableSpotCorruptionHandling {0|1}   Disable (1) or Enable spot corruption handling.
                                             This feature allows system administrators to run CHKDSK to analyze the state
                                             of a volume without taking it offline. We do not recommend disabling this feature.
       DisableWriteAutoTiering [voumePath 0|1]   1=Disable ReFS v2 auto tiering logic for tiered volumes.
       EncryptPagingfile {0|1}  Encrypt or do not encrypt the memory paging file.
       MemoryUsage {1|2}           Paged-pool memory cache, 1=default
       QuotaNotify NumSeconds   Log quota violations, default=3600 seconds
       MftZone {1|2|3|4}        Set MFT Zone, multiple of 200MB
       SymlinkEvaluation L2L:{0|1}    Local to local symbolic links
       SymlinkEvaluation L2R:{0|1}    Local to remote symbolic links
       SymlinkEvaluation R2R:{0|1}    Remote to local symbolic links
       SymlinkEvaluation R2L:{0|1}    Remote to remote symbolic links

  1 = Set the option to True/On/Enable.
  0 = Set the option to False/Off/Disable.

    Eg :  fsutil behavior set disablelastaccess 1

With 8.3 filennames disabled you'll notice a performance improvement only with a large number of files (over 300,000) in relatively few folders where a lot of the filenames start with similar names. Not having 8.3 filenames available will prevent the use of old applications such as Word 2.0 and Excel 4.0

If you have a lot of small files, you might need a larger Master File Table to avoid MFT fragmentation:
FSUTIL behavior set mftzone 2 will reserve approximately twice the space for the MFT.
The exact ratios for each setting are undocumented because they are not standardized and may change in future releases.
Pre Windows 7 the following ratios were used:
1 = 12.5 % (default)
2 = 25%
3 = 37.5%
4 = 50%

This won’t affect existing disk partitions, after changing the mftzone size, reboot the machine and create a new partition.

Increasing the MFT zone does not decrease the disk space available for data files.

The NTFS last access time attribute can affect performance on very busy drives, if you disable it, the time set will be the Creation Time.
FSUTIL behavior set disablelastaccess 1

Mark a File system as dirty to invoke Chkdsk:

FSUTIL dirty
    Query the dirty bit for a volume:
    FSUTIL dirty query volume [pathname]

    Mark a file system as dirty:
    FSUTIL dirty set volume [pathname]

    Marking a disk as dirty will prompt a Chkdsk at next boot
    Eg :  fsutil dirty query C:

File operations:

FSUTIL file

Create a new file of a specific size:

    FSUTIL file createnew filename length

    Eg : fsutil file createnew C:\testfile.txt 1000

Find a file by user name / sAMAccountName (only if Disk Quotas are enabled):

    FSUTIL file findbysid user directory

    Eg : fsutil file findbysid scottb C:\users

Query the allocated ranges for a file:

    FSUTIL file queryallocranges offset=val length=val filename

    offset : File Offset, the start of the range to query
    length : Size, in bytes, of the range

    Eg :  fsutil file queryallocranges offset=1024 length=64 C:\Temp\sample.txt

Queries extents for a file:

    FSUTIL file queryextents [/R] filename [startingvcn [numvcns]]

Query the file ID of a file:

    FSUTIL file queryFileid filename

Display a random link name for the file ID (in most cases the file ID will only have one link name):

    FSUTIL file queryFileNamebyid volume fileID

Perform an immediate compaction of the metadata for a given file:

    FSUTIL file queryoptimizemetadata filename

Query the valid data length for a file:

    FSUTIL file queryvaliddata [/R] [/D] filename

Enable or disable linux style Case Sensitivity support to a folder (Windows 10 1803+)
Prior to 1803, this option required 'Windows Subsystem for Linux' to be enabled.
Case sensitivity is not automatically inherited but must be applied to each folder.

    FSUTIL file SetCaseSensitiveInfo C:\folder\path enable
    FSUTIL file SetCaseSensitiveInfo C:\folder\path disable

Set the EOF of the given file:

    FSUTIL file seteof filename length

Set the short NTFS filename for a file:

    FSUTIL file setshortname filename ShortName

    Eg :  fsutil file setshortname C:\testfile.txt tes1.txt

Set the valid data length for a file:

    FSUTIL file setvaliddata filename datalength

    Eg :  fsutil file setvaliddata C:\testfile.txt 4096

Set the zero data for a file:

    FSUTIL file setzerodata offset=val length=val filename

    offset : File offset, the start of the range to set to zeroes
    length : Byte length of the zeroed range
        Eg :  fsutil file setzerodata offset=100 length=150 C:\Temp\sample.txt

Display filesystem information:

FSUTIL fsinfo

List all drives (including mapped and Subst drives):

    FSUTIL fsinfo drives

Query drive type for a drive:

    FSUTIL fsinfo drivetype volume pathname

    Eg :  fsutil fsinfo drivetype C:
    
    Script to list all drives on the local computer:
    @Echo off
    :: Store all the drive letters currently in use in a variable
    For /f "tokens=*" %%L in ('FSUTIL fsinfo drives') do (set _drives=%%L)
    :: Remove the first 8 characters - the 'Drives:' prefix 
    :: this may need to adjusted for other languages/locales
    Set _drives=%_drives:~8%
    :: Find and Display the drive type of each drive
    For %%D in (%_drives%) do (FSUTIL fsinfo drivetype %%D)

Query volume information:

    FSUTIL fsinfo volumeinfo volume pathname

    Eg :  fsutil fsinfo volumeinfo C:\

Query NTFS specific volume information:

    FSUTIL fsinfo ntfsinfo volume pathname

    Eg :  fsutil fsinfo ntfsinfo C:
         The cluster size of the disc is shown as 'Bytes Per Cluster' (default= 4K). 

Query file system statistics:

    FSUTIL fsinfo statistics volume pathname

    Eg :  fsutil fsinfo statistics C:

Manage hardlink(s):

FSUTIL hardlink

List hardlink(s) for a file:

    FSUTIL hardlink list filename

Create hardlink(s) for a file:

    FSUTIL hardlink create New_filename Existing_filename
    Eg :  fsutil hardlink create c:\foo.txt c:\bar.txt

    See also MKLINK

Edit an object identifier:

FSUTIL objectid

Query or Edit an objectID. Deleting or setting an object identifier can result in the loss of data from portions of a file, up to and including entire volumes of data.

    FSUTIL objectid {query | set | delete | create}

QUOTA Management:

FSUTIL quota

Query or edit the quota limits for a volume:

    FSUTIL quota {query|disable|track|enforce } C:
    
    FSUTIL quota violations
    
    FSUTIL quota modify volume_pathname Threshold Limit UserName

    Eg : fsutil quota modify c: 3000 5000 domain\user

Self healing management:

FSUTIL repair

Administer and monitor NTFS self-healing repair operations:

    FSUTIL repair query VolumePath

    FSUTIL repair enumerate VolumePath [LogName]

    FSUTIL repair set VolumePathflags
       Flags: 0x01 - enable general repair
              0x09 - warn about potential data loss
              0x10 - Disable general repair and bugcheck once on first corruption.

    FSUTIL repair wait VolumePath [wait_type]
       Wait types: 0 - Wait for all repairs (default)
                   1 - Wait for the current repair

    FSUTIL repair initiate VolumePath file_ref#
       file_ref# : File reference including segment number of the file.

Query a reparse point:

FSUTIL reparsepoint

List reparse points:

    FSUTIL reparsepoint query filename

    Eg : fsutil reparsepoint query C:\Server

Delete a reparse point:

    FSUTIL reparsepoint delete filename
    A common reason for long directory name problems is a Windows bug which creates a
    recursive reparsepoint for a directory called "Application Data\Application Data\"
    Eg : cd "\users\myacct\appdata\local\application data"
         fsutil reparsepoint delete "application data"

Transactional Resource Manager:

FSUTIL resource

Create a Secondary Transactional Resource Manager, start or stop a Transactional Resource Manager:

    Create new:
    FSUTIL resource create RM_root_pathanme
    FSUTIL resource info RM_root_pathanme

    Specify whether a default Transactional Resource Manager will clean the transactional metadata on the next mount:
    FSUTIL resource setautoreset {true|false} RM_root_pathanme

    Prefer availability over consistency:
    FSUTIL resource setavailable RM_root_pathanme

    Prefer consistency over availability:
    FSUTIL resource setconsistent RM_root_pathanme

    FSUTIL resource setlog [growth {Containers containers | Percent percent} RmRootPathname]
                              [maxextents Containers RmRootPathname]
                                 [minextents Containers RmRootPathname]
                                    [mode {full|undo} RmRootPathname] [rename RmRootPathname]
                                       [shrink Percent RmRootPathname] [size Containers RmRootPathname]

    FSUTIL resource start RM_root_pathanme RM_log_pathanme
    FSUTIL resource stop RM_root_pathanme RM_log_pathanme

Sparse files:

FSUTIL sparse

Set sparse file properties:

    FSUTIL sparse queryflag filename
    FSUTIL sparse setflag filename

    FSUTIL sparse queryrange filename
    FSUTIL sparse setrange filename Beginning_offset Length
    
    Eg : fsutil sparse queryflag "C:\My Test.txt"

Sparse files provide a method of saving disk space for files that contain meaningful data as well as large sections of data composed of zeros. If an NTFS file is marked as sparse, then disk clusters are allocated only for the data explicitly specified by the application.
e.g. The Indexing Service, stores it's catalogs as sparse files.

Management storage tier functions

FSUTIL tiering

Manage storage tier functions, such as setting and disabling flags and listing of tiers:

    FSUTIL tiering [clearflags] volume flags
    FSUTIL tiering [queryflags] volume
    FSUTIL tiering [regionlist] volume
    FSUTIL tiering [setflags] volume flags
    FSUTIL tiering [tierlist] volume

    Eg : fsutil tiering tierlist C:

NTFS transactions.

FSUTIL transaction

Manage NTFS transactions:

    FSUTIL transaction commit guid
    FSUTIL transaction list
    FSUTIL transaction fileinfo filename
    FSUTIL transaction query {files|all} guid
    FSUTIL transaction rollback guid

The Update Sequence Number (USN) change journal:

FSUTIL usn

Manage the update sequence number (USN) change journal:

    FSUTIL usn createjournal m=maxSize a=AllocationDelta VolumePath
    FSUTIL usn deltejournal {/D | /N} VolumePath
       Deleting the change journal impacts the File Replication and the Indexing Service, it
       will require a complete (and time-consuming) scan of the volume. 
    FSUTIL usn enablerangetracking VolumePath [options]

    FSUTIL usn enumdata file_ref# lowUSN highUSN VolumePath
    FSUTIL usn queryjournal VolumePath
    FSUTIL usn readdata filename
    FSUTIL usn readjournal [c=ChunkSize s=FileSizeThreshold] VolumePath

Volume management, Dismount or query free space

FSUTIL volume

Dismount a volume, or query the hard drive to determine how much free space is currently available or which file is using a particular cluster:

    FSUTIL volume allocationreport VolumePath
    FSUTIL volume diskfree VolumePath
    FSUTIL volume dismount VolumePath
    FSUTIL volume filelayout VolumePath fileid
    FSUTIL volume list
    FSUTIL volume querycluster VolumePath cluster [cluster...]

Windows Image (WIM)-backed files:

FSUTIL wim

Functions to discover and manage Windows Image (WIM)-backed files.:

    FSUTIL wim enumfiles DriveName DataSource
    FSUTIL wim enumwims DriveName
    FSUTIL wim queryfile Filename
    FSUTIL wim removewim DriveName DataSource

To run FSUTIL, you must be logged on as an administrator or a member of the Administrators group.

Bugs

FSUTIL outputs a NULL character (not a space) after every drive specifier, this can cause difficulty when piping the output of fsutil into other commands (particularly FOR). The output from FSUTIL varies by OS see this forum thread for more detail.

Some features in fsutil are reported to not work correctly under FAT or FAT32 volumes e.g. FSUTIL dirty query.

“You can tune a file system, but you can’t tune a fish” ~ Sun man page for tunefs

Related commands

Q982018 - FSUTIL update - compatibility with Advanced Format Disks.
CACLS - Change file permissions.
CHKDSK - Check Disk - check and repair disk problems
CHKNTFS - Check the NTFS file system.
DevCon - Device Manager Command Line Utility.
DIRUSE - Display disk usage.
DISKSHADOW - Volume Shadow Copy Service.
MKLINK - Create a symbolic link (linkd)
PowerShell: New-Item -ItemType SymbolicLink
PSINFO -d - Display drive information.
Q174619 - MFT How NTFS reserves space for its Master File Table.


 
Copyright © 1999-2024 SS64.com
Some rights reserved