Bucky Backup - Includes and Excludes in TSM
Include and exclude statements in the TSM config files allow control over what is backed up. They allow you to pick and choose which files you want included in your backups and which to exclude. They also allow other options such as encryption and compression. The TSM client's method of include and exclude statements is powerful but not very easy to use, especially for new users.
Includes and Excludes
Note: Additional information about include and exclude statements can be found here.
Include and exclude statements will go in your dsm.opt on Windows or dsm.sys on Unix/Linux. On Unix/Linux systems, a separate file is often specified with a statement like the following:
Any filesystem that you want to be processed for backup must be included in a domain statement in the dsm.opt file.
"ALL-LOCAL" specifies all local disks or filesystems will be backed up, but not network drives. In Windows, system objects and the system state are also included. If no domain statement is given ALL-LOCAL is used as a default.
You can specify only certain filesystems/drives or exclude certain ones. In this example only the F: and G: drives would be processed. Any other disks such as the C: drive and the Windows system state would not be backed up.
DOMAIN F: G:
You can also exclude filesystems/drives using a "-". In this example all file systems are processed except /tmp.
DOMAIN ALL-LOCAL -/tmp
Once a filesystem is included in a domain statement in some fashion it will be processed for backup using any include and exclude statements. The order of the statements is very important. First, the TSM client processes all exclude.dir statements and removes those file spaces and directories from the list of objects for processing. Next, other include and exclude statements are processed from the bottom up.
TSM order of operations:
- Domain statements
- All exclude.dir statements
- Include and exclude statements from the bottom up
Here is an example where order is important. In the first example, file.txt is backed up.
exclude /home/user1/* include /home/user1/file.txt
When the statements are reversed, file.txt is not backed up because it has already been excluded.
include /home/user1/file.txt exclude /home/user1/*
If an exclude.dir statement is added it supersedes the include statement no matter where it is in the list, so in this example file.txt would not be backed up.
exclude.dir /home exclude /home/user1/* include /home/user1/file.txt
Include/Exclude Statement Options
|include||Include file(s) or assign management classes for backup processing|
|exclude||Exclude file(s) from backup processing|
Exclude a directory, it's files, and all subdirectories from backup processing
You cannot use include options to override exclude.dir
|exclude.fs||Exclude a filesystem from backup processing|
|include.compression||Include file(s) for compression|
Exclude files from compression if compression is enabled
See Also: Compression in TSM
Include file(s) for encryption processing
Note: Encrypted backup data cannot be deduplicated
See Also: Encryption in TSM
Exclude files from encryption processing
This option is meant for the purposes of overriding include.encrypt statements
Please note that TSM pattern matching is very similar but not exactly the same as the pattern matching for your particular operating system.
|?||Match any single character||
ab? matches abc or abd, not ab or abab
ab?de matches abcde or abbde, but not abxxde
ab??e matches abcde or abbbe, but not abe or abccee
|*||Match all characters||
ab* matches ab, abc, or abcd but not a or b
ab*de matches abde, abcde or abccccde
ab*d*f matches abdf, abcdf, abcdef or abccccdeeeeef
*.txt matches abc.txt and def.txt but not abdtxt
*:\data matches C:\data and E:\data
C:\data\* matches C:\data\file and C:\data\file.txt
C:\data\*.* matches C:\data\file.txt but not C:\data\file
|/... or \...||Match zero or more directories||
/home/.../tmp matches /home/user1/tmp, /home/user2/tmp and /home/tmp
C:\Users\...\tmp matches C:\Users\user1\tmp and C:\Users\user2\tmp and C:\Users\tmp
|[ ]||Match specific characters||abc[abc] matches abca, abcb, or abcc but not abcd or abcaa|
|-||Match a range of characters||
abc[a-c] matches abca, abcb, or abcc but not abcd or abcaa
abd[1-3] matches abc1, abc2, or abc3 but not abc4 or abc11
|\||Literal escape character||Removes the normal meaning of ?, *, [ or ] for character matching
a\?b matches a?b
a\]b matches a]b
- Limit the number of include and exclude statements as much as possible. Having too many statements for the client to evaluate can increase backup times.
- Use care with pattern matching excludes statements as you can easily exclude more than you intend.
- For example: If you use the statement "exclude.dir *:\...\cache\" to exclude browser caches, you may end up excluding other caches that should be backed up.
- Consider a more targeted approach
- Be sure that you have at least one space character between the option and the setting. It's ok to use tab characters to make your files more readable but newer TSM client versions do not accept tabs as valid white space for separating options.
- Directory structures are backed up for any directory not excluded with and exclude.dir statement. That means when you go to restore a file you may see the full directory structure even for areas where you have excluded the files.
- You are not billed for directory objects. You may have thousands of directories that are backed up, but they won't cost you anything.
- If you don't want to see the structure you can add exclude.dir statements to prevent the directory structures from being backed up.
- Backup only my user profile
exclude C:\...\* include C:\Users\username\...\*
- Backup only the E: drive
- Backup all local drives except the G: Drive
DOMAIN ALL-LOCAL -G:
- Backup only My Documents
exclude C:\...\* include C:\Users\username\Documents\...\*
- Backup only the Documents folder for all users
exclude C:\...\* include C:\Users\...\Documents\...\*
- Note that this would backup any folder named "Documents" not just the special "Documents" folder.
- Use a special management class
- Backup all files on the E: Drive to a management class called SPECIAL
include E:\...\* SPECIAL
- Backup all files in /home to a management class called SPECIAL
include /home/.../* SPECIAL
- Exclude the Recycle Bin
exclude.dir *:\recycled exclude.dir *:\recycler
- Exclude all mp3 files from backup