A method of defragmenting a Windows NT file system volume includes the
step of selecting a file record which is stored in a master file table
associated with the Windows NT file system volume, in which one or more
non-resident attributes are associated with the file record, and data
associated with one or more non-resident attributes is stored outside the
file record in one or more data extents. The method also includes the
step of querying the one or more data extents without opening the one or
more non-resident attributes. For example, the one or more data extents
may be queried using a FSCTL_GET_NTFS_FILE_RECORD command. Moreover, the
method includes the step of determining whether to defragment the one or
more non-resident attributes based on information obtained from querying
the one or more data extents. For example, the information may include a
location of the one or more non-resident attributes.