The DEFRAGMENT FILE command defragments the files given as a
parameter on the command line according to the DEFRAGMENT command
line qualifiers. Use this command to defragment a small number of
files. To defragment a large number of files, use the DEFRAGMENT
VOLUME command.
Format
DEFRAGMENT FILE { file-spec[,...] } [ /QUALIFIERS ]
1 – Parameters
file-spec[,...]
The file-spec parameter identifies the file or files to be
defragmented. You can use wildcards for the file specification.
2 – Restrictions
o A script that has the /CONTINUOUS qualifier may not be named
as the predecessor of another script.
o If you specify the /INTERVAL qualifier, the /PREDECESSOR
qualifier is not allowed.
o If /LEVEL=5 is selected, the /LOG qualifier is required.
o Do not use /BRIEF and /FULL concurrently.
3 – Qualifiers
3.1 /AFTER
/AFTER={time}
/AFTER={current_time} (default)
/NOAFTER
The /AFTER qualifier keeps the script from executing
until after the specified time.
You can specify time as either an absolute time or
as a combination of absolute and delta times. For
complete information on specifying time values, see
the VMS DCL Concepts Manual.
The /AFTER qualifier has three states. It can be
specified with a valid time, it can be omitted from
the command line, or it can be negated (/NOAFTER). If
/AFTER is specified with a valid time, the script is
scheduled to execute after that time. If the /AFTER
qualifier is omitted, the defragmentation software
processes the command as if the /AFTER qualifier
were specified with the current time. If /NOAFTER
is specified, no starting time is associated with
the script being defined. The /NOAFTER qualifier
allows you to define a script without scheduling it
to execute. To subsequently start the script, use the
START subcommand.
3.2 /BRIEF
/BRIEF (default)
/NOBRIEF
The /BRIEF qualifier has meaning only when the /LOG
qualifier is also present. The /BRIEF qualifier
requests a brief log of all actions taken by the
defragmentation process. This log includes beginning
and ending file status information. The /BRIEF
and /FULL qualifiers are mutually exclusive, and
/NOBRIEF produces the same result as /FULL. The
/BRIEF qualifier is the default.
3.3 /CONSOLIDATE_FREESPACE
/CONSOLIDATE_FREESPACE
/NOCONSOLIDATE_FREESPACE (default)
The /CONSOLIDATE_FREESPACE qualifier tells the
Disk File Optimizer to use its free space
consolidation algorithm.
3.4 /DORMANT
/DORMANT=(file-spec[,...])
/NODORMANT (default)
The /DORMANT qualifier indicates files to be
considered dormant when final file placement
decisions are made. Dormant files are placed on the
volume to allow placing other files in optimum disk
locations. In general, they are placed further away
from the ODS-2 data structures than /FREQUENT files
and files not classified in any manner.
If a file is indicated in both the DORMANT and
FREQUENT lists, it is considered dormant. If a file
is indicated in both the EXCLUDE and DORMANT lists,
it is excluded.
NOTE
The amount of free space on the volume, the
number of files currently being accessed, and
other factors influence file placement. Thus,
the Disk File Optimizer does not guarantee
file placement, but makes every effort to place
files as described.
The file-spec field allows wildcard characters.
You can specify wildcard characters in place of
the directory name, file name, file type, or file
version number field. The default file-spec for all
wildcard operations is DISK:[000000...]*.*;*. Thus,
specifying *.TMP;* selects all *.TMP;* files on the
entire volume.
3.5 /EPILOGUE
/EPILOGUE={file-name}
/NOEPILOGUE (default)
The /EPILOGUE qualifier identifies a DCL command file
which DFO executes upon completion of the DEFRAGMENT
FILE operation.
3.6 /EXCLUDE
/EXCLUDE=(file-spec[,...])
/NOEXCLUDE (default)
The /EXCLUDE qualifier specifies files to be excluded
from processing. The defragmentation process ignores
files matching the listed file specifications. Any
file indicated in the EXCLUDE list and in either
the FREQUENT or DORMANT lists is excluded from
processing.
The file-spec field allows wildcard characters.
You can specify wildcard characters in place of
the directory name, file name, file type, or file
version number field. The default file-spec for all
wildcard operations is DISK:[000000...]*.*;*. Thus,
specifying *.TMP;* selects all *.TMP;* files on the
entire volume.
NOTE
The defragmentation process always excludes
system files, open files, files excluded in an
options file (/OPTIONS qualifier), and files
excluded using the /IGNORE qualifier.
3.7 /FREQUENT
/FREQUENT=(file-spec[,...])
/NOFREQUENT (default)
The /FREQUENT qualifier indicates files to be
considered frequently accessed when final file
placement decisions are made. Frequent files are
placed to optimize access speed.
If a file is indicated in both the FREQUENT and
DORMANT lists, it is considered dormant. If a file
is indicated in both the FREQUENT and EXCLUDE lists,
it is excluded.
NOTE
The amount of free space on the volume, the
number of files currently being accessed, and
other factors influence file placement. Thus,
the Disk File Optimizer does not guarantee
file placement, but makes every effort to place
files as described.
The file-spec field allows wildcard characters.
You can specify wildcard characters in place of
the directory name, file name, file type, or file
version number field. The default file-spec for all
wildcard operations is DISK:[000000...]*.*;*. Thus,
specifying *.TMP;* selects all *.TMP;* files on the
entire volume.
3.8 /FULL
/FULL
/NOFULL (default)
The /FULL qualifier requests a full log of all
actions taken by the defragmentation process. The
/FULL qualifier has no meaning if the /LOG qualifier
is absent. The /FULL and /BRIEF qualifiers are
mutually exclusive, and /NOFULL provides the same
functionality as /BRIEF.
3.9 /HOTFILE_DATABASE
/HOTFILE_DATABASE
/NOHOTFILE_DATABASE (default)
The /HOTFILE_DATABASE qualifier causes the
defragmenter to query the appropriate hotfile
database and append the list of hotfiles to the
defragmenter's /FREQUENT file list.
3.10 /IGNORE
/IGNORE=(keyword[,...])
/IGNORE=(PLACED) (default)
/NOIGNORE
The /IGNORE qualifier requests that the
defragmentation process ignore certain types of files
as specified by the following keywords:
o INDEXED-Ignores all RMS indexed files
o NOINDEXED-May defragment RMS indexed files
o PLACED-Ignores all files with explicit placement
flags set in their headers
o NOPLACED-May defragment files with explicit
placement flags
Files indicated by the /IGNORE qualifier are added to
the EXCLUDE list.
The default value (/IGNORE=PLACED) indicates that
files with explicit placement control should be
ignored, and that RMS indexed files should be
defragmented and placed in appropriate locations
on the volume.
3.11 /INHERIT
/INHERIT={script-name}
/NOINHERIT (default)
The purpose of the /INHERIT qualifier is to make
script creation easier. By inheriting most of the
command data from a previously entered script and
modifying only a few items (such as volume name), a
completely new script can be created. The /INHERIT
qualifier creates a database entry for a new script
in the following way:
o Copies all fields from the specified script to the
new script.
o Overwrites any qualifier or parameter values in
the new script with those specified on the command
line.
o Names the new script as appropriate. The user may
specify a script name using the /SCRIPT={script-
name} qualifier. Otherwise, the defragmentation
software creates a unique script name. You can
use wildcards in the script-name specification.
Use an asterisk (*) to take action on all scripts
on the VMScluster system. Use a percent sign (%)
to match a single character in the script-name
specification.
3.12 /INTERVAL
/INTERVAL={delta-time}
/NOINTERVAL (default)
The /INTERVAL qualifier causes a script to execute
at regularly scheduled intervals. The /INTERVAL
qualifier specifies the minimum time between two
consecutive executions of a script.
Specify time as a delta time. Refer to the VMS DCL
Concepts Manual for more information on specifying
times. If you do not specify a time with the
/INTERVAL qualifier, a default value of one day is
used. This value causes the associated script to run
every 24 hours.
If you specify the /AFTER qualifier with the
/INTERVAL qualifier, the first defragmentation
operation occurs at or after the time specified
by the /AFTER qualifier; all subsequent operations
execute at intervals set according to the /INTERVAL
qualifier.
3.13 /LEVEL
/LEVEL={n}
/LEVEL=1 (default)
The defragmentation process selects files for
defragmentation (from among those not excluded) based
on the /LEVEL qualifier. Once a file is selected as
a candidate, the defragmentation process attempts
to fully defragment that file (make it 100 percent
contiguous). Specify the level number as an integer
ranging from one to five:
o /LEVEL=1 (default)
Any file that is not 100 percent contiguous, or
can be selected using levels two through four, is
a candidate for defragmentation.
o /LEVEL=2
Any file whose extents cannot be completely mapped
by the mapping window, or that can be selected
using levels three or four, is a candidate for
defragmentation. The default window value is seven
and can be set for a given volume using:
$ SET VOLUME {device-spec}/WINDOWS=[n]
o /LEVEL=3
Any file with retrieval pointers in more than one
file header, or that can be selected using level
four, is a candidate for defragmentation.
o /LEVEL=4
The defragmentation process for level 4 processing
performs only free space consolidation. This level
is used in conjunction with the /CONSOLIDATE_
FREESPACE qualifier.
o /LEVEL=5
This level requests a volume analysis only;
no defragmentation occurs. The statistical
results are available in the log file, which
is required when /LEVEL=5 is selected (see the
/LOG qualifier). If level five is selected, the
/LEVEL=2 candidate file specifications are listed
in the full log file.
3.14 /LOG
/LOG={file-spec}
/NOLOG (default)
The /LOG qualifier causes the defragmentation process
to create a file containing a list of all its
operations. The information in the log file varies
with the presence of the /FULL or /BRIEF qualifiers.
The /FULL qualifier lists all files analyzed by the
defragmentation process and reports their disposition
during each phase of defragmentation.
The /BRIEF qualifier lists only the statistics of
each phase, such as number of files analyzed, and
number of files defragmented.
3.15 /MAIL_NOTIFICATION
/MAIL_NOTIFICATION
/NOMAIL_NOTIFICATION (default)
The /MAIL_NOTIFICATION qualifier requests that
brief status and termination messages regarding
defragmentation processes be mailed to the mail
distribution list provided in the file DFG$MAIL_
ADDRESS.
3.16 /NODE
/NODE=(node-name[,...])
/NONODE (default)
The /NODE qualifier limits the scope of the
DEFRAGMENT command to the node or set of nodes
specified by /NODE=(node-name). By default,
defragmentation processes may execute on any LMF
licensed node in the system.
3.17 /OPCOM_NOTIFICATION
/OPCOM_NOTIFICATION (default)
/NOOPCOM_NOTIFICATION
The /OPCOM_NOTIFICATION qualifier requests that
brief status and termination messages regarding
defragmentation processes be sent to OPCOM.
3.18 /OPTIONS
/OPTIONS={file-spec}
/NOOPTIONS (default)
The /OPTIONS qualifier provides an alternate method
for associating files with the /DORMANT, /EXCLUDE,
or /FREQUENT qualifiers. If the list of files for any
of these qualifiers is quite large, you can create
a separate file that contains this information. Each
record in the options file consists of a file name
followed by one of the following keywords:
o /EXCLUDE-File to be excluded
o /FREQUENT-File to be considered frequently
accessed
o /DORMANT-File to be considered dormant
The following example shows the contents of an
options file called MYOPTFILE.OPT. This file
specifies that all files on the target device called
FILE1.EXE are frequent files, all files in the
[ARCHIVE] directory are to be excluded, and all files
in the [OLDSTUFF] directory and its subdirectories
are dormant.
FILE1.EXE/FREQUENT
[ARCHIVE]*.*;*/EXCLUDE
[OLDSTUFF...]*.*;*/DORMANT
Files indicated by the /EXCLUDE qualifier and by
either the /DORMANT or /FREQUENT qualifier are
excluded. Files indicated by the /DORMANT qualifier
and by the /FREQUENT qualifier are considered
dormant. This rule is applied equally across all
files specified in the /OPTIONS file, as well as
those associated with these qualifiers on the command
line.
3.19 /PREDECESSOR
/PREDECESSOR={script-name}
/NOPREDECESSOR (default)
The /PREDECESSOR qualifier links scripts. These
scripts execute in sequence; one successfully
completes before the next one begins.
The predecessor script name must exist in the
scheduling database or an error status message is
returned. You can use wildcards in the script-name
specification. Use an asterisk (*) to take action on
all scripts on the VMScluster system. Use a percent
sign (%) to match a single character in the script-
name specification.
3.20 /PRIORITY
/PRIORITY=(DEFAULT=n, MINIMUM=n)
/NOPRIORITY (default)
The /PRIORITY qualifier specifies priorities for the
defragment volume operation.
3.21 /PROLOGUE
/PROLOGUE={file-name}
/NOPROLOGUE (default)
The /PROLOGUE qualifier identifies a DCL command file
which DFO executes just before the DEFRAGMENT FILE
operation starts.
3.22 /RVN
/RVN=n
/RVN=0 (default)
When you have a bound volume set, use this qualifier
to identify a disk from the volume set or all disks
in the volume set. The default of zero tells the
Disk File Optimizer to defragment all disks
in the bound volume set. Specify a relative volume
number (RVN) to defragment a specific disk that
belongs to a bound volume set.
3.23 /SCRIPT
/SCRIPT={script-name}
/NOSCRIPT (default)
The /SCRIPT qualifier assigns a user-supplied name
to a script. If a duplicate script-name is selected,
defragmentation software issues a duplicate script
name error message and does not enter the new script
into the database-no defragmentation takes place.
A script name may be up to 64 characters in length
and may contain any of the following characters:
o Any alphanumeric character
o Underscore ( _ )
o Hyphen ( - )
o Dollar sign ( $ )
Observe the following rules when naming a script:
o You can use any combination of uppercase and
lowercase letters.
o You cannot begin script names using the dollar
sign, but you can include the dollar sign within
the script name. (The dollar sign is reserved for
special use by Digital Equipment Corporation.)
o You should not end a script name with a hyphen,
since the hyphen is the DCL continuation
character.
The VMS DCL Concepts Manual contains more information
on naming conventions.
3.24 /TIME_LIMIT
/TIME_LIMIT={delta-time}
/NOTIME_LIMIT (default)
The /TIME_LIMIT qualifier specifies the maximum
elapsed time allowed for a given defragmentation
operation. If the time limit is exceeded, the
defragmentation process is aborted.
Specify time as a delta time. Refer to the VMS DCL
Concepts Manual for more information on specifying
times.
For linked scripts, the time limit of the first
script applies to the whole set. Time limits
specified with successor scripts apply to these
scripts only.
If the time limit is set unreasonably low, the
defragmentation process may not accomplish useful
defragmentation.
3.25 /WRITE_CHECK
/WRITE_CHECK
/NOWRITE_CHECK (default)
The /WRITE_CHECK qualifier requests that a read-
after-write check be performed on all defragmented
or placed files. This qualifier significantly extends
the execution time of a defragmentation process.
4 – Examples
The following examples show different ways to defragment a
file or group of files and illustrate how to use the common
qualifiers.
1.
$ DEFRAGMENT FILE *.C
This command defragments all files with a .C extension on the
user's current default device. That is, the device portion of the
directory specification returned from a DCL SHOW DEFAULT command.
The RMS default string is [000000...]*.*;*.
2.
DFO> DEFRAGMENT FILE *.C
This command defragments all files with a .C extension on the
user's current default device. The only difference between this
command and the previous example is that this command is entered
from within the Disk File Optimizer utility instead of from
the DCL prompt.
3.
$ DEFRAGMENT FILE *.C/VOLUME=SYS$SYSDEVICE:
This command is the same as the previous one, except that the RMS
default string is now SYS$SYSDEVICE:[000000...]*.C;*.
4.
$ DEFRAGMENT FILE SYS$LOGIN:LOGIN.COM;2/EXCLUDE=*.OLD;*
This command defragments the user's LOGIN.COM file and excludes
all files with a .OLD extension.
5.
$ DEFRAGMENT FILE/INHERIT=OTHER_FILE_SCRIPT.NOAFTER
This commands creates a file script identical to the OTHER_
FILE_SCRIPT and allows the Disk File Optimizer to name
it (DFG$XXX).
6.
$ DEFRAGMENT FILE *.RDB/INHERIT=X
$_/SCRIPT=Y/VOLUME=SYS$SYSTEM
This command creates a script called Y that defragments all RDB
files on SYS$SYSTEM. Other script characteristics, such as log
file, are inherited from script X.