## How to Exclude Files, Folders and Drives from Backup

Contents

1. What do you want to exclude from backup?

The HFS TSM package comes with a set of default exclusions coded in the TSM configuration file: on these please see further our page on files and folders excluded from backup. While these default exclusions should not generally be modified or removed, they can be added to.

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

I want to exclude one or more specific files, or a range of similar files:
see excluding files.
I want to exclude one or more folders:
see excluding folders.
I want to exclude one or more drives or partitions:
see excluding drives or partitions.
I want to exclude everything except certain files or folders:
see excluding everything specific files or folders.
I am experienced with TSM exclude rules and want to see basic examples of the different options available:
see basic exclude examples.

2. Excluding files from backup

2.1. Introduction

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

2.2. Excluding files from backup using the graphical user interface

To exclude a file or a range of similar files from backup in the graphical user interface, do as follows:
1. Run TSM: in Windows, run TSM from [Start] > [All Programs] > [Tivoli Storage Manager] > [Backup-Archive GUI]; on a Mac, run TSM from [Applications] > [TSM Tools for Administrators] > [Tivoli Storage Manager]; in Linux, run dsmj as root. The following window will appear.

Figure /hfs/help/images/backup01.gif []

2. Click on Edit, then Client Preferences. The Preferences Editor window will appear, on the General Preferences section:

Figure /hfs/help/images/wingeneralprefs.png []

3. From the list of tabs on the left, click on Include-Exclude. The list of current Include-Exclude Preferences will appear:

Figure /hfs/help/images/wininclexclprefs.png []

4. Click on Add and the Define Include-Exclude Options window will appear. Under Category select Backup, and under Type select Exclude:

Figure /hfs/help/images/windefexclfile.png []

5. Under File or Pattern, click Browse, and a window headed File or Pattern will appear in which you can browse to a file that you want to exclude.

Figure /hfs/help/images/windefexcl-filepattern.png []

6. Browse to and select your file, and click OK. The file will now be listed in the Define Include-Exclude Options window:

Figure /hfs/help/images/windefexcl-eg1.png []

7. Depending on how many files you need to exclude, proceed as follows:

• 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 previous three steps as often as is needed.

• If there is a range of similarly-named or similarly-located files that you wish to exclude, you can edit the exclude line to match a range of files before clicking OK. For further details and for examples of exclude rule syntax, please see basic exclude examples below.

8. Once your exclude rules are completed, click OK in the Define Include-Exclude Options window and then OK again in the Preferences Editor. This will take you back to the main TSM window.

9. Now verify that your new exclude rule(s) is/are working correctly. The easiest way to do this is in the TSM graphical user interface, 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 impossible to back up (TSM will not permit you to back up any files or folders that are marked in this way):

Figure /hfs/help/images/windefexcl-eg2.png []

For how to run a manual backup, please see our instructions for doing so on Windows, Mac or Linux.

10. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

2.3. Excluding files from backup by editing the TSM configuration file

To exclude a file or a range of similar files by editing the TSM configuration file, do as follows:
1. Locate the TSM configuration file: it is dsm.opt in Windows, dsm.sys on a Mac or in Linux (although please note that very old TSM clients for Unix/Linux stored the list in a file called incl.excl). The location of the configuration file is platform-specific and can be looked up in our list of TSM Options Files.

2. In Windows Vista, 7, 2008 and 2008R2, permissions to edit the contents of C:\Program Files are limited. We therefore recommend that you move dsm.opt to the desktop before you open it for editing. Users of these versions of Windows should therefore browse to C:\Program Files\tivoli\tsm\baclient and drag dsm.opt to their desktop. (An alternative is to run your text editor as administrator before using it to open dsm.opt.)

3. Now edit the TSM configuration file in a text editor and add the necessary additional exclude rule(s) to the end of the file. Please do not alter or remove any existing rules or other lines of dsm.opt/dsm.sys. For example, to exclude file C:\Users\jasonz\Documents\to-be-excluded-1.docx, add:

exclude "C:\Users\jasonz\Documents\to-be-excluded-1.docx"
Note that quotation marks are not optional if the file name or location contains a space.

If there is a range of similarly-named or similarly-located files that you wish to exclude, you can change your exclude line to match a range of files. For further details and for examples of exclude rule syntax, please see basic exclude examples below.

4. Save the TSM configuration file. If you moved it from C:\Program Files to your desktop in order to edit it, now move it back.

