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 30.
  2. Click on Edit, then Client Preferences. The Preferences Editor window will appear, on the General Preferences section:

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

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

    Figure 33.
  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 34.
  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 35.
  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 36.
  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 37.
  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 38.

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

    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, Linux 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 Linux/Unix 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 39.

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

    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, Linux and Solaris. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

Up: Contents Previous: 4. Excluding drives and partitions from backup Next: 6. Basic exclude examples