3 \label{_MigrationChapter}
4 \index[general]{Migration}
5 \addcontentsline{toc}{section}{Migration}
7 The term Migration as used in the context of Bacula means moving data from
8 one Volume to another, and in particular it is a Job (similar to a backup
9 job) that reads data that was previously backed up to a Volume and writes
10 it to another Volume purging the catalog records associated with the first
11 backup job. In other words, Migration moves Bacula Job data from one
12 Volume to another. Although we mention Volumes to simplify the subject,
13 in reality, Migration is based on moving individual Jobs from one Pool to another.
15 Migrations can be based on quite a number of different criteria such as:
16 a single previous Job; a Volume; a Client; a regular expression matching
17 a Job, Volume, or Client name; the time a Job is on a Volume; high
18 and low water marks (usage or occupation) of a Pool; Volume size, ...
19 The details of these selection criteria will be defined below.
21 To run a Migration job, you must have defined a Job resource very similar
22 to a Backup Job but with {\bf Type = Migrate} instead of {\bf Type =
23 Backup}. One of the key points to remember is that the Pool that is
24 specified for the migration job is the only pool from which jobs will
25 be migrated, with one exception noted below.
27 The migration job normally is either manually started or starts
28 from a Schedule much like a backup job. It searches
29 for a previous backup Job or Jobs that match the parameters you have
30 specified in the migration Job resource, primiarily a {\bf Selection Type}
31 (detailed a bit later). Then for
32 each previous backup JobId found, the Migration Job will run a new Job which
33 copies the old Job data from the previous Volume to a new Volume in
34 the Migration Pool. It is possible that no prior Jobs are found for
35 migration, in which case, the Migration job will simply terminate having
36 done nothing, but normally at a minimum, three jobs are involved during a
40 \item The currently running Migration control Job
41 \item The previous Backup Job (already run)
42 \item A new Migration Backup Job that moves the data from the
43 previous Backup job to the new Volume.
46 If the Migration control job finds a number of JobIds to migrate (e.g.
47 it is asked to migrate one or more Volumes), it will start one new
48 migration backup job for each JobId found.
50 \subsection*{Migration Job Resource Directives}
51 \addcontentsline{toc}{section}{Migration Job Resource Directives}
53 The following directives can appear in a Director's Job resource, and they
54 are used to define a Migration job.
57 \item [Pool = \lt{}Pool-name\gt{}] The Pool specified in the Migration
58 control Job is not a new directive for the Job resource, but it is
59 particularly important because it determines what Pool will be examined for
60 finding JobIds to migrate. The exception to this is when {\bf Selection
61 Type = SQLQuery}, in which case no Pool is used, unless you
62 specifically include it in the SQL query.
64 \item [Type = Migrate]
65 {\bf Migrate} is a new type that defines the job that is run as being a
66 Migration Job. A Migration Job is a sort of control job and does not have
67 any Files associated with it, and in that sense they are more or less like
68 an Admin job. Migration jobs simply check to see if there is anything to Migrate then
69 possibly start and control new Backup jobs to migrate the data from the
70 specified Pool to another Pool.
72 \item [Selection Type = \lt{}Selection-type-keyword\gt{}]
73 The \lt{}Selection-type-keyword\gt{} determines how the migration job
74 will go about selecting what JobIds to migrate. In most cases, it is
75 used in conjunction with a {\bf Selection Pattern} to give you fine
76 control over exactly what JobIds are selected. The possible values
77 for \lt{}Selection-type-keyword\gt{} are:
79 \item [SmallestVolume] This selection keyword selects the volume with the
80 fewest bytes from the Pool to be migrated. The Pool to be migrated
81 is the Pool defined in the Migration Job resource. The migration
82 control job will then start and run one migration backup job for
83 each of the Jobs found on this Volume. The Selection Pattern, if
84 specified, is not used.
85 \item [OldestVolume] This selection keyword selects the volume with the
86 oldest last write time in the Pool to be migrated. The Pool to be
87 migrated is the Pool defined in the Migration Job resource. The
88 migration control job will then start and run one migration backup
89 job for each of the Jobs found on this Volume. The Selection
90 Pattern, if specified, is not used.
91 \item [Client] The Client selection type, first selects all the Clients
92 that have been backed up in the Pool specified by the Migration
93 Job resource, then it applies the {\bf Selection Pattern} (defined
94 below) as a regular expression to the list of Client names, giving
95 a filtered Client name list. All jobs that were backed up for those
96 filtered (regexed) Clients will be migrated.
97 The migration control job will then start and run one migration
98 backup job for each of the JobIds found for those filtered Clients.
99 \item [Volume] The Volume selection type, first selects all the Volumes
100 that have been backed up in the Pool specified by the Migration
101 Job resource, then it applies the {\bf Selection Pattern} (defined
102 below) as a regular expression to the list of Volume names, giving
103 a filtered Volume list. All JobIds that were backed up for those
104 filtered (regexed) Volumes will be migrated.
105 The migration control job will then start and run one migration
106 backup job for each of the JobIds found on those filtered Volumes.
107 \item [Job] The Job selection type, first selects all the Jobs (as
108 defined on the {\bf Name} directive in a Job resource)
109 that have been backed up in the Pool specified by the Migration
110 Job resource, then it applies the {\bf Selection Pattern} (defined
111 below) as a regular expression to the list of Job names, giving
112 a filtered Job name list. All JobIds that were run for those
113 filtered (regexed) Job names will be migrated. Note, for a given
114 Job named, they can be many jobs (JobIds) that ran.
115 The migration control job will then start and run one migration
116 backup job for each of the Jobs found.
117 \item [SQLQuery] The SQLQuery selection type, used the {\bf Selection
118 Pattern} as an SQL query to obtain the JobIds to be migrated.
119 The Selection Pattern must be a valid SELECT SQL statement for your
120 SQL engine, and it must return the JobId as the first field
122 \item [PoolOccupancy] Not yet implemented.
123 \item [PoolTime] Not yet implemented.
126 \item [Selection Pattern = \lt{}Quoted-string\gt{}]
127 The Selection Patterns permitted for each Selection-type-keyword are
130 For the OldestVolume and SmallestVolume, this
131 Selection pattern is not used (ignored).
133 For the Client, Volume, and Job
134 keywords, this pattern must be a valid regular expression that will filter
135 the appropriate item names found in the Pool.
137 For the SQLQuery keyword, this pattern must be a valid SELECT SQL statement
142 \subsection*{Migration Pool Resource Directives}
143 \addcontentsline{toc}{section}{Migration Pool Resource Directives}
145 The following directives can appear in a Director's Pool resource, and they
146 are used to define a Migration job.
149 \item [Migration Time = \lt{}time-specification\gt{}]
150 If a PoolTime migration is done, the time specified here in seconds (time
151 modifiers are permitted -- e.g. hours, ...) will be used. If the
152 previous Backup Job or Jobs selected have been in the Pool longer than
153 the specified PoolTime, then they will be migrated.
155 \item [Migration High Bytes = \lt{}byte-specification\gt{}]
156 This directive specifies the number of bytes in the Pool which will
157 trigger a migration if a {\bf PoolOccupancy} migration selection
158 type has been specified. Please note, that the fact that the Pool
159 usage goes above this level does not automatically trigger a migration
162 \item [Migration Low Bytes = \lt{}byte-specification\gt{}]
163 This directive specifies the number of bytes in the Pool which will
164 stop a migration if a {\bf PoolOccupancy} migration selection
165 type has been specified and triggered by more than Migration High
166 Bytes being in the pool. In other words, once a migration job
167 is started with {\bf PoolOccupancy} migration selection and it
168 determines that there are more than Migration High Bytes, the
169 migration job will continue to run jobs until the number of
170 bytes in the Pool drop to or below Migration Low Bytes.
172 \item [Next Pool = \lt{}pool-specification\gt{}]
173 The Next Pool directive specifies the pool to which Jobs will be
176 \item [Storage = \lt{}storage-specification\gt{}]
177 The Storage directive specifies what Storage resource will be used
178 for all Jobs that use this Pool. It takes precedence over any other
179 Storage specifications that may have been given such as in the
180 Schedule Run directive, or in the Job resource.
184 \subsection*{Example Migration Jobs}
185 \index[general]{Example Migration Jobs}
186 \addcontentsline{toc}{subsection}{Example Migration Jobs}
188 As an example, suppose you have the following Job that
193 # Define the backup Job
197 Level = Incremental # default
200 Schedule = "WeeklyCycle"
205 # Default pool definition
216 # Tape pool definition
225 # Definition of File storage device
229 Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9"
230 Device = "File" # same as Device in Storage daemon
231 Media Type = File # same as MediaType in Storage daemon
234 # Definition of DLT tape storage device
238 Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9"
239 Device = "HP DLT 80" # same as Device in Storage daemon
240 Media Type = DLT8000 # same as MediaType in Storage daemon
246 Where we have included only the essential information -- i.e. the
247 Director, FileSet, Catalog, Client, Schedule, and Messages resources are omitted.
249 As you can see, by running the NightlySave Job, the data will be backed up
250 to File storage using the Default pool to specify the Storage as File.
252 Now, if we add the following Job resource to this conf file.
257 Name = "migrate-volume"
265 Maximum Concurrent Jobs = 4
266 Selection Type = Volume
267 Selection Pattern = "File"
272 and then run the job named {\bf migrate-volume}, all volumes in the Pool
273 named Default (as specified in the migrate-volume Job that match the
274 regular expression pattern {\bf File} will be migrated to tape storage
275 DLTDrive because the {\bf Next Pool} in the Default Pool specifies that
276 Migrations should go to the pool named {\bf Tape}, which uses
277 Storage {\bf DLTDrive}.
279 If instead, we use a Job resource as follows:
292 Maximum Concurrent Jobs = 4
294 Selection Pattern = ".*Save"
299 All jobs ending with the name Save will be migrated from the File Default to
300 the Tape Pool, or from File storage to Tape storage.