TCP/IP Network Protocol

Introduction

This document describes the TCP/IP protocol used by Bareos to communicate between the various daemons and services. The definitive definition of the protocol can be found in src/lib/bsock.h, src/lib/bnet.c and src/lib/bnet_server.c.

Bareos’s network protocol is basically a “packet oriented” protocol built on a standard TCP/IP streams. At the lowest level all packet transfers are done with read() and write() requests on system sockets. Pipes are not used as they are considered unreliable for large serial data transfers between various hosts.

The chapter Network Sequence Diagrams contains message sequences of backup, restore and copy jobs as examples, respectively.

Network Routines

Using the routines described below (bnet_open, bnet_write, bnet_recv, and bnet_close) guarantees that the number of bytes you write into the socket will be received as a single record on the other end regardless of how many low level write() and read() calls are needed. All data transferred are considered to be binary data.

bnet and Threads

These bnet routines work fine in a threaded environment. However, they assume that there is only one reader or writer on the socket at any time. It is highly recommended that only a single thread access any BSOCK packet. The exception to this rule is when the socket is first opened and it is waiting for a job to start. The wait in the Storage daemon is done in one thread and then passed to another thread for subsequent handling.

If you envision having two threads using the same BSOCK, think twice, then you must implement some locking mechanism. However, it probably would not be appropriate to put locks inside the bnet subroutines for efficiency reasons.

bnet_open

To establish a connection to a server, use the subroutine:

BSOCK *bnet_open(void *jcr, char *host, char *service, int port, int *fatal) bnet_open(), if successful, returns the Bareos sock descriptor pointer to be used in subsequent bnet_send() and bnet_read() requests. If not successful, bnet_open() returns a NULL. If fatal is set on return, it means that a fatal error occurred and that you should not repeatedly call bnet_open(). Any error message will generally be sent to the JCR.

bnet_send

To send a packet, one uses the subroutine:

int bnet_send(BSOCK *sock) This routine is equivalent to a write() except that it handles the low level details. The data to be sent is expected to be in sock->msg and be sock->msglen bytes. To send a packet, bnet_send() first writes four bytes in network byte order than indicate the size of the following data packet. It returns:

Returns 0 on failure
Returns 1 on success

In the case of a failure, an error message will be sent to the JCR contained within the bsock packet.

bnet_fsend

This form uses:

int bnet_fsend(BSOCK *sock, char *format, …) and it allows you to send a formatted messages somewhat like fprintf(). The return status is the same as bnet_send.

is_bnet_error

Fro additional error information, you can call is_bnet_error(BSOCK *bsock) which will return 0 if there is no error or non-zero if there is an error on the last transmission.

is_bnet_stop

The is_bnet_stop(BSOCK *bsock) function will return 0 if there no errors and you can continue sending. It will return non-zero if there are errors or the line is closed (no more transmissions should be sent).

bnet_recv

To read a packet, one uses the subroutine:

int bnet_recv(BSOCK *sock) This routine is similar to a read() except that it handles the low level details. bnet_read() first reads packet length that follows as four bytes in network byte order. The data is read into sock->msg and is sock->msglen bytes. If the sock->msg is not large enough, bnet_recv() realloc() the buffer. It will return an error (-2) if maxbytes is less than the record size sent.

It returns:

  • >0: number of bytes read

  • 0: on end of file

  • -1: on hard end of file (i.e. network connection close)

  • -2: on error

It should be noted that bnet_recv() is a blocking read.

bnet_sig

To send a “signal” from one daemon to another, one uses the subroutine:

int bnet_sig(BSOCK *sock, SIGNAL) where SIGNAL is one of the following:

  • BNET_EOF - deprecated use BNET_EOD

  • BNET_EOD - End of data stream, new data may follow

  • BNET_EOD_POLL - End of data and poll all in one

  • BNET_STATUS - Request full status

  • BNET_TERMINATE - Conversation terminated, doing close()

  • BNET_POLL - Poll request, I’m hanging on a read

  • BNET_HEARTBEAT - Heartbeat Response requested

  • BNET_HB_RESPONSE - Only response permitted to HB

  • BNET_PROMPT - Prompt for UA

bnet_strerror

Returns a formated string corresponding to the last error that occurred.

bnet_close

The connection with the server remains open until closed by the subroutine:

void bnet_close(BSOCK *sock)

Becoming a Server

The bnet_open() and bnet_close() routines described above are used on the client side to establish a connection and terminate a connection with the server. To become a server (i.e. wait for a connection from a client), use the routine bnet_thread_server. The calling sequence is a bit complicated, please refer to the code in bnet_server.c and the code at the beginning of each daemon as examples of how to call it.

Higher Level Conventions

Within Bareos, we have established the convention that any time a single record is passed, it is sent with bnet_send() and read with bnet_recv(). Thus the normal exchange between the server (S) and the client (C) are:

S: wait for connection            C: attempt connection
S: accept connection              C: bnet_send() send request
S: bnet_recv() wait for request
S: act on request
S: bnet_send() send ack            C: bnet_recv() wait for ack

Thus a single command is sent, acted upon by the server, and then acknowledged.

In certain cases, such as the transfer of the data for a file, all the information or data cannot be sent in a single packet. In this case, the convention is that the client will send a command to the server, who knows that more than one packet will be returned. In this case, the server will enter a loop:

while ((n=bnet_recv(bsock)) > 0) {
   act on request
}
if (n < 0)
   error

The client will perform the following:

bnet_send(bsock);
bnet_send(bsock);
...
bnet_sig(bsock, BNET_EOD);

Thus the client will send multiple packets and signal to the server when all the packets have been sent by sending a zero length record.

Network startup activity

The following diagram shows the activity on a Bareos TCP server (i.e. a Bareos Director or a Bareos Storage Daemon) when a TCP client initiates a network connection. The connection protocol has two possible handshake modes. Cleartext first or TLS first. Depending on the configuration, the Bareos version and the type of client (i.e. Bareos File Daemon or Bareos Console) the handshake mode will be chosen. See chapter TLS for detailed information.

start

:accept TCP socket;

if (evaluation of cleartext hello \nis successfus) then (yes)
  if (is cleartext hello ?) then (yes)
    if (is R_CLIENT ?) then (yes)
      if (TLS required) then (yes)
        :Close connection;
        stop
      else (no)
        :Do cleartext \nhandshake;
      endif
    elseif (is R_CONSOLE AND \nconsole version < 18.2 ?) then (yes)
        :Do cleartext \nhandshake;
    elseif (TLS not configured) then (yes)
      :Do cleartext \nhandshake;
    else
      :Close connection;
      stop
    endif
    :Do cleartext handshake;
  else (no)
    :Do TLS handshake \nas a server;
    if (TLS handshake successful ?) then (no)
      :Close connection;
      stop
    else (yes)
    endif
  endif
else (no)
  :Close connection;
  stop
endif

:Handle client message;
end

Network startup activity (Bareos TCP-Server)

Debugging

Developers who want to debug the message flow can use the network dump feature. This feature is only for experts and developers and is not intended for use in a production system. Therefore no help will be provided on the command line. The arguments however can be mixed with the standard arguments.

Network Dump Command Line Options
Usage: [bconsole|bareos-dir|bareos-fd|bareos-sd]
       --zf <filename>    name and path of the dumpfile
                        (setting this switches on the network dump)
       --zp              use the plantuml notation
       --zs <stackdepth>  for additional stacktrace, stackdepth=-1: print all frames,
                                                   stackdepth=n:  print up to n frames

