{"id":903,"date":"2020-05-25T11:52:43","date_gmt":"2020-05-25T11:52:43","guid":{"rendered":"http:\/\/shijuvarghese.com\/?p=903"},"modified":"2020-05-25T13:23:35","modified_gmt":"2020-05-25T13:23:35","slug":"bacula-testing-bacula-backup-job","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=903","title":{"rendered":"Bacula : Testing Bacula Backup Job"},"content":{"rendered":"<p>This is a continuation of the post &#8220;Bacula Backup Systems (Server)&#8221; which can be accessed by clicking <a href=\"http:\/\/shijuvarghese.com\/?p=396\">here<\/a>.<\/p>\n<p>In this employment the server, database and storage is hosted in one single server.<\/p>\n<p>To test the backup, let us create a file named &#8220;<strong>hello.txt<\/strong>&#8221; in the &#8220;<strong>\/data<\/strong>&#8221; folder in the server. This is the folder that is mentioned in the &#8220;bacula-dir.conf&#8221; file in the server as per the example used while configuring the server. The post can be accessed <a href=\"http:\/\/shijuvarghese.com\/?p=396\">here<\/a>.<\/p>\n<p>The command to access the Bacula administration console via the server&#8217;s console is:<br \/>\n<strong>]# bconsole<\/strong><br \/>\n<em>Connecting to Director localhost:9101<\/em><br \/>\n<em>1000 OK: bacula-dir Version: 5.2.13 (19 February 2013)<\/em><br \/>\n<em>Enter a period to cancel a command.<\/em><\/p>\n<p>When you get the &#8220;<strong>*<\/strong>&#8221; prompt start using the platform by using the &#8220;label&#8221; command.<br \/>\nWhen prompted to enter a volume name, let us provide one of our choice such as &#8220;MyVolume&#8221;<br \/>\nYou will be prompted to choose one of the defined pool, where we need to select option &#8220;2&#8221; for &#8220;File&#8221;<br \/>\nThis will complete creating the new label.<\/p>\n<p>== == == == == == == == ==<br \/>\n<strong>]# bconsole<\/strong><br \/>\n<em>Connecting to Director localhost:9101<\/em><br \/>\n<em>1000 OK: bacula-dir Version: 5.2.13 (19 February 2013)<\/em><br \/>\n<em>Enter a period to cancel a command.<\/em><br \/>\n<em>*<strong>label<\/strong><\/em><br \/>\n<em>Automatically selected Catalog: MyCatalog<\/em><br \/>\n<em>Using Catalog &#8220;MyCatalog&#8221;<\/em><br \/>\n<em>Automatically selected Storage: File<\/em><br \/>\n<em>Enter new Volume name: <strong>MyVolume<\/strong><\/em><br \/>\n<em>Defined Pools:<\/em><\/p>\n<p style=\"padding-left: 30px;\"><em>1: Default<\/em><br \/>\n<em> 2: File<\/em><br \/>\n<em> 3: Scratch<\/em><\/p>\n<p><em>Select the Pool (1-3): <strong>2<\/strong><\/em><br \/>\n<em>Connecting to Storage daemon File at gw12-lap-bacula.gw.local:9103 &#8230;<\/em><br \/>\n<em>Sending label command for Volume &#8220;MyVolume&#8221; Slot 0 &#8230;<\/em><br \/>\n<em>3000 OK label. VolBytes=208 DVD=0 Volume=&#8221;MyVolume&#8221; Device=&#8221;FileStorage&#8221; (\/bacula\/backup)<\/em><br \/>\n<em>Catalog record for Volume &#8220;MyVolume&#8221;, Slot 0 successfully created.<\/em><br \/>\n<em>Requesting to mount FileStorage &#8230;<\/em><br \/>\n<em>3906 File device &#8220;&#8221;FileStorage&#8221; (\/bacula\/backup)&#8221; is always mounted.<\/em><br \/>\n<em>You have messages.<\/em><\/p>\n<p>== == == == == == == == ==<\/p>\n<p>The next step is to\u00a0<strong>run<\/strong> the backup using a predefined\u00a0<strong>job\u00a0<\/strong>in the configuration file.<\/p>\n<p>== * == * == * == * == * == *\u00a0== * == * ==<\/p>\n<p><em>*<strong>run<\/strong><\/em><br \/>\n<em> A job name must be specified.<\/em><br \/>\n<em> The defined Job resources are:<\/em><\/p>\n<p style=\"padding-left: 30px;\"><em>1: BackupLocalFiles<\/em><br \/>\n<em> 2: BackupCatalog<\/em><br \/>\n<em> 3: RestoreLocalFiles<\/em><\/p>\n<p><em>Select Job resource (1-3):<strong> 1<\/strong><\/em><br \/>\n<em> Run Backup job<\/em><br \/>\n<em> JobName: BackupLocalFiles<\/em><br \/>\n<em> Level: Incremental<\/em><br \/>\n<em> Client: bacula-fd<\/em><br \/>\n<em> FileSet: Full Set<\/em><br \/>\n<em> Pool: File (From Job resource)<\/em><br \/>\n<em> Storage: File (From Job resource)<\/em><br \/>\n<em> When: 2020-05-26 01:33:43<\/em><br \/>\n<em> Priority: 10<\/em><br \/>\n<em> OK to run? (yes\/mod\/no): yes<\/em><br \/>\n<em> Job queued. JobId=3<\/em><\/p>\n<p>== * == * == * == * == * == *\u00a0== * == * ==<\/p>\n<p>&nbsp;<\/p>\n<p>One the server runs the job, Bacula will tell you that\u00a0there are messages, which are output generated by running jobs.<\/p>\n<ul>\n<li>As this is the first backup, you will see lines in the message that reads:<\/li>\n<li>No prior or suitable Full backup found in catalog. Doing FULL backup.<\/li>\n<li>Created new Volume &#8220;myLocalhost-0001&#8221; in catalog.<\/li>\n<li>Scheduled time: 25-May-2020 23:05:00<\/li>\n<li>Start time: 25-May-2020 23:05:03<\/li>\n<li>End time: 25-May-2020 23:05:06<\/li>\n<li>SD Errors: 0<\/li>\n<li>Termination: Backup OK<\/li>\n<\/ul>\n<p>We can also check the status of jobs managed by the server by issuing the\u00a0<strong>status director<\/strong> command in the\u00a0<strong>&#8220;*&#8221;<\/strong> prompt.<\/p>\n<p>Verify the &#8220;<strong>status<\/strong>&#8221; columns when you run the above command.<\/p>\n<p>We can exit the Bacula console by typing the &#8220;<strong>exit<\/strong>&#8221; command at the\u00a0<strong>&#8220;*&#8221;<\/strong> prompt.<\/p>\n<p style=\"text-align: center;\"><span style=\"text-decoration: underline;\"><strong>Restore the files backed-up<\/strong><\/span><\/p>\n<p><strong>]# bconsole<\/strong><br \/>\n<em>Connecting to Director localhost:9101<\/em><br \/>\n<em>1000 OK: bacula-dir Version: 5.2.13 (19 February 2013)<\/em><br \/>\n<em>Enter a period to cancel a command.<\/em><br \/>\n<em>*<strong>restore all<\/strong><\/em><br \/>\n<em>Automatically selected Catalog: MyCatalog<\/em><br \/>\n<em>Using Catalog &#8220;MyCatalog&#8221;<\/em><\/p>\n<p><em>First you select one or more JobIds that contain files<\/em><br \/>\n<em>to be restored. You will be presented several methods<\/em><br \/>\n<em>of specifying the JobIds. Then you will be allowed to<\/em><br \/>\n<em>select which files from those JobIds are to be restored.<\/em><\/p>\n<p><em>To select the JobIds, you have the following choices:<\/em><\/p>\n<p style=\"padding-left: 30px;\"><em>1: List last 20 Jobs run<\/em><br \/>\n<em> 2: List Jobs where a given File is saved<\/em><br \/>\n<em> 3: Enter list of comma separated JobIds to select<\/em><br \/>\n<em> 4: Enter SQL list command<\/em><br \/>\n<em> 5: Select the most recent backup for a client<\/em><br \/>\n<em> 6: Select backup for a client before a specified time<\/em><br \/>\n<em> 7: Enter a list of files to restore<\/em><br \/>\n<em> 8: Enter a list of files to restore before a specified time<\/em><br \/>\n<em> 9: Find the JobIds of the most recent backup for a client<\/em><br \/>\n<em> 10: Find the JobIds for a backup for a client before a specified time<\/em><br \/>\n<em> 11: Enter a list of directories to restore for found JobIds<\/em><br \/>\n<em> 12: Select full restore to a specified Job date<\/em><br \/>\n<em> 13: Cancel<\/em><\/p>\n<p><em><strong>Select item: (1-13): 5<\/strong><\/em><br \/>\n<em>Automatically selected Client: bacula-fd<\/em><br \/>\n<em>The defined FileSet resources are:<\/em><br \/>\n<em> 1: Catalog<\/em><br \/>\n<em> 2: Full Set<\/em><br \/>\n<em><strong>Select FileSet resource (1-2): 2<\/strong><\/em><br \/>\n<em>+&#8212;&#8212;-+&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<\/em><br \/>\n<em>| JobId | Level | JobFiles | JobBytes | StartTime | VolumeName |<\/em><br \/>\n<em>+&#8212;&#8212;-+&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<\/em><br \/>\n<em>| 1 | F | 463 | 18,882,661 | 2020-05-25 23:05:03 | myLocalhost-0001 |<\/em><br \/>\n<em>| 3 | I | 2 | 0 | 2020-05-26 01:33:54 | myLocalhost-0001 |<\/em><br \/>\n<em>+&#8212;&#8212;-+&#8212;&#8212;-+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<\/em><br \/>\n<em>You have selected the following JobIds: 1,3<\/em><\/p>\n<p><em>Building directory tree for JobId(s) 1,3 &#8230; ++++++++++++++++++++++++++++++++++++++++++++++<\/em><br \/>\n<em>462 files inserted into the tree and marked for extraction.<\/em><\/p>\n<p><em>You are now entering file selection mode where you add (mark) and<\/em><br \/>\n<em>remove (unmark) files to be restored. No files are initially added, unless<\/em><br \/>\n<em>you used the &#8220;all&#8221; keyword on the command line.<\/em><br \/>\n<em>Enter &#8220;done&#8221; to leave this mode.<\/em><\/p>\n<p><em>cwd is: \/<\/em><br \/>\n<em><strong>$ done<\/strong><\/em><br \/>\n<em>Bootstrap records written to \/var\/spool\/bacula\/bacula-dir.restore.1.bsr<\/em><\/p>\n<p><em>The job will require the following<\/em><br \/>\n<em> Volume(s) Storage(s) SD Device(s)<\/em><br \/>\n<em>===<\/em><\/p>\n<p><em>myLocalhost-0001 File FileStorage<\/em><\/p>\n<p><em>Volumes marked with &#8220;*&#8221; are online.<\/em><br \/>\n<em>464 files selected to be restored.<\/em><\/p>\n<p><em>Run Restore job<\/em><br \/>\n<em>JobName: RestoreLocalFiles<\/em><br \/>\n<em>Bootstrap: \/var\/spool\/bacula\/bacula-dir.restore.1.bsr<\/em><br \/>\n<em>Where: \/bacula\/restore<\/em><br \/>\n<em>Replace: always<\/em><br \/>\n<em>FileSet: Full Set<\/em><br \/>\n<em>Backup Client: bacula-fd<\/em><br \/>\n<em>Restore Client: bacula-fd<\/em><br \/>\n<em>Storage: File<\/em><br \/>\n<em>When: 2020-05-26 02:37:40<\/em><br \/>\n<em>Catalog: MyCatalog<\/em><br \/>\n<em>Priority: 10<\/em><br \/>\n<em>Plugin Options: *None*<\/em><br \/>\n<em>OK to run? (yes\/mod\/no): yes<\/em><br \/>\n<em>Job queued. JobId=4<\/em><br \/>\n<em>*<\/em><\/p>\n<p>Now let is see if the copy of the file is stored in the location configured for Bacula restore:<\/p>\n<p><strong>]# ls -l \/bacula\/restore\/data\/<\/strong><br \/>\n<em>-rw-r&#8211;r&#8211; 1 root root 0 May 26 01:21 hello.txt<\/em><\/p>\n<p style=\"text-align: center;\">** End **<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>This is a continuation of the post &#8220;Bacula Backup Systems (Server)&#8221; which can be accessed by clicking here. In this employment the server, database and <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=903\" title=\"Bacula : Testing Bacula Backup Job\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":408,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,3],"tags":[],"class_list":["post-903","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-backup","category-linux"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=903"}],"version-history":[{"count":10,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/903\/revisions"}],"predecessor-version":[{"id":915,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/903\/revisions\/915"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/408"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=903"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}