5. Now verify that your new exclude rule(s) is/are working correctly. The easiest way to do this is in the TSM graphical user interface, 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 impossible to back up (TSM will not permit you to back up any files or folders that are marked in this way):

Figure /hfs/help/images/windefexcl-eg2.png []

For how to run a manual backup, please see our instructions for doing so on Windows, Mac or Linux.

If you cannot use the graphical interface then you can check the include-exclude list on the TSM command line by running:

dsmc q inclexcl
Note that the output lists the order in which the directives will be processed.

6. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

3. Excluding folders from backup

3.1. Introduction

You can exclude folders from backup either in the TSM graphical user interface (GUI) or by editing the TSM 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 e.g. E: (Windows), /Volumes/ExternalDrive (Mac), or /home where /home is a file system or mountpoint, please see instead excluding one or more drives or partitions.

3.2. Excluding files from backup using the graphical user interface

To exclude a folder from backup in the graphical user interface, do as follows:
1. Run TSM: in Windows, run TSM from [Start] > [All Programs] > [Tivoli Storage Manager] > [Backup-Archive GUI]; on a Mac, run TSM from [Applications] > [TSM Tools for Administrators] > [Tivoli Storage Manager]; in Linux, run dsmj as root. The following window will appear.

Figure /hfs/help/images/backup01.gif []

2. Click on Edit, then Client Preferences. The Preferences Editor window will appear, on the General Preferences section:

Figure /hfs/help/images/wingeneralprefs.png []

3. From the list of tabs on the left, click on Include-Exclude. The list of current Include-Exclude Preferences will appear:

Figure /hfs/help/images/wininclexclprefs.png []

4. Click on Add and the Define Include-Exclude Options window will appear. Under Category select Backup, and under Type select Exclude.Dir:

Figure /hfs/help/images/windefexclfolder.png []

5. Under File or Pattern, click Browse, and a window headed File or Pattern will appear in which you can browse to a folder that you want to exclude.

Figure /hfs/help/images/windefexcl-filepattern.png []

6. Browse to and select your folder, and click OK. The folder will now be listed in the Define Include-Exclude Options window:

Figure /hfs/help/images/windefexclfolder-eg1.png []

7. Depending on how many folders you need to exclude, proceed as follows:

• 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 previous three steps as often as is needed.

• If there is a range of similarly-named or similarly-located folders that you wish to exclude, you can edit the exclude line to match a range of folders before clicking OK. For further details and for examples of exclude rule syntax, please see basic exclude examples below.

8. Once your exclude rules are completed, click OK in the Define Include-Exclude Options window and then OK again in the Preferences Editor. This will take you back to the main TSM window.

9. Now verify that your new exclude rule(s) is/are working correctly. The easiest way to do this is in the TSM graphical user interface, by attempting to perform a manual backup of your excluded folder: it should be marked with a barred red circle, and its contents should not be visible, so that it is impossible to back up (TSM will not permit you to back up any files or folders that are marked in this way):

Figure /hfs/help/images/windefexclfolder-eg2.png []

For how to run a manual backup, please see our instructions for doing so on Windows, Mac or Linux.

10. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

3.3. Excluding folders from backup by editing the TSM configuration file

To exclude a file or a range of similar files by editing the TSM configuration file, do as follows:
1. Locate the TSM configuration file: it is dsm.opt in Windows, dsm.sys on a Mac or in Linux (although please note that very old TSM clients for Unix/Linux stored the list in a file called incl.excl). The location of the configuration file is platform-specific and can be looked up in our list of TSM Options Files.

2. In Windows Vista, 7, 2008 and 2008R2, permissions to edit the contents of C:\Program Files are limited. We therefore recommend that you move dsm.opt to the desktop before you open it for editing. Users of these versions of Windows should therefore browse to C:\Program Files\tivoli\tsm\baclient and drag dsm.opt to their desktop. (An alternative is to run your text editor as administrator before using it to open dsm.opt.)

3. Now edit the TSM configuration file in a text editor and add the necessary additional exclude rule(s) to the end of the file. Please do not alter or remove any existing rules or other lines of dsm.opt/dsm.sys. For example, to exclude folder C:\Users\jasonz\Documents\to-be-excluded, add:

exclude.dir "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 TSM will then ignore. Note that quotation marks are not optional if the file name or location contains a space.

