search
top

Using fsutil to Manage Windows Filesystems

Introduction

Fsutil performs tasks that are related to file allocation table (FAT) and NTFS file systems, such as managing reparse points, managing sparse files, or dismounting a volume.

 

Command Syntax

Fsutil 8dot3name Queries or changes the settings for short name behavior on the system, for example, generates 8.3 character-length file names. Removes short names for all files within a directory. Scans a directory and identifies registry keys that might be impacted if short names were stripped from the files in the directory.

This parameter applies to: Windows Server 2008 R2 and Windows 7.

Fsutil behavior Queries or sets NTFS volume behavior, which includes:

  • The last access time stamp on NTFS volumes
  • How often quota events are written to the system log
  • The internal cache levels of NTFS paged pool and NTFS non-paged pool memory
  • The amount of disk space reserved for the master file table (MFT) Zone
  • The silent deletion of data when the system encounters corruption on an NTFS volume.
Fsutil dirty Queries whether the volume’s dirty bit is set or sets a volume’s dirty bit. When a volume’s dirty bit is set, autochk automatically checks the volume for errors the next time the computer is restarted.
Fsutil file Finds a file by user name (if Disk Quotas are enabled), queries allocated ranges for a file, sets a file’s short name, sets a file’s valid data length, sets zero data for a file, creates a new file of a specified size, finds a file ID if given the name, or finds a file link name for a specified file ID.
Fsutil fsinfo Lists all drives and queries the drive type, volume information, NTFS-specific volume information, or file system statistics.
Fsutil hardlink Creates a hard link (a directory entry for a file). Every file can be considered to have at least one hard link. On NTFS volumes, each file can have multiple hard links, so a single file can appear in many directories (or even in the same directory, with different names). Because all of the links reference the same file, programs can open any of the links and modify the file. A file is deleted from the file system only after all links to it are deleted. After you create a hard link, programs can use it like any other file name.

Lists the hard links for a specified file.

Fsutil objectid Manages object identifiers, which are used by the Windows operating system to track objects such as files and directories.
Fsutil quota Manages disk quotas on NTFS volumes to provide more precise control of network-based storage. Disk quotas are implemented on a per-volume basis and enable both hard- and soft-storage limits to be implemented on a per-user basis.
Fsutil repair Queries or sets the self-healing state of the volume. Self-healing NTFS attempts to correct corruptions of the NTFS file system online without requiring Chkdsk.exe to be run.

Includes initiating on-disk verification and waiting for repair completion.

Fsutil reparsepoint Queries or deletes reparse points (NTFS file system objects that have a definable attribute containing user-controlled data). Reparse points are used to extend functionality in the input/output (I/O) subsystem. They are used for directory junction points and volume mount points. They are also used by file system filter drivers to mark certain files as special to that driver.

This parameter applies to: Windows Vista, Windows Server 2008, Windows Server 2008 R2, and Windows 7.

Fsutil resource Creates a Secondary Transactional Resource Manager, starts or stops a Transactional Resource Manager, or displays information about a Transactional Resource Manager and modifies the following behavior:

  • Whether a default Transactional Resource Manager will clean its transactional metadata at the next mount
  • The specified Transactional Resource Manager to prefer consistency over availability
  • The specified Transaction Resource Manager to prefer availability over consistency
  • The characteristics of a running Transactional Resource Manager

This parameter applies to: Windows Vista, Windows Server 2008, Windows Server 2008 R2, and Windows 7.

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 no disk space is used to represent these zeros. 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 as zeros (by default in accordance with the C2 security requirement specification). Sparse file support allows data to be deallocated from anywhere in the file.
Fsutil transaction Commits a specified transaction, rolls back a specified transaction, or displays the following information:

  1. A list of currently running transactions
  2. Transaction information for a specific file
  3. Information for a specific transactionThis parameter applies to: Windows Vista, Windows Server 2008, Windows Server 2008 R2, and Windows 7.
Fsutil usn Manages the update sequence number (USN) change journal, which provides a persistent log of all changes made to files on the volume.
Fsutil volume Manages a volume. Dismounts a volume, queries to see how much free space is available on a disk, or finds a file that is using a specified cluster.

Using fsutil

Now we know what fsutil can do, so lets try a few commands.

The subcommand “behavior”

There are several features of the NTFS system that can be configured to possibly speed up the system and tweaks involving this subcommand are fairly commonly mentioned on the Web and in books. The subcommand “behavior” has two further subcommands. They are “query”, which displays the current values for option settings and “set”, which is used to change settings. The options that are available are shown below. Commands have the form

fsutil behavior query {option} {value}

behavour_query
and

fsutil behavior set {option} {value}

behavior_set

Commands involving “set” can change Registry entries and may require a reboot to take effect.

Find the current settings

To display the current settings on a system, use a command with “query” such as in this instance disablelastaccess.

fsutil behavior query disablelastaccess

behavior_disablelastaccess

Disable short file names to speed up Windows
One tweak that is mentioned fairly often disables the creation of short 8,3 format file names. By default both Windows XP (NTFS) and up create file names in the old 8.3 format for all files in addition to whatever the regular name is. This is to ensure compatibility with some programs that still linger and require the old file naming format from DOS days. If you are sure that you do not have any 16-bit programs or programs that require the old format, disabling this extra name creation can possibly speed up your system.The command is:

fsutil behavior set disable8dot3 1

Note that the Windows XP environment variables %TEMP% and %TMP% typically use short names. Program installations sometimes use these variables If this change causes trouble and you need to restore the short name function, the command is

fsutil behavior set disable8dot3 0

Also, this can be controlled by Group policy and changes may receive an error such as below.

disable8dot3_error

Disable timestamp for last access to a file to speed up Windows

Another frequently seen recommendation is to disable the setting that keeps track of the last time a file. was accessed. Removing the necessity for the system to keep reading and writing this information may speed up Windows Explorer. The command is:

fsutil behavior set disablelastaccess 1

Note that some backup programs may need this information. If you wish to restore the timestamp, the command is:

fsutil behavior set disablelastaccess 0

Disable Encrypting File System

Windows Vista Business and Ultimate come with a feature called the Encrypting File System (EFS). This can be fairly demanding of resources and if you have a marginal system that does not require this security feature, you can turn EFS off. The command is

fsutil behavior set disableencryption 1

To restore EFS, use the command

fsutil behavior set disableencryption 0

Fsutil has some very advanced methods for managing hard drives but I will mention only a few.

Obtaining drive lists for a computer
There are other ways of doing this but you can obtain a list drives by letter type by using the command:

fsutil fsinfo drives

fsutil_fsinfo_drives

Obtaining drive type
You can obtain the drive type for a given drive with the command:

fsutil fsinfo drivetype C:

fsutil_fsinfo_drivetype
The command will return “Fixed drive”, “CD-ROM drive”, or “Removable drive”.

Obtaining some general volume information
You can obtain a list of various volume parameters with:

fsutil fsinfo volumeinfo C:

fsutil_fsinfo_volumeinfo

Determining amount of free space on a drive
To determine the amount of free space on a drive, use the command

fsutil volume diskfree C:

fsutil_diskfree

Conclusion

As we can see fsutil gives us another command line tool to add to our admin toolkit in supporting and maintaining our Windows systems! Explore the other subcommands available to this tool!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top