Example Copy Job
A copy Job, as its name indicates, creates a copy of an already existing backup Job. This can be used to change retention policy, storage media and/or where the data is physically stored. Bacula detects whether the reading and writing devices are in the same storage daemon and proceeds accordingly. In either case, the Storage Daemon currently holding the data to be copied acts as a File Daemon to the destination storage daemon.
Suppose these device definitions in bacula-dir.conf
:
Autochanger {
Name = Local-Storage
Address = local-sd.bacula6.com
SDPort = 9103
Password = "SomeFancyPassword"
Device = Local-FileChgr1
Media Type = Local-MediaType
Maximum Concurrent Jobs = 10
Autochanger = Local-Storage
}
Autochanger {
Name = Remote-Storage
Address = remote-sd.bacula6.com
SDPort = 9903
Password = "SomeOtherFancyPassword"
Device = Remote-FileChgr1
Media Type = Remote-MediaType
Maximum Concurrent Jobs = 10
Autochanger = Remote-Storage
}
This Job copies the Jobs stored in Local-Storage to Remote-Storage:
Job {
Name = "CopyLocal2Remote"
Type = "Copy"
JobDefs = "DefaultJob"
NextPool = "Remote-Pool"
Pool = "Local-Pool"
SelectionType = PoolUncopiedJobs
Storage = "Local-Storage"
WriteBootstrap = "/opt/bacula/bsr/%c_%n.bsr"
}
Be careful to be sure the Pools use the right storages:
Pool {
Name = Local-Pool
Pool Type = Backup
Storage = Local-Storage
Recycle = yes
AutoPrune = no
Volume Retention = 1 year
Maximum Volume Bytes = 50G
Maximum Volumes = 100
Label Format = "Local-Vol-"
}
Pool {
Name = Remote-Pool
Pool Type = Backup
Storage = Remote-Storage
Recycle = yes
AutoPrune = no
Volume Retention = 2 years
Maximum Volume Bytes = 50G
Maximum Volumes = 100
Label Format = "Remote-Vol-"
}
The important definitions in local-sd.bacula6.com’s bacula-sd.conf
:
Director {
Name = director.bacula6.com-dir
Password = "SomeFancyPassword"
...
}
Autochanger {
Name = Local-FileChgr1
Device = Local-FileChgr1-Dev1, Local-FileChgr1-Dev2
Changer Command = ""
Changer Device = /dev/null
}
Device {
Name = Local-FileChgr1-Dev1
Media Type = Local-MediaType
Archive Device = /backup/volumes
LabelMedia = yes
Random Access = yes
AutomaticMount = yes
RemovableMedia = no
AlwaysOpen = no
Maximum Concurrent Jobs = 5
}
Device {
Name = Local-FileChgr1-Dev2
Media Type = Local-MediaType
Archive Device = /backup/volumes
LabelMedia = yes
Random Access = yes
AutomaticMount = yes
RemovableMedia = no
AlwaysOpen = no
Maximum Concurrent Jobs = 5
}
As well as the important definitions in the remote storage daemon’s configuration (remote-sd.bacula6.com):
Director {
Name = director.bacula6.com-dir
Password = "SomeOtherFancyPassword"
...
}
Autochanger {
Name = Remote-FileChgr1
Device = Remote-FileChgr1-Dev1, Remote-FileChgr1-Dev2
Changer Command = ""
Changer Device = /dev/null
}
Device {
Name = Remote-FileChgr1-Dev1
Media Type = Remote-MediaType
Archive Device = /some/other/folder
LabelMedia = yes
Random Access = Yes
AutomaticMount = yes
Volume Poll Interval = 0
RemovableMedia = no
AlwaysOpen = no
Maximum Concurrent Jobs = 5
}
Device {
Name = Remote-FileChgr1-Dev2
Media Type = Remote-MediaType
Archive Device = /some/other/folder
LabelMedia = yes
Random Access = Yes
AutomaticMount = yes
RemovableMedia = no
Volume Poll Interval = 0
AlwaysOpen = no
Maximum Concurrent Jobs = 5
}
The Job output would be similar to:
08-Feb 10:15 director.bacula6.com-dir JobId 53: The following 1 JobId was
chosen to be copied: 52
08-Feb 10:15 director.bacula6.com-dir JobId 53: Copying using JobId=52
Job=BackupClient1.2017-02-08_10.14.41_10
08-Feb 10:15 director.bacula6.com-dir JobId 53: Start Copying JobId 53,
Job=CopyLocal2Remote.2017-02-08_10.15.14_11
08-Feb 10:15 director.bacula6.com-dir JobId 53: Using Device "Local-FileChgr1-Dev1"
to read.
08-Feb 10:15 director.bacula6.com-dir JobId 54: Created new Volume="Remote-Vol-0006",
Pool="Remote-Pool", MediaType="Remote-MediaType"
in catalog.
08-Feb 10:15 director.bacula6.com-dir JobId 54: Using Device "Remote-FileChgr1-Dev1"
to write.
08-Feb 10:15 remote-sd.bacula6.com JobId 54: Labeled new Volume "Remote-Vol-0006"
on file device "Remote-FileChgr1-Dev1" (/some/other/folder).
08-Feb 10:15 remote-sd.bacula6.com JobId 54: Wrote label to prelabeled Volume
"Remote-Vol-0006" on file device
"Remote-FileChgr1-Dev1" (/some/other/folder)
08-Feb 10:15 sd.bacula6.com JobId 53: Ready to read from volume
"Local-Vol-0005"
on file device "Local-FileChgr1-Dev1" (/backup/volumes).
08-Feb 10:15 sd.bacula6.com JobId 53: Forward spacing Volume "Local-Vol-0005"
to file:block 0:256.
08-Feb 10:15 sd.bacula6.com JobId 53: End of Volume at file 0 on device
"Local-FileChgr1-Dev1" (/backup/volumes),
Volume "Local-Vol-0005"
08-Feb 10:15 sd.bacula6.com JobId 53: Elapsed time=00:00:01,
Transfer rate=19.16 M Bytes/second
08-Feb 10:15 remote-sd.bacula6.com JobId 54: Elapsed time=00:00:01,
Transfer rate=19.16 M Bytes/second
08-Feb 10:15 remote-sd.bacula6.com JobId 54: Sending spooled attrs to
the Director. Despooling 6,114 bytes ...
08-Feb 10:15 director.bacula6.com-dir JobId 53: Bacula Enterprise
director.bacula6.com-dir 8.6.5 (10Aug16):
Build OS: x86_64-redhat-linux-gnu-bacula-enterprise redhat
Prev Backup JobId: 52
Prev Backup Job: BackupClient1.2017-02-08_10.14.41_10
New Backup JobId: 54
Current JobId: 53
Current Job: CopyLocal2Remote.2017-02-08_10.15.14_11
Backup Level: Full
Client: fd.bacula6.com
FileSet: "Full Set" 2015-03-03 17:12:31
Read Pool: "Local-Pool" (From Job resource)
Read Storage: "Local-Storage" (From Pool resource)
Write Pool: "Remote-Pool" (From Job resource)
Write Storage: "Remote-Storage" (From Job resource)
Catalog: "MyCatalog" (From Client resource)
Start time: 08-Feb-2017 10:15:16
End time: 08-Feb-2017 10:15:18
Elapsed time: 0 mins 1 secs
Priority: 10
SD Files Written: 22
SD Bytes Written: 19,167,642 (19.16 MB)
Rate: 19.16 MB/s
Volume name(s): Remote-Vol-0006
Volume Session Id: 3
Volume Session Time: 1486558493
Last Volume Bytes: 19,183,189 (19.18 MB)
SD Errors: 0
SD termination status: OK
Termination: Copying OK
Go back to the Replication: Copy/Migration Jobs.
Go back to the main Advanced Features Usage page.