If there is a range of similarly-named or similarly-located folders that you wish to exclude, you can change your exclude line to match a range of files. For further details and for examples of exclude rule syntax, please see basic exclude examples below.

4. Save the TSM configuration file. If you moved it from C:\Program Files to your desktop in order to edit it, now move it back.

5. Now verify that your new exclude rule(s) is/are working correctly. The easiest way to do this is in the TSM graphical user interface, by attempting to perform a manual backup of your excluded folder: it should be marked with a barred red circle, and its contents should not be visible, so that it is impossible to back up (TSM will not permit you to back up any files or folders that are marked in this way):

Figure /hfs/help/images/windefexclfolder-eg2.png []

For how to run a manual backup, please see our instructions for doing so on Windows, Mac or Linux.

If you cannot use the graphical interface then you can check the include-exclude list on the TSM command line by running:

dsmc q inclexcl
Note that the output lists the order in which the directives will be processed.

6. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

4. Excluding drives and partitions from backup

By default, TSM 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 TSM graphical user interface (GUI) or by editing the TSM 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 TSM 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.

4.1. Excluding drives and partitions by changing the backup domain

TSM 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 TSM 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 such drives as an argument, as in dsmc incr "/media/USB DISK", for example, while a simple dsmc incr will honour the domain setting you have made in the graphical user interface and not back up drives which are not listed in the backup domain.)

4.1.1. Changing the backup domain using the graphical user interface

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 graphical user interface, do as follows:
1. Run TSM: in Windows, run TSM from [Start] > [All Programs] > [Tivoli Storage Manager] > [Backup-Archive GUI]; on a Mac, run TSM from [Applications] > [TSM Tools for Administrators] > [Tivoli Storage Manager]; in Linux, run dsmj as root. The following window will appear.

Figure /hfs/help/images/backup01.gif []

2. Click on Edit, then Client Preferences. The Preferences Editor window will appear, on the General Preferences section:

Figure /hfs/help/images/wingeneralprefs.png []

3. From the list of tabs on the left, click on Backup. The Backup Preferences window will appear:

Figure /hfs/help/images/winbackupprefs.png []

4. Under Domain for Backup, untick Back up all local file systems, and select those drives that you want to include for backup. In the example below, only C: will get backed on the backup schedule, not E: (Windows desktop/laptop users can ignore the third line, SystemState, because for their accounts it is by default not backed up).

Figure /hfs/help/images/winbackupprefs2.png []

Note: on Macs, TSM represents the main drive with a slash /, rather than the complete volume name. Other disk volumes are named in the standard Mac manner, as e.g. /Volumes/My Big External Disk.

5. Click OK.

6. Now verify that the backup domain is now set correctly. The easiest way to do this is in the TSM graphical user interface, by attempting to perform a domain backup of your machine. To do this, from the main TSM window, click on [Actions] and then [Backup Domain]. This will back up only those drives listed in the backup domain.

7. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

4.1.2. Changing the backup domain by editing the TSM configuration file

To change the backup domain by editing the TSM configuration file, do as follows:
1. Locate the TSM configuration file: the backup domain is set in dsm.opt on all operating systems. The location of this file is platform-specific and can be looked up in our list of TSM Options Files.

2. In Windows Vista, 7, 2008 and 2008R2, permissions to edit the contents of C:\Program Files are limited. We therefore recommend that you move dsm.opt to the desktop before you open it for editing. Users of these versions of Windows should therefore browse to C:\Program Files\tivoli\tsm\baclient and drag dsm.opt to their desktop. (An alternative is to run your text editor as administrator before using it to open dsm.opt.)

3. Now edit the DOMAIN line of dsm.opt in a text editor. 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 line to be the appropriate line below:
Windows - to back up only drive C: and E::
DOMAIN C: E:
Mac - to back up the main drive and a secondary drive called "My Big External Disk":
DOMAIN "/"  "/Volumes/My Big External Disk"
Linux:
DOMAIN  /  /home

Note: on Macs, TSM represents the main drive with a slash /, rather than the complete volume name. Other disk volumes are named in the standard Mac manner, as e.g. /Volumes/My Big External Disk.

These lines are cumulative, so, for example, you could put on two separate lines:

   DOMAIN C:
