Fsutil: usn

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Fsutil: usn

Typically used by support professionals. Manages the update sequence number (USN) change journal, which provides a persistent log of all changes made to files on the volume. As files, directories, and other NTFS objects are added, deleted, and modified, NTFS enters records into the USN change journal, one for each volume on the computer. Each record indicates the type of change and the object changed. New records are appended to the end of the stream.

Programs can consult the USN change journal to determine all the modifications made to a set of files. The USN change journal is much more efficient than checking time stamps or registering for file notifications. The USN change journal is enabled and used by the Indexing Service, File Replication service (FRS), Remote Installation Services (RIS), and Remote Storage.

Syntax

fsutil usn [createjournal] **m=**MaximumSize **a=**AllocationDelta VolumePathname

fsutil usn [deletejournal] {/D | /N} VolumePathname

fsutil usn [enumdata] FileRef LowUsn HighUsn VolumePathname

fsutil usn [queryjournal] VolumePathname

fsutil usn [readdata] FileName

Parameters
  • createjournal
    Creates a USN change journal.
  • m= MaximumSize
    Specifies the maximum size, in bytes, that NTFS allocates for the change journal.
  • a= AllocationDelta
    Specifies the size, in bytes, of memory allocation that is added to the end and removed from the beginning of the change journal.
  • VolumePathname
    Specifies the drive letter (followed by a colon).
  • deletejournal
    Deletes or disables an active USN change journal.
**Caution**

  - Deleting the change journal impacts the File Replication service (FRS) and the Indexing Service, since it would require these services to perform a complete (and time consuming) scan of the volume. This in turn negatively impacts FRS SYSVOL replication and replication between DFS link alternates while the volume was being rescanned.  
      
  • /D
    Disables an active USN change journal, and returns I/O control while the change journal is being disabled.
  • /N
    Disables an active USN change journal and returns I/O control only after the change journal is disabled.
  • enumdata
    Enumerates and lists the change journal entries between two specified boundaries.
  • FileRef
    Ordinal position within the files on the volume at which the enumeration is to begin.
  • LowUsn
    Lower boundary of the range of USN values used to filter which records are returned. Only records whose last change journal USN is between or equal to the LowUsn and HighUsn member values are returned.
  • HighUsn
    Upper boundary of the range of USN values used to filter which files are returned.
  • queryjournal
    Queries a volume's USN data to gather information about the current change journal, its records, and its capacity.
  • readdata
    Read the USN data for a file.
  • FileName
    Specifies the full path to the file including the file name and extension, for example C:\documents\filename.txt.
Remarks
  • Using createjournal

    If a change journal already exists on a volume, the createjournal parameter updates the change journal's MaximumSize and AllocationDelta parameters. This allows you to expand the number of records that an active journal maintains without having to disable it.

  • Using **m=**MaximumSize

    The change journal can grow larger than this target value, but the change journal is truncated at the next NTFS checkpoint to less than this value. NTFS examines the change journal and trims it when its size exceeds the value of MaximumSize plus the value of AllocationDelta. At NTFS checkpoints, the operating system writes records to the NTFS log file that allow NTFS to determine what processing is required to recover from a failure.

  • Using **a=**AllocationDelta

    The change journal can grow to more than the sum of the values of MaximumSize and AllocationDelta before being trimmed.

  • Using deletejournal

    Deleting or disabling an active change journal is very time consuming, because the system must access all the records in the master file table (MFT) and set the last USN attribute to zero. This process can take several minutes, and can continue after the system restarts, if necessary. During this process, the change journal is not considered active, nor is it disabled. While the system is disabling the journal, it cannot be accessed, and all journal operations return errors. You should use extreme care when disabling an active journal, because it adversely affects other applications using the journal.

Examples

To create a USN change journal on drive C, type:

fsutil usn createjournal m=1000 a=100 C:

To delete an active USN change journal on drive C, type:

fsutil usn deletejournal /D C:

To enumerate and list the change journal entries between two specified boundaries on drive C, type:

fsutil usn enumdata 1 0 1 C:

To query USN data for a volume on drive C, type:

fsutil usn queryjournal C:

To read the USN data for a file in the temp folder on drive C, type:

fsutil usn readdata 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

Courier font

Code or program output

See Also

Concepts

Fsutil
Command-line reference A-Z
Command shell overview