How to exclude files, folders and drives from backups in Spectrum Protect

The HFS Spectrum Protect package comes with a set of default exclusions coded in the Spectrum Protect configuration file. While these default exclusions should not generally be modified or removed, they can be added to.

Warning: Spectrum Protect exclude rules cannot be used as a temporary means of excluding data from backup.  If you add an exclude rule for files or folders, then those files or folders are immediately marked for deletion on the Spectrum Protect server.  If you at any time wish to back up those files or folders, you would need to resend all that you have previously excluded.  The data cannot be unexcluded or reintegrated into your backup without a fresh resend.  Please use this facility only to permanently exclude data from backup.

To provide you with the best advice, please select the type of exclude rule that you need from the following list:

 

Expand All

You can exclude files from backup either in the Spectrum Protect graphical user interface (GUI) or by editing the Spectrum Protect configuration file.  The former is generally the simpler and easier method to use.


Excluding files from backup using the GUI

To exclude a file or a range of similar files from backup in the GUI:

Start the GUI:

  1. From the Windows Start menu search for backup, then launch Backup-Archive GUI.

Start the GUI:

  1. Run Applications, then IBM Spectrum Protect > IBM Spectrum Protect Tools for Administrators > IBM Spectrum Protect
  2. When prompted, provide your local administrator password.

Start the GUI:

  1. Run dsmj as root.

Then:

  1. Select Edit Client Preferences Include-Exclude > Add
  2.  On the Define Include-Exclude Options window, select the following:
    • Category: Backup
    • Type: Exclude
    • File or Pattern: Select Browse and choose a file that you want to exclude.
  3. Depending on how many files you need to exclude:
    • If this is the only file you wish to exclude, proceed to the next step.
    • If there are a few more files to exclude, repeat the above step as often as is needed.
    • If there is a range of similarly named or similarly located files that you wish to exclude, details of how to edit the File or Pattern line to match a range of files are provided in the basic exclude examples below.
  4. After confirming your selections, verify that your new exclude rules are working correctly by attempting to perform a manual backup of one or more of your excluded files.  It should be marked with a barred red circle, and so be impossible to back up.

Excluding files from backup by editing the Spectrum Protect configuration file

To exclude a file or a range of similar files by editing the Spectrum Protect configuration file:

  1. Locate the Spectrum Protect configuration file, dsm.opt in Windows, dsm.sys on a Mac or Linux, or incl.excl for very old Linux Spectrum Protect clients.

  2. In Windows, run Notepad as administrator, or move the dsm.opt file to the desktop before editing it.

  3. Edit the Spectrum Protect configuration file in a text editor and add the additional exclude rules to the end of the file.  For example:

    exclude "C:\Users\jasonz\Documents\to-be-excluded-1.docx" 

    Please do not alter or remove any existing rules or other lines of dsm.opt/dsm.sys.

  4. If there is a range of similarly named or similarly located files that you wish to exclude, details of how to change your exclude line to match a range of files are provided in the basic exclude examples below.

  5. In Windows, if you moved the dsm.opt file before editing it, now move it back.

  6. After confirming your selections, verify that your new exclude rules are working correctly by either:
    • Attempt to perform a manual backup of one or more of your excluded files.  The files should be marked with a barred red circle, and so be impossible to back up.
    • Check the include-exclude list on the Spectrum Protect command line by running dsmc q inclexcl.  The output lists the order in which the directives will be processed.

You can exclude folders from backup either in the Spectrum Protect graphical user interface (GUI) or by editing the Spectrum Protect configuration file.  The former is generally the simpler and easier method to use.

Please note that these instructions are only valid for folders and cannot be used for the top-level of a drive or partition, or for a mountpoint.  If you wish to exclude, for example, E: (Windows), /Volumes/ExternalDrive (Mac), or /home where /home is a file system or mountpoint (Linux), please see instead excluding one or more drives or partitions.


Excluding folders from backup using the GUI

To exclude a folder from backup in the GUI:

Start the GUI:

  1. From the Windows Start menu search for backup, then launch Backup-Archive GUI.

Start the GUI:

  1. Run Applications, then IBM Spectrum Protect > IBM Spectrum Protect Tools for Administrators > IBM Spectrum Protect
  2. When prompted, provide your local administrator password.

Start the GUI:

  1. Run dsmj as root.