DOMAIN E:
or you can include all local drives / partitions and then exclude one or more by prefacing theme with a "-" minus sign, as below (note when enclosing the disk/partition name in quotation marks because it contains spaces, you should put the minus sign inside the quotation marks):
Windows:
DOMAIN ALL-LOCAL -F:
Mac:
DOMAIN ALL-LOCAL "-/Volumes/My Big External Disk"
Linux:
DOMAIN ALL-LOCAL -/usr  -/scratch
Note that quotation marks are not optional if the file name or location contains a space.

4. Save the TSM configuration file. If you moved it from C:\Program Files to your desktop in order to edit it, now move it back.

5. Now verify that the backup domain is set correctly. The easiest way to do this is in the TSM graphical user interface, by attempting to perform a domain backup of your machine. To do this, from the main TSM window, click on [Actions] and then [Backup Domain]. This will back up only those drives listed in the backup domain. Alternatively, if you prefer to run TSM on the command line, run as root:

dsmc incr

6. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

4.2. 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.

4.2.1. Excluding drives and partitions from backup with an exclude rule using the graphical user interface

To exclude a file or a range of similar files from backup in the graphical user interface, do as follows:
1. Run TSM: in Windows, run TSM from [Start] > [All Programs] > [Tivoli Storage Manager] > [Backup-Archive GUI]; on a Mac, run TSM from [Applications] > [TSM Tools for Administrators] > [Tivoli Storage Manager]; in Linux, run dsmj as root. The following window will appear.

Figure /hfs/help/images/backup01.gif []

2. Click on Edit, then Client Preferences. The Preferences Editor window will appear, on the General Preferences section:

Figure /hfs/help/images/wingeneralprefs.png []

3. From the list of tabs on the left, click on Include-Exclude. The list of current Include-Exclude Preferences will appear:

Figure /hfs/help/images/wininclexclprefs.png []

4. Click on Add and the Define Include-Exclude Options window will appear. Under Category select Backup, and under Type select Exclude:

Figure /hfs/help/images/windefexclfile.png []

5. Under File or Pattern, click Browse, and a window headed File or Pattern will appear in which you can browse to any file on the drive that you want to exclude.

Figure /hfs/help/images/windefexcl-filepattern.png []

6. Browse to and select any file on the drive that you want to exclude, and click OK. The file will now be listed in the Define Include-Exclude Options window:

Figure /hfs/help/images/windefexcl-eg1.png []