Network Sequence Diagrams

This chapter contains diagrams of the network traffic for the most common jobs. The jobs are simplified as much as possible to show the essence of the network traffic. Refer to chapter Job Execution for sequence diagrams with the internal program flow.

Backup of a Single File

Overview

.. uml::
  :caption: Network Sequence of a Backup of a Single File (overview)

  @startuml

  participant d as "Director"
  participant s as "Storage Daemon"
  participant c as "File Daemon"

  d <-> s: Handshake
  d  -> s: Send job information
  d  -> s: Request secure erase command
  d  -> s: Use storage, media, pool and device
  d <-  s: Request catalog: Find media for job
  d  -> s: Volume information
  d <-  s: Status: 'F' (JS_WaitFD: Waiting on File daemon)

  d <-> c: Handshake
  d  -> c: Job information
  d  -> c: Level information
  d  -> c: File information
  d  -> c: Request secure erase command
  d  -> c: Send storage address, port and tls require

  c <-> s: Handshake
  d <-  c: Ok
  d <-  s: Jobinformation start and status 'R' (JS_Running: Job Running)
  d  -> c: Fileindex
  d <-  c: 3 Jobmessages: Connected, Extended Attributes, ACLs
  d <-  c: Ok backup

  c  -> s: Append open session
  c <-  s: Ticket number
  c  -> s: Append data ticket number

  d <-  s: Request catalog: get volume info
  d <-  s: Request catalog: update media
  d <-  s: Jobmessage: Labeled
  d <-  s: Request catalog: get volume info
  d <-  s: Request catalog: update media
  d <-  s: Jobmessage: Wrote label
  d <-  s: Request catalog: update media

  c <-  s: Ok data
  c  -> s: Send filename and metadata

  d <-  s: Catalog update: file attributes
  c  -> s: Send file, metadata and checksum
  d <-  s: Catalog update: file attributes

  c  -> s: End session 1
  c <-  s: Status: 'T' (JS_Terminated: Job terminated normally)
  c  -> s: Termination message

  d <-  c: End Job
  d <-  s: Jobmessage: releasing device
  d <-  c: Termination message
  d <-  s: Request catalog: create job media
  d <-  s: Request catalog: update media
  d <-  s: Jobmessage: elapsed
  d <-  s: Status: end

  d <-  s: Termination message

  @enduml

Detailed Diagram