Then:

  1. Select Edit Client Preferences Include-Exclude Add
  2. On the Define Include-Exclude Options window, select the following:
    • Category: Backup
    • Type: Exclude.Dir 
    • File or Pattern: Select Browse and choose a folder that you want to exclude.
  3. Depending on how many files you need to exclude:
    • If this is the only folder you wish to exclude, proceed to the next step.
    • If there are a few more folders to exclude, repeat the above step as often as is needed.
    • If there is a range of similarly named or similarly located folders that you wish to exclude, details of how to edit the File or Pattern line to match a range of files are provided in the basic exclude examples below.
  4. After confirming your selections, verify that your new exclude rules are working correctly by attempting to perform a manual backup of one or more of your excluded files.  It should be marked with a barred red circle, and so be impossible to back up.

Excluding folders from backup by editing the Spectrum Protect configuration file

To exclude a file or a range of similar files by editing the Spectrum Protect configuration file:

  1. Locate the Spectrum Protect configuration file, dsm.opt in Windows, dsm.sys on a Mac or Linux, or incl.excl for very old Linux Spectrum Protect clients.

  2. In Windows, run Notepad as administrator, or move the dsm.opt file to the desktop before editing it.

  3. Edit the Spectrum Protect configuration file in a text editor and add the additional exclude rules to the end of the file.  For example:

    exclude "C:\Users\jasonz\Documents\to-be-excluded" 

    Do not put a slash at the end of the rule or this will invalidate the whole rule, which Spectrum Protect will then ignore.
    Please do not alter or remove any existing rules or other lines of dsm.opt/dsm.sys.

  4. If there is a range of similarly named or similarly located files that you wish to exclude, details of how to change your exclude line to match a range of files are provided in the basic exclude examples below.

  5. In Windows, if you moved the dsm.opt file before editing it, now move it back.

  6. After confirming your selections, verify that your new exclude rules are working correctly by either:
    • Attempt to perform a manual backup of one or more of your excluded files.  The files should be marked with a barred red circle, and so be impossible to back up.
    • Check the include-exclude list on the Spectrum Protect command line by running dsmc q inclexcl.  The output lists the order in which the directives will be processed.

By default, Spectrum Protect is set to back up all your local drives and partitions.  This includes not only those internal to your machine, but also those that are attached externally, such as Firewire/USB hard drives and flash drives.  This section shows how to exclude these from backup.  If you have accidentally backed up an external drive and do not want the data to be kept for backup, please contact hfs@ox.ac.uk and indicate which drive's backup you wish to be deleted.

You can exclude a drive or partition from backup either in the Spectrum Protect graphical user interface (GUI) or by editing the Spectrum Protect configuration file.  The former is generally the simpler and easier method to use.

You can exclude a drive or partition from backup either by altering the backup domain that Spectrum Protect checks when it runs a scheduled backup, or alternatively with an exclude rule.  An exclude.dir rule cannot be used to exclude a whole partition because its role is only to exclude folders that exist within a drive, not whole drives themselves.


Excluding drives and partitions by changing the backup domain

Spectrum Protect reads the backup domain setting when it runs a scheduled backup.  Changing the backup domain therefore affects which drives and partitions get backed up on the schedule.  Drives excluded in this manner may still be backed up manually, and are still listed under the 'Local' list of disks in the Spectrum Protect interface when you run a manual backup; so you may want to expand this list and select only those disks you wish to back up if you do run a manual backup.

Similarly, command line users can include drives as an argument, such as dsmc incr "/media/USB DISK", while a simple dsmc incr will honour the domain setting you have made in the GUI and not back up drives which are not listed in the backup domain.


Changing the backup domain using the GUI

This is the simplest way to prevent a drive or partition being backed up during scheduled backups.  To remove a drive or partition from the backup domain in the GUI:

Start the GUI:

  1. From the Windows Start menu search for backup, then launch Backup-Archive GUI.

Start the GUI:

  1. Run Applications, then IBM Spectrum Protect > IBM Spectrum Protect Tools for Administrators > IBM Spectrum Protect

  2. When prompted, provide your local administrator password.

Start the GUI:

  1. Run dsmj as root.

Then:

  1. Select Edit Client Preferences > Backup
  2. On the Backup Preferences under Domain for Backup:
    • Untick Back up all local file systems.
    • Select those drives that you want to include for backup.
      For Macs, Spectrum Protect represents the main drive with a slash /, rather than with the volume name.
  3. After confirming your selections, verify that your new exclude rules are working correctly by attempting to perform a manual backup of one or more of your excluded files.  It should be marked with a barred red circle, and so be impossible to back up.