7. Now edit the File or Pattern field so that, after the drive name, it reads either \...\* (Windows) or /.../* (Mac/Linux). The example below is for excluding all of C: on Windows. So you will have a result that looks like one of:

Windows:
C:\...\*
Mac:
"/Volumes/My Big External Disk/.../*"
Linux:
/scratch/.../*

Figure /hfs/help/images/windefexcl-filepattern-excl-c.png []

A simpler alternative, available in Linux only, is to select the Type option Exclude.fs rather than Exclude. You can then browse to the file system to be excluded with the Browse button.

8. Once your exclude rule is completed, click OK in the Define Include-Exclude Options window and then OK again in the Preferences Editor. This will take you back to the main TSM window.

9. Now verify that your new exclude rule is working correctly. The easiest way to do this is in the TSM graphical user interface, by attempting to perform a manual backup of your excluded drive, and also by checking that you can still back up those files that you want to back up: every file on the excluded drive should be marked with a barred red circle, and so impossible to back up (TSM will not permit you to back up any files or folders that are marked in this way):

Figure /hfs/help/images/windefexcl-eg2.png []

For how to run a manual backup, please see our instructions for doing so on Windows, Mac or Linux.

Note that you will still be able to select folders for backup, but that in all cases the files inside them should be marked as excluded.

10. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

4.2.2. Excluding drives and partitions from backup with an exclude rule by editing the TSM configuration file

To exclude a file or a range of similar files by editing the TSM configuration file, do as follows:
1. Locate the TSM configuration file: it is dsm.opt in Windows, dsm.sys on a Mac or in Linux (although please note that very old TSM clients for Unix/Linux stored the list in a file called incl.excl). The location of the configuration file is platform-specific and can be looked up in our list of TSM Options Files.

2. In Windows Vista, 7, 2008 and 2008R2, permissions to edit the contents of C:\Program Files are limited. We therefore recommend that you move dsm.opt to the desktop before you open it for editing. Users of these versions of Windows should therefore browse to C:\Program Files\tivoli\tsm\baclient and drag dsm.opt to their desktop. (An alternative is to run your text editor as administrator before using it to open dsm.opt.)

3. Now edit the TSM configuration file in a text editor and add the necessary additional exclude rule(s) to the end of the file. Please do not alter or remove any existing rules or other lines of dsm.opt/dsm.sys. Add an exclude rule that begins with the drive name and ends with either \...\* (Windows) or /.../* (Mac/Linux). So you will have a result that looks like one of:

Windows:
Exclude C:\...\*
Mac:
Exclude "/Volumes/My Big External Disk/.../*"
Linux:
Exclude /scratch/.../*
A alternative in Linux only is the option Exclude.fs, after which you can name the drive to be excluded. Do not put a slash at the end of the rule or this will invalidate the whole rule, which TSM will then ignore.
Linux:
Exclude.fs /scratch
Note that quotation marks are not optional if the file name or location contains a space.

4. Save the TSM configuration file. If you moved it from C:\Program Files to your desktop in order to edit it, now move it back.

5. Now verify that your new exclude rule is working correctly. The easiest way to do this is in the TSM graphical user interface, by attempting to perform a manual backup of your excluded drive, and also by checking that you can still back up those files that you want to back up: every file on the excluded drive should be marked with a barred red circle, and so impossible to back up (TSM will not permit you to back up any files or folders that are marked in this way):

Figure /hfs/help/images/windefexcl-eg2.png []

For how to run a manual backup, please see our instructions for doing so on Windows, Mac or Linux.

Note that you will still be able to select folders for backup, but that in all cases the files inside them should be marked as excluded.

If you cannot use the graphical interface then you can check the include-exclude list on the TSM command line by running:

dsmc q inclexcl
Note that the output lists the order in which the directives will be processed.

6. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

5. Excluding everything from backup except specific files or folders

5.1. Introduction

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 TSM include-exclude list. This can be done either in the TSM graphical user interface (GUI) or by editing the TSM configuration file. The former is generally the simpler and easier method to use.

5.2. Excluding everything from backup except specific files or folders using the graphical user interface

To exclude everything from backup except specific files or folders in the graphical user interface, do as follows:
1. Run TSM: in Windows, run TSM from [Start] > [All Programs] > [Tivoli Storage Manager] > [Backup-Archive GUI]; on a Mac, run TSM from [Applications] > [TSM Tools for Administrators] > [Tivoli Storage Manager]; in Linux, run dsmj as root. The following window will appear.

Figure /hfs/help/images/backup01.gif []

2. Click on Edit, then Client Preferences. The Preferences Editor window will appear, on the General Preferences section:

Figure /hfs/help/images/wingeneralprefs.png []

3. From the list of tabs on the left, click on Include-Exclude. The list of current Include-Exclude Preferences will appear:

Figure /hfs/help/images/wininclexclprefs.png []

4. Click on Add and the Define Include-Exclude Options window will appear. Under Category select Backup, and under Type select Exclude:

Figure /hfs/help/images/windefexclfile.png []

5. Under File or Pattern, you now need to enter a line that excludes all your data from backup. What you enter depends on your operating system: paste in the relevant text from the list below, depending on whether you are running Windows, Mac or Linux:

Windows:
*:\...\*

Mac/Linux:
/.../*

6. Enter the relevant text under File or Pattern and click OK, then again on Add so that the Define Include-Exclude Options window appears again. A second time, under Category select Backup, but under Type this time select Include (ignore the extra option that appears, Management Class):

Figure /hfs/help/images/windefinclfile.png []

7. Under File or Pattern, click Browse, and a window headed File or Pattern will appear in which you can browse to any file on the drive that you want to include.

Figure /hfs/help/images/windefexcl-filepattern.png []

8. Browse to and select any file on the drive that you want to include, and click OK. The file will now be listed in the Define Include-Exclude Options window:

Figure /hfs/help/images/windefincl-eg1.png []

9. Now edit the File or Pattern field so that, after the name of the folder that you wish to be included, it reads either \...\* (Windows) or /.../* (Mac/Linux). The example below is for including all of C:\Users\jasonz on Windows.

Figure /hfs/help/images/windefincl-filepattern-c-users.png []

10. Click OK in the Define Include-Exclude Options window. This will take you back to the Preferences Editor. Under Include-Exclude Preferences, scroll down the Statement List and check that the rules which you added are at the bottom of the list, in the order you created them in: it is important that the include rule is at the bottom. (If they are not, use the Move Up and/or Move Down buttons to rearrange them.) 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 one of:

Windows XP/2003:
Exclude   "*:\...\*"
Include  "C:\Documents and Settings\YOUR_NAME\...\*"

Windows Vista/2008/7:
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, and exclude all other files on the system.

11. Click OK again in the Preferences Editor. This will take you back to the main TSM window.

12. Now verify that your new exclude rule is working correctly. The easiest way to do this is in the TSM graphical user interface, by attempting to perform a manual backup of your excluded data, and also by checking that you can still back up those files that you want to back up: every file on the excluded drive should be marked with a barred red circle, and so impossible to back up (TSM will not permit you to back up any files or folders that are marked in this way):

Figure /hfs/help/images/windefexcl-eg2.png []

For how to run a manual backup, please see our instructions for doing so on Windows, Mac or Linux.

Note that 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.

13. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

5.3. Excluding everything from backup except specific files or folders by editing the TSM configuration file

To exclude a file or a range of similar files by editing the TSM configuration file, do as follows:
1. Locate the TSM configuration file: it is dsm.opt in Windows, dsm.sys on a Mac or in Linux (although please note that very old TSM clients for Unix/Linux stored the list in a file called incl.excl). The location of the configuration file is platform-specific and can be looked up in our list of TSM Options Files.

2. In Windows Vista, 7, 2008 and 2008R2, permissions to edit the contents of C:\Program Files are limited. We therefore recommend that you move dsm.opt to the desktop before you open it for editing. Users of these versions of Windows should therefore browse to C:\Program Files\tivoli\tsm\baclient and drag dsm.opt to their desktop. (An alternative is to run your text editor as administrator before using it to open dsm.opt.)

3. Now edit the TSM configuration file in a text editor and add the necessary additional exclude rule(s) to the end of the file. Please do not alter or remove any existing rules or other lines of dsm.opt/dsm.sys. You first need to add an exclude rule to exclude all data on your system, which will be of the form *:\...\* (Windows) or /.../* (Mac/Linux). This should be followed by a second line 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 one of:

Windows XP/2003:
Exclude   "*:\...\*"
Include  "C:\Documents and Settings\YOUR_NAME\...\*"

Windows Vista/2008/7:
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, and exclude all other files on the system.

Note that quotation marks are not optional if the file name or location contains a space.

4. Save the TSM configuration file. If you moved it from C:\Program Files to your desktop in order to edit it, now move it back.

5. Now verify that your new exclude rule is working correctly. The easiest way to do this is in the TSM graphical user interface, by attempting to perform a manual backup of your excluded data, and also by checking that you can still back up those files that you want to back up: every file on the excluded drive should be marked with a barred red circle, and so impossible to back up (TSM will not permit you to back up any files or folders that are marked in this way):

Figure /hfs/help/images/windefexcl-eg2.png []

For how to run a manual backup, please see our instructions for doing so on Windows, Mac or Linux.

Note that 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.

If you cannot use the graphical interface then you can check the include-exclude list on the TSM command line by running:

dsmc q inclexcl
Note that the output lists the order in which the directives will be processed.

6. Lastly, if you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

6. Basic exclude examples

The basic syntax for coding exclusions from backup may be gleaned from the existing examples in the TSM 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 TSM configuration file as described above in e.g. excluding files from backup by editing the TSM configuration file. They may also be used in the graphical user interface as described in excluding files from backup using the graphical user interface by selecting the first element (usually Exclude.Dir, Exclude 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. If you add the following two lines to the bottom of the configuration file
                          Include  C:\XYZ.DOC
Exclude  C:\XYZ.DOC
then the file XYZ.DOC will not be backed up. The processor will read the list from bottom up, and acts on the first, and only the first, directive that applies. In this case, 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 HFS 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 TSM command line client and at the tsm> prompt enter query inclexcl as below:
                          tsm> 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: TSM 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 sub-directories anywhere on drive C:, use:
                          Exclude.dir  C:\...\cache
If, however, you have 100 directories called temp00, temp01, temp02 and so on 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 sub-directories:
                          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 sub-directories:
                          Include       C:\data\*
Exclude.dir   C:\data\...\*
This will exclude any file in any sub-directory of C:\data but will include for backup any file in the C:\data directory.

If you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac and Linux. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.