.. uml::
  :caption: Network Sequence of a Backup of a Single File

  @startuml

  "Director" -> "Storage Daemon": (  34) Hello Director bareos-dir calling \n
  "Storage Daemon" -> "Director": (  90) auth cram-md5 <1522876701.1562050758@bareos-sd> ssl=1 qualified-name=Storage Daemon \n
  "Director" -> "Storage Daemon": (  23) 4+Y5OExKbD/f+z+gP/+apB\n
  "Storage Daemon" -> "Director": (  13) 1000 OK auth \n
  "Director" -> "Storage Daemon": (  93) auth cram-md5 <1845913316.1562050758@bareos-dir> ssl=1 qualified-name=Director \n
  "Storage Daemon" -> "Director": (  23) 88+dN95q+5ZWh2+CO9AXZC\n
  "Director" -> "Storage Daemon": (  13) 1000 OK auth \n
  "Storage Daemon" -> "Director": (  14) 3000 OK Hello \n
  "Director" -> "Storage Daemon": ( 316) JobId=1 job=backup-bareos-fd.2019-07-02_08.59.16_06 job_name=backup-bareos-fd client_name=bareos-fd \n
  "Storage Daemon" -> "Director": (  91) 3000 OK Job SDid=1 SDtime=1562050726 Authorization=JMJH-ANIF-HAJM-FDCA-HFHN-BHNF-HLHD-AGLF \n
  "Director" -> "Storage Daemon": (  18) getSecureEraseCmd \n
  "Storage Daemon" -> "Director": (  33) 2000 OK SDSecureEraseCmd *None*  \n
  "Director" -> "Storage Daemon": (  90) use storage=File media_type=File pool_name=Full pool_type=Backup append=1 copy=0 stripe=0 \n
  "Director" -> "Storage Daemon": (  23) use device=FileStorage \n
  "Director" -> "Storage Daemon": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "Director" -> "Storage Daemon": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "Storage Daemon" -> "Director": ( 112) CatReq Job=backup-bareos-fd.2019-07-02_08.59.16_06 FindMedia=1 pool_name=Full media_type=File unwant\n
  "Director" -> "Storage Daemon": ( 329) 1000 OK VolName=Full-0001 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=0 VolMounts=0 VolErrors=0 VolWri\n
  "Storage Daemon" -> "Director": (  38) 3000 OK use device device=FileStorage \n
  "Director" -> "Storage Daemon": (   3) run\n
  "Storage Daemon" -> "Director": (  64) Status Job=backup-bareos-fd.2019-07-02_08.59.16_06 JobStatus=70 \n
  "Director" -> "File Daemon": (  34) Hello Director bareos-dir calling \n
  "File Daemon" -> "Director": (  94) auth cram-md5 <980541858.1562050758@localhost-fd> ssl=1 qualified-name=File Daemon \n
  "Director" -> "File Daemon": (  23) f/t9mT/wu8+Xp7wdOB/OyC\n
  "File Daemon" -> "Director": (  13) 1000 OK auth \n
  "Director" -> "File Daemon": (  93) auth cram-md5 <2036271438.1562050758@bareos-dir> ssl=1 qualified-name=Director \n
  "File Daemon" -> "Director": (  23) LC/Df5dYqR/gD/+Sc/N1WD\n
  "Director" -> "File Daemon": (  13) 1000 OK auth \n
  "File Daemon" -> "Director": (  17) 2000 OK Hello 54 \n
  "Director" -> "File Daemon": ( 137) JobId=1 Job=backup-bareos-fd.2019-07-02_08.59.16_06 SDid=1 SDtime=1562050726 Authorization=JMJH-ANIF\n
  "File Daemon" -> "Director": (  95) 2000 OK Job 19.1.2 (01Feb19) Linux-5.0.3-200.fc29.x86_64,redhat,Fedora release 29 (Twenty Nine)\n
  "Director" -> "File Daemon": (  28) level = full  mtime_only=0  \n
  "File Daemon" -> "Director": (  14) 2000 OK level \n
  "Director" -> "File Daemon": (  14) fileset vss=1 \n
  "Director" -> "File Daemon": (   2) I \n
  "Director" -> "File Daemon": (   6) O MAX \n
  "Director" -> "File Daemon": (   2) N \n
  "Director" -> "File Daemon": (  57) F /home/user/tape_options\n
  "Director" -> "File Daemon": (   2) N \n
  "Director" -> "File Daemon": (   2) N \n
  "Director" -> "File Daemon": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "File Daemon" -> "Director": (  16) 2000 OK include \n
  "Director" -> "File Daemon": (  18) getSecureEraseCmd \n
  "File Daemon" -> "Director": (  32) 2000 OK FDSecureEraseCmd *None* \n
  "Director" -> "File Daemon": (  42) storage address=localhost port=8103 ssl=4 \n
  "File Daemon" -> "Storage Daemon": (  56) Hello Start Job backup-bareos-fd.2019-07-02_08.59.16_06 \n
  "Storage Daemon" -> "File Daemon": (  89) auth cram-md5 <753187102.1562050758@bareos-sd> ssl=1 qualified-name=Storage Daemon \n
  "File Daemon" -> "Storage Daemon": (  23) MhI5y8+sX6+X8k/Tm81jmA\n
  "Storage Daemon" -> "File Daemon": (  13) 1000 OK auth \n
  "File Daemon" -> "Storage Daemon": (  95) auth cram-md5 <1949048950.1562050758@localhost-fd> ssl=1 qualified-name=File Daemon \n
  "Storage Daemon" -> "File Daemon": (  23) U75An+I2W//UF8/NX4QD3B\n
  "File Daemon" -> "Storage Daemon": (  13) 1000 OK auth \n
  "File Daemon" -> "Director": (  16) 2000 OK storage \n
  "Storage Daemon" -> "Director": (  55) 3010 Job backup-bareos-fd.2019-07-02_08.59.16_06 start \n
  "Storage Daemon" -> "Director": (  64) Status Job=backup-bareos-fd.2019-07-02_08.59.16_06 JobStatus=82 \n
  "Director" -> "File Daemon": (  19) backup FileIndex=0 \n
  "File Daemon" -> "Director": ( 180) Jmsg Job=backup-bareos-fd.2019-07-02_08.59.16_06 type=6 level=1562050758 localhost-fd JobId 1: Conne\n
  "File Daemon" -> "Director": ( 133) Jmsg Job=backup-bareos-fd.2019-07-02_08.59.16_06 type=6 level=1562050758 localhost-fd JobId 1: Exten\n
  "File Daemon" -> "Director": ( 118) Jmsg Job=backup-bareos-fd.2019-07-02_08.59.16_06 type=6 level=1562050758 localhost-fd JobId 1: ACL s\n
  "File Daemon" -> "Director": (  15) 2000 OK backup \n
  "File Daemon" -> "Storage Daemon": (  20) append open session \n
  "Storage Daemon" -> "File Daemon": (  24) 3000 OK open ticket = 1 \n
  "File Daemon" -> "Storage Daemon": (  14) append data 1 \n
  "Storage Daemon" -> "Director": (  88) CatReq Job=backup-bareos-fd.2019-07-02_08.59.16_06 GetVolInfo VolName=Full-0001 write=1 \n
  "Director" -> "Storage Daemon": ( 329) 1000 OK VolName=Full-0001 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=0 VolMounts=0 VolErrors=0 VolWri\n
  "Storage Daemon" -> "Director": ( 297) CatReq Job=backup-bareos-fd.2019-07-02_08.59.16_06 UpdateMedia VolName=Full-0001 VolJobs=0 VolFiles=\n
  "Director" -> "Storage Daemon": ( 329) 1000 OK VolName=Full-0001 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=0 VolMounts=0 VolErrors=0 VolWri\n
  "Storage Daemon" -> "Director": ( 193) Jmsg Job=backup-bareos-fd.2019-07-02_08.59.16_06 type=6 level=1562050758 bareos-sd JobId 1: Labeled \n
  "Storage Daemon" -> "Director": (  88) CatReq Job=backup-bareos-fd.2019-07-02_08.59.16_06 GetVolInfo VolName=Full-0001 write=1 \n
  "Director" -> "Storage Daemon": ( 329) 1000 OK VolName=Full-0001 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=0 VolMounts=0 VolErrors=0 VolWri\n
  "Storage Daemon" -> "Director": ( 309) CatReq Job=backup-bareos-fd.2019-07-02_08.59.16_06 UpdateMedia VolName=Full-0001 VolJobs=0 VolFiles=\n
  "Director" -> "Storage Daemon": ( 332) 1000 OK VolName=Full-0001 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=209 VolMounts=1 VolErrors=0 VolW\n
  "Storage Daemon" -> "Director": ( 206) Jmsg Job=backup-bareos-fd.2019-07-02_08.59.16_06 type=6 level=1562050758 bareos-sd JobId 1: Wrote la\n
  "Storage Daemon" -> "Director": ( 300) CatReq Job=backup-bareos-fd.2019-07-02_08.59.16_06 UpdateMedia VolName=Full-0001 VolJobs=1 VolFiles=\n
  "Director" -> "Storage Daemon": ( 332) 1000 OK VolName=Full-0001 VolJobs=1 VolFiles=0 VolBlocks=0 VolBytes=209 VolMounts=1 VolErrors=0 VolW\n
  "Storage Daemon" -> "File Daemon": (  13) 3000 OK data \n
  "File Daemon" -> "Storage Daemon": (   5) 1 1 0\n
  "File Daemon" -> "Storage Daemon": ( 123) 1 3 /home/user/tape_optionsP0D BJAEy IG0 B Po Po A b BAA I BdGwCZ B\n
  "File Daemon" -> "Storage Daemon": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "Storage Daemon" -> "Director": ( 209) UpdCat Job=backup-bareos-fd.2019-07-02_08.59.16_06 FileAttributes ]{1 3 /home/user\n
  "File Daemon" -> "Storage Daemon": (   5) 1 2 0\n
  "File Daemon" -> "Storage Daemon": (  27) # nothing needed for Linux \n
  "File Daemon" -> "Storage Daemon": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "File Daemon" -> "Storage Daemon": (   5) 1 3 0\n
  "File Daemon" -> "Storage Daemon": (  16) CC 9g=\n
  "File Daemon" -> "Storage Daemon": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "Storage Daemon" -> "Director": ( 102) UpdCat Job=backup-bareos-fd.2019-07-02_08.59.16_06 FileAttributes ]CC 9g=\n
  "File Daemon" -> "Storage Daemon": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "Storage Daemon" -> "File Daemon": (  20) 3000 OK append data \n
  "File Daemon" -> "Storage Daemon": (  21) append end session 1 \n
  "Storage Daemon" -> "File Daemon": (  12) 3000 OK end \n
  "File Daemon" -> "Storage Daemon": (  23) append close session 1 \n
  "Storage Daemon" -> "File Daemon": (  26) 3000 OK close Status = 84 \n
  "Storage Daemon" -> "File Daemon": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "File Daemon" -> "Storage Daemon": (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  "File Daemon" -> "Director": (  86) 2800 End Job TermCode=84 JobFiles=1 ReadBytes=27 JobBytes=27 Errors=0 VSS=0 Encrypt=0 \n
  "Storage Daemon" -> "Director": ( 169) Jmsg Job=backup-bareos-fd.2019-07-02_08.59.16_06 type=6 level=1562050758 bareos-sd JobId 1: Releasin\n
  "File Daemon" -> "Director": (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  "Storage Daemon" -> "Director": ( 166) CatReq Job=backup-bareos-fd.2019-07-02_08.59.16_06 CreateJobMedia FirstIndex=1 LastIndex=1 StartFile\n
  "Director" -> "Storage Daemon": (  23) 1000 OK CreateJobMedia \n
  "Storage Daemon" -> "Director": ( 300) CatReq Job=backup-bareos-fd.2019-07-02_08.59.16_06 UpdateMedia VolName=Full-0001 VolJobs=1 VolFiles=\n
  "Director" -> "Storage Daemon": ( 334) 1000 OK VolName=Full-0001 VolJobs=1 VolFiles=0 VolBlocks=1 VolBytes=823 VolMounts=1 VolErrors=0 VolW\n
  "Storage Daemon" -> "Director": ( 147) Jmsg Job=backup-bareos-fd.2019-07-02_08.59.16_06 type=6 level=1562050758 bareos-sd JobId 1: Elapsed \n
  "Storage Daemon" -> "Director": (  64) Status Job=backup-bareos-fd.2019-07-02_08.59.16_06 JobStatus=84 \n
  "Storage Daemon" -> "Director": ( 102) 3099 Job backup-bareos-fd.2019-07-02_08.59.16_06 end JobStatus=84 JobFiles=1 JobBytes=166 JobErrors=\n
  "Storage Daemon" -> "Director": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "Storage Daemon" -> "Director": (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  "Storage Daemon" -> "Director": (  -1) BNET_EOD - End of data stream, new data may follow\n
  "Storage Daemon" -> "Director": (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n

  @enduml

Restore of a Single File

Overview single file restore

.. uml::
  :caption: Network Sequence of a Restore of a Single File (overview)

  @startuml

  participant dir as "Director"
  participant sd as "Storage Daemon"
  participant fd as "File Daemon"

  dir <-> sd: Handshake
  dir  -> sd: Send job information
  dir  -> sd: Request secure erase command
  dir  -> sd: Use storage, media, pool and device

  dir <-> fd: Handshake
  dir  -> fd: Job information
  dir  -> fd: Level information
  dir  -> fd: File information
  dir  -> fd: Request secure erase command

  dir  -> sd: Bootstrap information
  dir <-  sd: Status: 'F' (JS_WaitFD: Waiting on File daemon)

  dir  -> fd: Send storage address, port and tls

  fd  <-> sd: Handshake
  dir <-  fd: Ok
  dir <-  sd: Jobinformation start and status 'R' (JS_Running: Job Running)
  dir  -> fd: Restore

  fd   -> sd: Open Read session and read data
  dir <-  sd: Request catalog: get volume info
  dir <-  sd: 2 Jobmessages

  fd  <-  sd: Filename, metadata and file contents

  dir <-  sd: 3 Jobmessages: "End of volume", "End of all volumes", "Releasing device"
  dir <-  sd: Request catalog: update media
  dir <-  fd: Jobmessage: "Connected"

  fd   -> sd: Read close connection
  fd  <-  sd: Close status = 'R' (JS_Running: Running)
  fd   -> sd: Termination message
  dir <-  fd: Storage end

  dir <-  sd: Status: 'T' (JS_Terminated: Job terminated normally)
  dir <-  sd: Terminate connection

  dir  -> fd: End restore
  dir <-  sd: Termination message
  fd   -> sd: Termination message

  dir <-  fd: Status message: 'T' (JS_Terminated: Job terminated normally)
  dir <-  fd: Termination message


  @enduml

Detailed Diagram single file restore

.. uml::
  :caption: Network Sequence of a Restore of a Single File

  @startuml

  participant dir as "Director"
  participant sd as "Storage Daemon"
  participant fd as "File Daemon"

  dir -> sd: (  34) Hello Director bareos-dir calling \n
  sd -> dir: (  90) auth cram-md5 <1043480599.1562050929@bareos-sd> ssl=1 qualified-name=R_STORAGE::bareos-sd \n
  dir -> sd: (  23) o6+/u9Jtuy/cO4o5Aw/TkC\n
  sd -> dir: (  13) 1000 OK auth \n
  dir -> sd: (  93) auth cram-md5 <1818293267.1562050929@bareos-dir> ssl=1 qualified-name=R_DIRECTOR::bareos-dir \n
  sd -> dir: (  23) jn+XJ59ej9+wo9Ys38+TTC\n
  dir -> sd: (  13) 1000 OK auth \n
  sd -> dir: (  14) 3000 OK Hello \n
  dir -> sd: ( 295) JobId=3 job=RestoreFiles.2019-07-02_09.02.07_10 job_name=RestoreFiles client_name=bareos-fd type=82 \n
  sd -> dir: (  91) 3000 OK Job SDid=3 SDtime=1562050726 Authorization=DCHL-DBLN-DPFH-KPEE-BKCO-ADNL-NGIK-KEDM \n
  dir -> sd: (  18) getSecureEraseCmd \n
  sd -> dir: (  33) 2000 OK SDSecureEraseCmd *None*  \n
  dir -> sd: (  97) use storage=File media_type=File pool_name=Incremental pool_type=Backup append=0 copy=0 stripe=0 \n
  dir -> sd: (  23) use device=FileStorage \n
  dir -> sd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  dir -> sd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  38) 3000 OK use device device=FileStorage \n
  dir -> fd: (  34) Hello Director bareos-dir calling \n
  fd -> dir: (  94) auth cram-md5 <726584478.1562050929@localhost-fd> ssl=1 qualified-name=R_CLIENT::localhost-fd \n
  dir -> fd: (  23) w7wc4+dN5R/iD8/Wc5dJUA\n
  fd -> dir: (  13) 1000 OK auth \n
  dir -> fd: (  93) auth cram-md5 <1703515648.1562050929@bareos-dir> ssl=1 qualified-name=R_DIRECTOR::bareos-dir \n
  fd -> dir: (  23) Y9+K8//xa7/Cvl/jsgEdXB\n
  dir -> fd: (  13) 1000 OK auth \n
  fd -> dir: (  17) 2000 OK Hello 54 \n
  dir -> fd: ( 133) JobId=3 Job=RestoreFiles.2019-07-02_09.02.07_10 SDid=3 SDtime=1562050726 Authorization=DCHL-DBLN-DPF\n
  fd -> dir: (  95) 2000 OK Job 19.1.2 (01Feb19) Linux-5.0.3-200.fc29.x86_64,redhat,Fedora release 29 (Twenty Nine)\n
  dir -> fd: (  18) getSecureEraseCmd \n
  fd -> dir: (  32) 2000 OK FDSecureEraseCmd *None* \n
  dir -> sd: (  10) bootstrap \n
  dir -> sd: (  15) Storage="File" \n
  dir -> sd: (  19) Volume="Full-0001" \n
  dir -> sd: (  17) MediaType="File" \n
  dir -> sd: (  21) Device="FileStorage" \n
  dir -> sd: (  15) VolSessionId=1 \n
  dir -> sd: (  26) VolSessionTime=1562050726 \n
  dir -> sd: (  16) VolAddr=209-822 \n
  dir -> sd: (  12) FileIndex=1 \n
  dir -> sd: (   8) Count=1 \n
  dir -> sd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  18) 3000 OK bootstrap \n
  dir -> sd: (   3) run\n
  sd -> dir: (  60) Status Job=RestoreFiles.2019-07-02_09.02.07_10 JobStatus=70 \n
  dir -> fd: (  96) storage address=localhost port=8103 ssl=4 Authorization=DCHL-DBLN-DPFH-KPEE-BKCO-ADNL-NGIK-KEDM \n
  fd -> sd: (  52) Hello Start Job RestoreFiles.2019-07-02_09.02.07_10 \n
  sd -> fd: (  90) auth cram-md5 <1895001168.1562050931@bareos-sd> ssl=1 qualified-name=R_STORAGE::bareos-sd \n
  fd -> sd: (  23) 39Yae9gJW5l/iz/7c++s5B\n
  sd -> fd: (  13) 1000 OK auth \n
  fd -> sd: (  94) auth cram-md5 <525062249.1562050931@localhost-fd> ssl=1 qualified-name=R_CLIENT::localhost-fd \n
  sd -> fd: (  23) n49F5gkU+4/fhW8sVXFc3B\n
  fd -> sd: (  13) 1000 OK auth \n
  fd -> dir: (  16) 2000 OK storage \n
  sd -> dir: (  51) 3010 Job RestoreFiles.2019-07-02_09.02.07_10 start \n
  sd -> dir: (  60) Status Job=RestoreFiles.2019-07-02_09.02.07_10 JobStatus=82 \n
  dir -> fd: (  56) restore replace=a prelinks=0 where=/tmp/bareos-restores \n
  fd -> dir: (  16) 2000 OK restore \n
  fd -> sd: (  53) read open session = DummyVolume 3 1562050726 0 0 0 0 \n
  sd -> fd: (  24) 3000 OK open ticket = 3 \n
  fd -> sd: (  12) read data 3 \n
  sd -> dir: (  84) CatReq Job=RestoreFiles.2019-07-02_09.02.07_10 GetVolInfo VolName=Full-0001 write=0 \n
  dir -> sd: ( 334) 1000 OK VolName=Full-0001 VolJobs=1 VolFiles=0 VolBlocks=1 VolBytes=823 VolMounts=1 VolErrors=0 VolW\n
  sd -> dir: ( 196) Jmsg Job=RestoreFiles.2019-07-02_09.02.07_10 type=6 level=1562050931 bareos-sd JobId 3: Ready to rea\n
  sd -> fd: (  13) 3000 OK data \n
  sd -> dir: ( 144) Jmsg Job=RestoreFiles.2019-07-02_09.02.07_10 type=6 level=1562050931 bareos-sd JobId 3: Forward spac\n
  sd -> fd: (  27) rechdr 1 1562050726 1 1 123\n
  sd -> fd: ( 123) 1 3 /home/franku/01-prj/git/bareos/regress/bin/tape_optionsP0D BJAEy IG0 B Po Po A b BAA I BdGwCZ B\n
  sd -> fd: (  26) rechdr 1 1562050726 1 2 27\n
  sd -> fd: (  27) # nothing needed for Linux \n
  sd -> fd: (  26) rechdr 1 1562050726 1 3 16\n
  sd -> fd: (  16) CC 9g=\n
  sd -> dir: ( 201) Jmsg Job=RestoreFiles.2019-07-02_09.02.07_10 type=6 level=1562050931 bareos-sd JobId 3: End of Volum\n
  sd -> dir: ( 108) Jmsg Job=RestoreFiles.2019-07-02_09.02.07_10 type=6 level=1562050931 bareos-sd JobId 3: End of all v\n
  sd -> fd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: ( 165) Jmsg Job=RestoreFiles.2019-07-02_09.02.07_10 type=6 level=1562050931 bareos-sd JobId 3: Releasing de\n
  sd -> dir: ( 297) CatReq Job=RestoreFiles.2019-07-02_09.02.07_10 UpdateMedia VolName=Full-0001 VolJobs=1 VolFiles=0 Vo\n
  fd -> dir: ( 176) Jmsg Job=RestoreFiles.2019-07-02_09.02.07_10 type=6 level=1562050931 localhost-fd JobId 3: Connected\n
  fd -> sd: (  21) read close session 3 \n
  dir -> sd: ( 335) 1000 OK VolName=Full-0001 VolJobs=1 VolFiles=0 VolBlocks=1 VolBytes=823 VolMounts=1 VolErrors=0 VolW\n
  sd -> fd: (  26) 3000 OK close Status = 82 \n
  sd -> fd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  fd -> sd: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  fd -> dir: (  20) 2000 OK storage end \n
  sd -> dir: (  96) 3099 Job RestoreFiles.2019-07-02_09.02.07_10 end JobStatus=84 JobFiles=0 JobBytes=0 JobErrors=0 \n
  sd -> dir: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  sd -> dir: (  -1) BNET_EOD - End of data stream, new data may follow\n
  dir -> fd: (  10) endrestore\n
  sd -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  fd -> sd: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  fd -> dir: (  86) 2800 End Job TermCode=84 JobFiles=1 ReadBytes=27 JobBytes=27 Errors=0 VSS=0 Encrypt=0 \n
  fd -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n

  @enduml

Migration of a Single Volume

Overview single volume migration

.. uml::
  :caption: Network Sequence of Migration of a Volume (overview)

  @startuml

  participant dir as "Director"
  participant sd as "Read Storage Daemon"
  participant sd2 as "Write Storage Daemon"

  dir <-> sd: Handshake
  dir <-> sd2: Handshake

  dir  -> sd: Job information
  dir  -> sd: Bootstrap information
  dir  -> sd: Request secure erase command

  dir  -> sd2: Job information
  dir  -> sd2: Bootstrap information
  dir  -> sd2: Request secure erase command
  dir  -> sd2: Storage and device commands
  dir <-  sd2: Request catalog: Find media

  dir  -> sd: Replicate command

  sd  <-> sd2: Handshake
  dir  -> sd: run
  dir <-  sd2: Job backup start and status: 'R' (JS_RUNNING, "Running")

  dir <-  sd: Request catalog: Get volume info
  dir <-  sd: Status: 'R' (JS_RUNNING, "Running")

  dir <-  sd: 2 Jobmessage: "Connected" and "Ready"

  sd   -> sd2: start replicate
  sd  <-  sd2: replicate ticket

  dir <-  sd2: Request catalog "Get volume info" and "Update media"

  dir <-  sd: Jobmessage: "Forward spacing volume"

  sd   -> sd2: Filename and metadata
  dir <-  sd2: Catalog update: File attributes
  sd   -> sd2: File and metadata

  dir <-  sd: 2 Jobmessages: "End of volume", "End of all volumes"
  dir <-  sd2: Catalog update: File attributes

  dir <-  sd2: Releasing device
  dir <-  sd2: Catalog requests: "Create job media", "Update media"
  dir <-  sd2: Status: 'T' (Job terminated normally)

  sd  <-  sd2: Termination message
  dir <-  sd: Jobmessage: "Releasing"
  dir <-  sd2: Catalog request: Update media

  dir <-  sd2: Termination message
  dir <-  sd2: Termination message

  dir <-  sd: Status: 'R' (JS_RUNNING, "Running")
  dir <-  sd: Status: 'T' (Job terminated normally)

  dir <-  sd: Termination message
  dir <-  sd: Termination message

  @enduml

Detailed Diagram single volume migration

.. uml::
  :caption: Network Sequence of a Migration of a Single Volume

  @startuml

  participant dir as "Director"
  participant sd as "Read Storage Daemon"
  participant sd2 as "Write Storage Daemon"

  dir -> sd: (  37) Hello Director 127.0.0.1-dir calling \n
  sd -> dir: (  95) auth cram-md5 <313919589.1561639169@127.0.0.1-sd> ssl=1 qualified-name=R_STORAGE::127.0.0.1-sd \n
  dir -> sd: (  23) jBE6c4taR7Ap++/m5/ARfD\n
  sd -> dir: (  13) 1000 OK auth \n
  dir -> sd: (  98) auth cram-md5 <367075617.1561639169@127.0.0.1-dir> ssl=1 qualified-name=R_DIRECTOR::127.0.0.1-dir \n
  sd -> dir: (  23) N1/Vd8Bv68BBD7/Eq6/+1A\n
  dir -> sd: (  13) 1000 OK auth \n
  sd -> dir: (  14) 3000 OK Hello \n
  dir -> sd2: (  37) Hello Director 127.0.0.1-dir calling \n
  sd2 -> dir: (  98) auth cram-md5 <1212840149.1561639169@127.0.0.1-sd2> ssl=1 qualified-name=R_STORAGE::127.0.0.1-sd\n
  dir -> sd2: (  23) d/+a09+H964iJQcJV9+gcD\n
  sd2 -> dir: (  13) 1000 OK auth \n
  dir -> sd2: (  99) auth cram-md5 <1112228786.1561639169@127.0.0.1-dir> ssl=1 qualified-name=R_DIRECTOR::127.0.0.1-dir \n
  sd2 -> dir: (  23) Hyxil9Q8L//9T6EtK1/zSD\n
  dir -> sd2: (  13) 1000 OK auth \n
  sd2 -> dir: (  14) 3000 OK Hello \n
  dir -> sd: ( 316) JobId=3 job=CopyToRemote.2019-06-27_14.39.27_06 job_name=CopyToRemote client_name=127.0.0.1-fd type=\n
  sd -> dir: (  91) 3000 OK Job SDid=2 SDtime=1561639130 Authorization=OBGM-NHFF-EPHK-MHPG-CPGP-NHFJ-DOCE-MLMI \n
  dir -> sd: (  10) bootstrap \n
  dir -> sd: (  15) Storage="File" \n
  dir -> sd: (  19) Volume="Full-0001" \n
  dir -> sd: (  17) MediaType="File" \n
  dir -> sd: (  21) Device="FileStorage" \n
  dir -> sd: (  15) VolSessionId=1 \n
  dir -> sd: (  26) VolSessionTime=1561639130 \n
  dir -> sd: (  16) VolAddr=197-793 \n
  dir -> sd: (  12) FileIndex=1 \n
  dir -> sd: (   8) Count=1 \n
  dir -> sd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  18) 3000 OK bootstrap \n
  dir -> sd: (  18) getSecureEraseCmd \n
  sd -> dir: (  33) 2000 OK SDSecureEraseCmd *None*  \n
  dir -> sd: (  90) use storage=File media_type=File pool_name=Full pool_type=Backup append=0 copy=0 stripe=0 \n
  dir -> sd: (  23) use device=FileStorage \n
  dir -> sd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  dir -> sd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  38) 3000 OK use device device=FileStorage \n
  dir -> sd2: ( 304) JobId=4 job=backup.2019-06-27_14.39.27_07 job_name=backup client_name=127.0.0.1-fd type=66 level=70 \n
  sd2 -> dir: (  91) 3000 OK Job SDid=1 SDtime=1561639139 Authorization=NNOL-AHHC-DDNB-MNBL-OLDG-IAMP-MKHC-FPDD \n
  dir -> sd2: (  18) getSecureEraseCmd \n
  sd2 -> dir: (  33) 2000 OK SDSecureEraseCmd *None*  \n
  dir -> sd2: (  99) use storage=File2 media_type=File2 pool_name=MigrationPool pool_type=Copy append=1 copy=0 stripe=0 \n
  dir -> sd2: (  30) use device=MigrateFileStorage \n
  dir -> sd2: (  -1) BNET_EOD - End of data stream, new data may follow\n
  dir -> sd2: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd2 -> dir: ( 112) CatReq Job=backup.2019-06-27_14.39.27_07 FindMedia=1 pool_name=MigrationPool media_type=File2 unwant\n
  dir -> sd2: ( 330) 1000 OK VolName=Full2-0002 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=0 VolMounts=0 VolErrors=0 VolWr\n
  sd2 -> dir: (  45) 3000 OK use device device=MigrateFileStorage \n
  dir -> sd2: (   6) listen\n
  sd2 -> dir: (  54) Status Job=backup.2019-06-27_14.39.27_07 JobStatus=83 \n
  dir -> sd: ( 140) replicate JobId=4 Job=backup.2019-06-27_14.39.27_07 address=127.0.0.1 port=8104 ssl=4 Authorization=\n
  sd -> sd2: (  54) Hello Start Storage Job backup.2019-06-27_14.39.27_07 \n
  sd2 -> sd: (  98) auth cram-md5 <1580233842.1561639169@127.0.0.1-sd2> ssl=1 qualified-name=R_STORAGE::127.0.0.1-sd\n
  sd -> sd2: (  23) Pl0vhA8lUEM5vl/nPR/YpD\n
  sd2 -> sd: (  13) 1000 OK auth \n
  sd -> sd2: (  95) auth cram-md5 <548480578.1561639169@127.0.0.1-sd> ssl=1 qualified-name=R_STORAGE::127.0.0.1-sd \n
  sd2 -> sd: (  23) +hxgc31wUBtPuR5zM6MIpC\n
  sd -> sd2: (  13) 1000 OK auth \n
  sd -> dir: (  18) 3000 OK replicate \n
  dir -> sd: (   3) run\n
  sd2 -> dir: (  45) 3010 Job backup.2019-06-27_14.39.27_07 start \n
  sd2 -> dir: (  54) Status Job=backup.2019-06-27_14.39.27_07 JobStatus=82 \n
  sd -> dir: (  84) CatReq Job=CopyToRemote.2019-06-27_14.39.27_06 GetVolInfo VolName=Full-0001 write=0 \n
  dir -> sd: ( 334) 1000 OK VolName=Full-0001 VolJobs=1 VolFiles=0 VolBlocks=1 VolBytes=794 VolMounts=1 VolErrors=0 VolW\n
  sd -> dir: (  60) Status Job=CopyToRemote.2019-06-27_14.39.27_06 JobStatus=82 \n
  sd -> dir: ( 176) Jmsg Job=CopyToRemote.2019-06-27_14.39.27_06 type=6 level=1561639169 127.0.0.1-sd JobId 3: Connected\n
  sd -> dir: ( 206) Jmsg Job=CopyToRemote.2019-06-27_14.39.27_06 type=6 level=1561639169 127.0.0.1-sd JobId 3: Ready to \n
  sd -> sd2: (  16) start replicate \n
  sd2 -> sd: (  35) 3000 OK start replicate ticket = 1 \n
  sd -> sd2: (  17) replicate data 1 \n
  sd2 -> dir: (  79) CatReq Job=backup.2019-06-27_14.39.27_07 GetVolInfo VolName=Full2-0002 write=1 \n
  dir -> sd2: ( 330) 1000 OK VolName=Full2-0002 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=0 VolMounts=0 VolErrors=0 VolWr\n
  sd2 -> dir: ( 288) CatReq Job=backup.2019-06-27_14.39.27_07 UpdateMedia VolName=Full2-0002 VolJobs=0 VolFiles=0 VolBloc\n
  dir -> sd2: ( 330) 1000 OK VolName=Full2-0002 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=0 VolMounts=0 VolErrors=0 VolWr\n
  sd2 -> dir: ( 202) Jmsg Job=backup.2019-06-27_14.39.27_07 type=6 level=1561639169 127.0.0.1-sd2 JobId 4: Labeled new Vo\n
  sd2 -> dir: (  79) CatReq Job=backup.2019-06-27_14.39.27_07 GetVolInfo VolName=Full2-0002 write=1 \n
  dir -> sd2: ( 330) 1000 OK VolName=Full2-0002 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=0 VolMounts=0 VolErrors=0 VolWr\n
  sd2 -> dir: ( 300) CatReq Job=backup.2019-06-27_14.39.27_07 UpdateMedia VolName=Full2-0002 VolJobs=0 VolFiles=0 VolBloc\n
  dir -> sd2: ( 333) 1000 OK VolName=Full2-0002 VolJobs=0 VolFiles=0 VolBlocks=0 VolBytes=209 VolMounts=1 VolErrors=0 Vol\n
  sd2 -> dir: ( 215) Jmsg Job=backup.2019-06-27_14.39.27_07 type=6 level=1561639169 127.0.0.1-sd2 JobId 4: Wrote label to\n
  sd2 -> dir: ( 291) CatReq Job=backup.2019-06-27_14.39.27_07 UpdateMedia VolName=Full2-0002 VolJobs=1 VolFiles=0 VolBloc\n
  dir -> sd2: ( 333) 1000 OK VolName=Full2-0002 VolJobs=1 VolFiles=0 VolBlocks=0 VolBytes=209 VolMounts=1 VolErrors=0 Vol\n
  sd2 -> sd: (  13) 3000 OK data \n
  sd -> dir: ( 147) Jmsg Job=CopyToRemote.2019-06-27_14.39.27_06 type=6 level=1561639169 127.0.0.1-sd JobId 3: Forward s\n
  sd -> sd2: (   5) 1 1 0\n
  sd -> sd2: ( 130) 1 3 /home/franku/01-prj/git/bareos-master/regress/bin/tape_optionsP0D BFAYW IG0 B Po Po A b BAA I B\n
  sd -> sd2: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd2 -> dir: ( 206) UpdCat Job=backup.2019-06-27_14.39.27_07 FileAttributes ]1 3 /home/franku/01-prj/\n
  sd -> sd2: (   5) 1 2 0\n
  sd -> sd2: (  27) # nothing needed for Linux \n
  sd -> sd2: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> sd2: (   5) 1 3 0\n
  sd -> sd2: (  16) CC 9g=\n
  sd -> dir: ( 211) Jmsg Job=CopyToRemote.2019-06-27_14.39.27_06 type=6 level=1561639169 127.0.0.1-sd JobId 3: End of Vo\n
  sd2 -> dir: (  92) UpdCat Job=backup.2019-06-27_14.39.27_07 FileAttributes ]CC 9g=\n
  sd -> dir: ( 111) Jmsg Job=CopyToRemote.2019-06-27_14.39.27_06 type=6 level=1561639169 127.0.0.1-sd JobId 3: End of al\n
  sd -> sd2: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> sd2: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd2 -> sd: (  23) 3000 OK replicate data \n
  sd2 -> dir: ( 177) Jmsg Job=backup.2019-06-27_14.39.27_07 type=6 level=1561639169 127.0.0.1-sd2 JobId 4: Releasing devi\n
  sd -> sd2: (  14) end replicate \n
  sd2 -> dir: ( 156) CatReq Job=backup.2019-06-27_14.39.27_07 CreateJobMedia FirstIndex=1 LastIndex=1 StartFile=0 EndFile\n
  dir -> sd2: (  23) 1000 OK CreateJobMedia \n
  sd2 -> dir: ( 291) CatReq Job=backup.2019-06-27_14.39.27_07 UpdateMedia VolName=Full2-0002 VolJobs=1 VolFiles=0 VolBloc\n
  dir -> sd2: ( 335) 1000 OK VolName=Full2-0002 VolJobs=1 VolFiles=0 VolBlocks=1 VolBytes=820 VolMounts=1 VolErrors=0 Vol\n
  sd2 -> dir: ( 141) Jmsg Job=backup.2019-06-27_14.39.27_07 type=6 level=1561639169 127.0.0.1-sd2 JobId 4: Elapsed time=0\n
  sd2 -> dir: (  54) Status Job=backup.2019-06-27_14.39.27_07 JobStatus=84 \n
  sd2 -> sd: (  22) 3000 OK end replicate \n
  sd -> sd2: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  sd -> dir: ( 175) Jmsg Job=CopyToRemote.2019-06-27_14.39.27_06 type=6 level=1561639169 127.0.0.1-sd JobId 3: Releasing\n
  sd2 -> dir: (  92) 3099 Job backup.2019-06-27_14.39.27_07 end JobStatus=84 JobFiles=1 JobBytes=173 JobErrors=0 \n
  sd -> dir: ( 297) CatReq Job=CopyToRemote.2019-06-27_14.39.27_06 UpdateMedia VolName=Full-0001 VolJobs=1 VolFiles=0 Vo\n
  sd2 -> dir: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd2 -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  sd2 -> dir: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd2 -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  dir -> sd: ( 335) 1000 OK VolName=Full-0001 VolJobs=1 VolFiles=0 VolBlocks=1 VolBytes=794 VolMounts=1 VolErrors=0 VolW\n
  sd -> dir: (  60) Status Job=CopyToRemote.2019-06-27_14.39.27_06 JobStatus=82 \n
  sd -> dir: (  98) 3099 Job CopyToRemote.2019-06-27_14.39.27_06 end JobStatus=84 JobFiles=1 JobBytes=173 JobErrors=0 \n
  sd -> dir: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  sd -> dir: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n

  @enduml