Changing the backup domain by editing the Spectrum Protect configuration file

To change the backup domain by editing the Spectrum Protect configuration file:

  1. Locate the Spectrum Protect configuration file dsm.opt.

  2. In Windows, run Notepad as administrator, or move the dsm.opt file to the desktop before editing it.

  3. Now edit the DOMAIN line of dsm.opt.  Please do not alter or remove any existing rules or other lines of dsm.opt.  The default setting is:

     DOMAIN ALL-LOCAL

    To remove a drive from the backup domain, change the DOMAIN similar to the examples below.

    Windows: Backing up drive C: and E:

    DOMAIN C: E:
    DOMAIN C:
    DOMAIN E:
    DOMAIN ALL-LOCAL -F:

    Mac: Spectrum Protect represents the main drive with a slash /, with other disk volumes named in the standard manner, such as /Volumes/My Big External Disk:

    DOMAIN "/" "/Volumes/My Big External Disk"
    DOMAIN "/"
    DOMAIN "/Volumes/My Big External Disk"
    DOMAIN ALL-LOCAL "-/Volumes/My Big External Disk"

    Linux:

    DOMAIN / /home
    DOMAIN /
    DOMAIN /home
    DOMAIN ALL-LOCAL -/usr -/scratch

    Quotation marks are not optional if the file name or location contains a space.

  4. In Windows, if you moved the dsm.opt file before editing it, now move it back.

  5. After confirming your selections, verify that your new exclude rules are working correctly by either:
    • Attempt to perform a domain backup of your machine.  To do this, from the GUI select Actions > Backup Domain.  This will back up only those drives listed in the backup domain.
    • Run the domain backup on the Spectrum Protect command line by running dsmc incr as root.


Excluding drives and partitions from backup with an exclude rule

Alternatively you can completely exclude all files on a drive/partition from being backed up by adding an exclude rule.  Note that an exclude.dir rule cannot be used to exclude a whole partition because its role is only to exclude folders that exist within a drive, not whole drives themselves.


Excluding drives and partitions from backup with an exclude rule using the GUI

To exclude a file or a range of similar files from backup in the GUI:

Start the GUI:

  1. From the Windows Start menu search for backup, then launch Backup-Archive GUI.

Start the GUI:

  1. Run Applications, then IBM Spectrum Protect > IBM Spectrum Protect Tools for Administrators > IBM Spectrum Protect
  2. When prompted, provide your local administrator password.

Start the GUI:

  1. Run dsmj as root.