Verify of a Single File (Mode: Volume to Catalog)

Overview single file verify

.. uml::
  :caption: Network Sequence of a Verify of a Single File (Overview, Mode: Volume to Catalog)

  @startuml

  participant dir as "Director"
  participant sd as "Storage Daemon"
  participant fd as "File Daemon"

  dir <-> sd: Handshake
  dir  -> sd: Job information
  dir  -> sd: Bootstrap information
  dir  -> sd: Use storage
  dir  -> sd: Use device

  dir <-> fd: Handshake
  dir  -> fd: Job information
  dir  -> fd: Bootstrap information
  dir  -> fd: Filename and metadata

  sd  <-> fd: Handshake
  dir <-  sd: Job start
  dir  -> fd: Level = volume
  dir <-  sd: Job status: 'R' (JS_RUNNING, "Running")

  sd  <-  fd: Open read session
  sd   -> fd: Ticket number

  dir <-  sd: Request catalog: Get volume info
  dir <-  sd: 2 Jobmessages

  sd   -> fd: File and metadata
  dir <-  sd: 3 Jobmessages
  dir <-  sd: Request catalog: Update media

  dir <-  fd: Filename and checksum
  dir  -> fd: Status Ok
  sd  <-  fd: Termintation message

  dir <-  sd: Job status: 'T' (JS_TERMINATED, "Job terminated normally")
  sd  <-  fd: Termintation message
  dir <-  fd: Job status: 'T' (JS_TERMINATED, "Job terminated normally")
  dir <-  sd: Termination message
  dir <-  fd: Termination message

  @enduml

Detailed Diagram single file verify

.. uml::
  :caption: Network Sequence of a Verify of a Single File (Mode: Volume to Catalog)

  @startuml

  participant dir as "Director"
  participant sd as "Storage Daemon"
  participant fd as "File Daemon"

  dir -> sd: (  34) Hello Director bareos-dir calling \n
  sd -> dir: (  89) auth cram-md5 <227896875.1562596730@bareos-sd> ssl=1 qualified-name=R_STORAGE::bareos-sd \n
  dir -> sd: (  23) K+YOkE/iz//+Lj/Wai9z8A\n
  sd -> dir: (  13) 1000 OK auth \n
  dir -> sd: (  93) auth cram-md5 <2000591880.1562596730@bareos-dir> ssl=1 qualified-name=R_DIRECTOR::bareos-dir \n
  sd -> dir: (  23) aA/qz5/CPAx/e0+vx+s78C\n
  dir -> sd: (  13) 1000 OK auth \n
  sd -> dir: (  14) 3000 OK Hello \n
  dir -> sd: ( 331) JobId=22 job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 job_name=verifybackup-bareos-fd client_\n
  sd -> dir: (  91) 3000 OK Job SDid=5 SDtime=1562596174 Authorization=GIJK-IAFL-MFOD-NIGM-FFDB-GLKB-CGAD-LKKH \n
  dir -> sd: (  10) bootstrap \n
  dir -> sd: (  15) Storage="File" \n
  dir -> sd: (  19) Volume="Full-0001" \n
  dir -> sd: (  17) MediaType="File" \n
  dir -> sd: (  21) Device="FileStorage" \n
  dir -> sd: (  15) VolSessionId=4 \n
  dir -> sd: (  26) VolSessionTime=1562596174 \n
  dir -> sd: (  26) VolAddr=58310542-58311155 \n
  dir -> sd: (  12) FileIndex=1 \n
  dir -> sd: (   8) Count=1 \n
  dir -> sd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  18) 3000 OK bootstrap \n
  dir -> sd: (  18) getSecureEraseCmd \n
  sd -> dir: (  33) 2000 OK SDSecureEraseCmd *None*  \n
  dir -> sd: (  90) use storage=File media_type=File pool_name=Full pool_type=Backup append=0 copy=0 stripe=0 \n
  dir -> sd: (  23) use device=FileStorage \n
  dir -> sd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  dir -> sd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  38) 3000 OK use device device=FileStorage \n
  dir -> sd: (   3) run\n
  sd -> dir: (  71) Status Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 JobStatus=70 \n
  dir -> fd: (  34) Hello Director bareos-dir calling \n
  fd -> dir: (  95) auth cram-md5 <1035931654.1562596730@localhost-fd> ssl=1 qualified-name=R_CLIENT::localhost-fd \n
  dir -> fd: (  23) G//GCjJXb5p8d7gtx/46xD\n
  fd -> dir: (  13) 1000 OK auth \n
  dir -> fd: (  92) auth cram-md5 <135291880.1562596730@bareos-dir> ssl=1 qualified-name=R_DIRECTOR::bareos-dir \n
  fd -> dir: (  23) L9YY5i/A5F/119RJM5xFTA\n
  dir -> fd: (  13) 1000 OK auth \n
  fd -> dir: (  17) 2000 OK Hello 54 \n
  dir -> fd: ( 145) JobId=22 Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 SDid=5 SDtime=1562596174 Authorization=G\n
  fd -> dir: (  95) 2000 OK Job 19.1.2 (01Feb19) Linux-5.0.3-200.fc29.x86_64,redhat,Fedora release 29 (Twenty Nine)\n
  dir -> fd: (  14) fileset vss=1 \n
  dir -> fd: (   2) I \n
  dir -> fd: (   6) O MAX \n
  dir -> fd: (   2) N \n
  dir -> fd: (  57) F /home/franku/01-prj/git/bareos/regress/bin/tape_options\n
  dir -> fd: (   2) N \n
  dir -> fd: (   2) N \n
  dir -> fd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  fd -> dir: (  16) 2000 OK include \n
  dir -> fd: (  57) storage address=localhost port=8103 ssl=4 Authorization= \n
  fd -> sd: (  63) Hello Start Job verify_backup-bareos-fd.2019-07-08_16.38.48_20 \n
  sd -> fd: (  89) auth cram-md5 <378269507.1562596730@bareos-sd> ssl=1 qualified-name=R_STORAGE::bareos-sd \n
  fd -> sd: (  23) gD/Ini0F0/M7K4hqt8/gvC\n
  sd -> fd: (  13) 1000 OK auth \n
  fd -> sd: (  94) auth cram-md5 <640034303.1562596730@localhost-fd> ssl=1 qualified-name=R_CLIENT::localhost-fd \n
  sd -> fd: (  23) q0/U7S+Hy5snO+IoR7VUNA\n
  fd -> sd: (  13) 1000 OK auth \n
  fd -> dir: (  16) 2000 OK storage \n
  sd -> dir: (  62) 3010 Job verify_backup-bareos-fd.2019-07-08_16.38.48_20 start \n
  dir -> fd: (  20) verify level=volume \n
  sd -> dir: (  71) Status Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 JobStatus=82 \n
  fd -> dir: (  15) 2000 OK verify \n
  fd -> sd: (  53) read open session = DummyVolume 5 1562596174 0 0 0 0 \n
  sd -> fd: (  24) 3000 OK open ticket = 5 \n
  fd -> sd: (  12) read data 5 \n
  sd -> dir: (  95) CatReq Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 GetVolInfo VolName=Full-0001 write=0 \n
  dir -> sd: ( 355) 1000 OK VolName=Full-0001 VolJobs=3 VolFiles=0 VolBlocks=905 VolBytes=58311156 VolMounts=3 VolErrors\n
  sd -> dir: ( 208) Jmsg Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 type=6 level=1562596730 bareos-sd JobId 22: \n
  sd -> fd: (  13) 3000 OK data \n
  sd -> dir: ( 161) Jmsg Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 type=6 level=1562596730 bareos-sd JobId 22: \n
  sd -> fd: (  27) rechdr 4 1562596174 1 1 123\n
  sd -> fd: ( 123) 1 3 /home/franku/01-prj/git/bareos/regress/bin/tape_optionsP0D BIBFz IG0 B Po Po A b BAA I BdI0hf B\n
  sd -> fd: (  26) rechdr 4 1562596174 1 2 27\n
  sd -> fd: (  27) # nothing needed for Linux \n
  sd -> fd: (  26) rechdr 4 1562596174 1 3 16\n
  sd -> fd: (  16) CC 9g=\n
  sd -> dir: ( 213) Jmsg Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 type=6 level=1562596730 bareos-sd JobId 22: \n
  sd -> dir: ( 120) Jmsg Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 type=6 level=1562596730 bareos-sd JobId 22: \n
  sd -> fd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: ( 177) Jmsg Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 type=6 level=1562596730 bareos-sd JobId 22: \n
  sd -> dir: ( 323) CatReq Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 UpdateMedia VolName=Full-0001 VolJobs=3 Vo\n
  fd -> dir: ( 128) 1 1 pinsug5 /home/franku/01-prj/git/bareos/regress/bin/tape_optionsP0D BIBFz IG0 B Po Po A b BAA I \n
  fd -> dir: (  34) 1 3 G0NDCR0AijmDiLdn0D336A *MD5-1*\n
  fd -> sd: (  21) read close session 5 \n
  dir -> sd: ( 355) 1000 OK VolName=Full-0001 VolJobs=3 VolFiles=0 VolBlocks=905 VolBytes=58311156 VolMounts=3 VolErrors\n
  sd -> fd: (  26) 3000 OK close Status = 82 \n
  sd -> fd: (  -1) BNET_EOD - End of data stream, new data may follow\n
  fd -> sd: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  fd -> dir: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: ( 107) 3099 Job verify_backup-bareos-fd.2019-07-08_16.38.48_20 end JobStatus=84 JobFiles=0 JobBytes=0 JobEr\n
  fd -> sd: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  fd -> dir: (  84) 2800 End Job TermCode=84 JobFiles=1 ReadBytes=0 JobBytes=0 Errors=0 VSS=0 Encrypt=0 \n
  sd -> dir: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  fd -> dir: ( 188) Jmsg Job=verify_backup-bareos-fd.2019-07-08_16.38.48_20 type=6 level=1562596730 localhost-fd JobId 2\n
  sd -> dir: (  -1) BNET_EOD - End of data stream, new data may follow\n
  sd -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n
  fd -> dir: (  -4) BNET_TERMINATE - Conversation terminated, doing close() \n

  @enduml