Then:

  1. Select Edit Client Preferences Include-Exclude Add
  2.  On the Define Include-Exclude Options window, select the following:
    • Category: Backup
    • Type: Exclude
  3. For the File or Pattern:
    • Select Browse, choose any file on the drive that you want to exclude, then OK.
    • Edit the File or Pattern field so either \...\* (Windows) or /.../* (Mac/Linux) follows the drive name.  For example:
      Windows:

      C:\...\*
      

      Mac:

      "/Volumes/My Big External Disk/.../*"
      

      Linux:

      /scratch/.../*

      A simpler alternative, available in Linux only, is to select Type: Exclude.fs.  You can then Browse to the file system to be excluded.

  4. Depending on how many drives you need to exclude:
    • If this is the only drive you wish to exclude, proceed to the next step.
    • If there are a few more drives to exclude, repeat the above step as often as is needed.
  5. After confirming your selections, verify that your new exclude rules are working correctly by attempting to perform a manual backup.  Every file on the excluded drive should be marked with a barred red circle, and so be impossible to back up.

Excluding drives and partitions from backup with an exclude rule by editing the Spectrum Protect configuration file

To exclude a file or a range of similar files by editing the Spectrum Protect configuration file:

  1. Locate the Spectrum Protect configuration file, dsm.opt in Windows, dsm.sys on a Mac or Linux, or incl.excl for very old Linux Spectrum Protect clients.
  2. In Windows, run Notepad as administrator, or move the dsm.opt file to the desktop before editing it.
  3. Edit the Spectrum Protect configuration file in a text editor, adding the additional exclude rules to the end of the file.  The exclude rule beginning with the drive name and ending with either \...\* (Windows) or /.../* (Mac/Linux).  For example:

    Exclude C:\...\*

    An alternative, available in Linux only, is the option Exclude.fs, after which you can name the drive to be excluded.

    Exclude.fs /scratch

    Do not put a slash at the end of the rule or this will invalidate the whole rule, which Spectrum Protect will then ignore.
    Please do not alter or remove any existing rules or other lines of dsm.opt/dsm.sys.

  4. In Windows, if you moved the dsm.opt file before editing it, now move it back.

  5. After confirming your selections, verify that your new exclude rules are working correctly by either:
    • Attempt to perform a manual backup.  Every file on the excluded drive should be marked with a barred red circle, and so be impossible to back up.
    • Check the include-exclude list on the Spectrum Protect command line by running dsmc q inclexcl.  The output lists the order in which the directives will be processed.

You may wish to exclude all your data from backup except a specific part of your data.  If you keep all your important files in one place then there is no need to back up the rest of your machine.  This is especially useful if you are backing up from home over VPN because such backups are often very slow.

The method used is to include all your important files and to exclude everything else from backup.  You will therefore need to add two rules to your Spectrum Protect include-exclude list.  This can be done either in the Spectrum Protect graphical user interface (GUI) or by editing the Spectrum Protect configuration file.  The former is generally the simpler and easier method to use.

Note that, once you have completed the instructions below, you will still be able to select folders for backup, but that in all cases (except those that you deliberately included for backup) the files inside them should be marked as excluded.

 


Exclude everything from backup except specific files or folders using the GUI

To exclude everything from backup except specific files or folders in the GUI:

Start the GUI:

  1. From the Windows Start menu search for backup, then launch Backup-Archive GUI.

Start the GUI:

  1. Run Applications, then IBM Spectrum Protect > IBM Spectrum Protect Tools for Administrators > IBM Spectrum Protect
  2. When prompted, provide your local administrator password.

Start the GUI:

  1. Run dsmj as root.

Then:

  1. Select Edit Client Preferences Include-Exclude Add
  2. On the Define Include-Exclude Options window, select the following:
    • Category: Backup
    • Type: Exclude
    • File or Pattern: To exclude all your data from backup, enter either *:\...\* for Windows, or /.../* for Mac and Linux.

      In this rule, ... means that the rule holds for any subdirectory, and * means that it holds for any file.

  3. Select Edit Client Preferences Include-Exclude Add again

  4. On the Define Include-Exclude Options window, select the following:
    • Category: Backup
    • Type: Include
    • Management Class: Ignore this
  5. For the File or Pattern:
    • Select Browse, choose any file on a drive that you want to include, then OK.
    • Edit the File or Pattern field so either \...\* (Windows) or /.../* (Mac/Linux) follows the drive name.  For example:
      Windows:

      C:\...\*
      

      Mac:

      "/Volumes/My Big External Disk/.../*"
      

      Linux:

      /scratch/.../*
  6. Check the Statement List to ensure that the rules you added are at the bottom of the list, in the order you created them.
    • It is important that the include rules are at the bottom. If not, use the Move Up and Move Down buttons to rearrange them.
    • If you are including your home directory and substitute your username for 'YOUR_NAME', you should have a resulting pair that looks like:

      Windows:

      Exclude "*:\...\*"
      Include "C:\Users\YOUR_NAME\...\*"
      

      Mac:

      Exclude "/.../*"
      Include /Users/YOUR_NAME/.../*
      

      Linux:

      Exclude "/.../*"
      Include "/home/.../*"
      

      This combination will back up every file in a home/user area, and in any subdirectories under that directory, excluding all other files on the system.

  7. After confirming your selections, verify that your new exclude rules are working correctly by attempting to perform a manual backup.  Every file on the excluded drive should be marked with a barred red circle, and so be impossible to back up.

Excluding everything from backup except specific files or folders by editing the Spectrum Protect configuration file

To exclude a file or a range of similar files by editing the Spectrum Protect configuration file:

  1. Locate the Spectrum Protect configuration file, dsm.opt in Windows, dsm.sys on a Mac or Linux, or incl.excl for very old Linux Spectrum Protect clients.
  2. In Windows, run Notepad as administrator, or move the dsm.opt file to the desktop before editing it.
  3. Edit the Spectrum Protect configuration file in a text editor, adding additional rules to the end of the file.

    • Add an exclude rule beginning with the drive name and ending with either \...\* (Windows) or /.../* (Mac/Linux).

    • Add an include rule which specifies the folder that you wish to include, followed by \...\* (Windows) or /.../* (Mac/Linux).

    • It is important that the include rule is at the bottom.

    • If you are including your home directory and you substitute your username for 'YOUR_NAME' then you should have a resulting pair that looks like:

      Windows:

      Exclude "*:\...\*"
      Include "C:\Users\YOUR_NAME\...\*"
      

      Mac:

      Exclude "/.../*"
      Include /Users/YOUR_NAME/.../*
      

      Linux:

      Exclude "/.../*"
      Include "/home/.../*"
      

      This combination will back up every file in a home/user area, and in any subdirectories under that directory, excluding all other files on the system.

  4. In Windows, if you moved the dsm.opt file before editing it, now move it back.

  5. After confirming your selections, verify that your new exclude rules are working correctly by either:
    • Attempt to perform a manual backup.  Every file on the excluded drive should be marked with a barred red circle, and so be impossible to back up.
    • Check the include-exclude list on the Spectrum Protect command line by running dsmc q inclexcl.  The output lists the order in which the directives will be processed.

The basic syntax for coding exclusions from backup may be gleaned from the existing examples in the Spectrum Protect option files.  The following is a summary to illustrate some of the possibilities offered.

Each line in each of the following examples is made up of two elements.  The lines can be entered at the end of the Spectrum Protect configuration file as described in excluding files from backup by editing the Spectrum Protect configuration file.  They may also be used in the graphical user interface (GUI) as described in excluding files from backup using the GUI by selecting the first element (usually Exclude.DirExclude or Include) as the entry for Type, and then entering the second element under File or Pattern.

  • The default is to include a file for backup.  If a file does not match either an Exclude or Include directive in the configuration file then it will be included for backup.
  • The include/exclude list is processed bottom up.  The processor will read the list from bottom up, acting only on the first directive that applies.
    If you add the following two lines to the bottom of the configuration file then the file XYZ.DOC will not be backed up:
    Include  C:\XYZ.DOC
    Exclude  C:\XYZ.DOC

    The Exclude directive is read first, applied and the processor then grabs the next file and so on.

  • To specify a directory path or filename with spaces in it, enclose it fully in quotation marks, as below:
    Exclude "C:\My Documents\tempfiles\*"
    Exclude "C:\Program Files\xyz\*"
  • To exclude the contents of a directory and all its subdirectories, use the Exclude.dir directive:
    Exclude.dir C:\testdata

    Note, however, that a perhaps unexpected outcome of this rule is that the names of the directory that is excluded will be sent to the Spectrum Protect server and will so be displayed in the restore window when you perform a restore.  However, the file contents of such directories will not be displayed, as they will have been excluded.

  • Exclude.dir directives are processed before all other directives.  If you added the following two lines to the bottom of the configuration file
    Exclude.dir  C:\testdata
    Include      C:\testdata\test1\summary.dat

    then the file "summary.dat" will not be backed up even though the Include directive is below the Exclude.dir directive.  The Exclude.dir directives are read and processed first.

  • To check the order in which exclude directives are processed open the Spectrum Protect command line client and at the Protect> prompt enter query inclexcl.

    The output will list the directives in the order in which they will be applied.  As described above, you may also check what data may be backed up by running the GUI and browsing the files on your machine.  Spectrum Protect will not permit excluded files to be backed up, and will mark them with a barred red circle to indicate this.

  • To exclude multiple files with a common component in their name, use * and ? wildcards.  The * matches any number of any character; the ? matches any single character.  Thus to exclude any files whose names begin temp in the C:\tempdata folder use:
    Exclude  C:\tempdata\temp*

    To exclude any files whose names begin with a variable single character then followed by _temp.dat in the C:\tempdata directory, use:

    Exclude  C:\tempdata\?_temp.dat
  • To exclude numerous directories use the ... wildcard.  Thus to exclude a directory called cache and all its contents and subdirectories anywhere on drive C:, use:
    Exclude.dir  C:\...\cache

    However, if you have 100 directories called temp00temp01temp02, up to temp99 on the C: drive, then you can do either of the following:

    Exclude.dir C:\temp*
    
    Exclude.dir C:\temp??
  • To exclude the contents of a directory but include the contents of all its subdirectories:
    Include  C:\data\...\*
    Exclude  C:\data\*

    This will exclude any file in the C:\data directory but will include for backup any file in any subdirectory under C:\data.  Note the order is important: The Exclude directive must follow the Include directive in the configuration file.

  • To do the reverse and include the contents of a directory but exclude the contents of all its subdirectories:
    Include       C:\data\*
    Exclude.dir   C:\data\...\*

    This will exclude any file in any subdirectory of C:\data but will include for backup any file in the C:\data directory.

Get support


If you cannot find the solution you need here then we have other ways to get IT support

Get IT support