====== Bacula ====== TODO: UPDATE THIS The CS Deptartment uses Bacula to manage backups. Bacula is a server-client system where the server initiates backups on a regular basis. The client (called file-daemon) is mostly a 'dumb' client, which brings up a number of challenges and quirks, explained below. The backup server is located at backup.cs.ndsu.nodak.edu, but all user interaction with the backup server should take place via the Bacula client or by request to the system administrator. ===== Server ===== The backup server has the following specs: ^^^ |CPU|Quad-core Xeon|2.33Ghz| |RAM|DDR2|8GB| |HD|640GB, 1TB| 3x 640GB, 10x 1TB| ==== Hard Drive Configuration ==== **outdate** There are 13 hard drives in the backup server, three 640GB drives for the operating system and other miscellaneous storage, and ten 1TB drives for main backup storage. The 10 drives are split into two [RAID 6|http://en.wikipedia.org/wiki/RAID#Standard_levels] arrays, to minimize array failures. This server also hosts the hard drives for the [[admin:general:nygard_archive|archival array]]. This is from Dr. Nygard, but extra space has been used to store images from older hard drives. No one has ever requested an image, but having the images enables some of the faculty to be able to get rid of their old computers. ====== Client ====== The client runs on Linux, Windows, and Mac. The Linux client is the most robust, but the Windows client works well also. If Bacula is installed by a CS admin/tech, then it should be configured to run backups automatically and no intervention should be required. By default, Bacula will be configured to run a backup every night at 2 AM. If you turn your computer off at night we can arrange for the backup to be scheduled at a different time. On a Windows client, by default, only your C: drive will be backed up. If you want other drives backed up, you will need to contact [[Adam|Adam.Helsene@ndsu.edu]]. Certain system files and folders will be excluded, this includes any 'Program Files' folders. If you'd like to change this, you can contact [[Adam|Adam.Helsene@ndsu.edu]] and he can modify these settings on the server. In Windows, if you'd like to exclude a directory, place an empty file named 'bexclude' inside and that directory (and all subdirectories) will be ignored. ===== Linux ===== ==== Ubuntu ==== The Ubuntu repositories lag behind as far as Bacula is concerned. The current Ubuntu version is 2.4x, while we are using Bacula version 3.x. The 2.4x client is not recommended for use with our server as it is not likely to work with a 3.x server. Compiling the client from source is not too difficult, contact [Adam|Adam.Helsene@ndsu.edu] if you'd like assistance with this. ==== Red Hat-based ==== There are RPMs for Red Hat-style distros, and Bacula 3.x may even be available from your favorite repositories ===== Windows ===== Windows has two clients, a 32-bit version and 64-bit version. Both versions are fairly well tested and work very well with the installation scripts made by [[http://cs.ndsu.edu/~helsene/backup/backup.php|the bacula configuration generator]]. See the [[admin:processes:backup:start|backup processes page]] for Windows installation information and procedures. ==== Win XP ==== Windows XP, 32-bit has been well tested and generally works nicely with the scripts created by the [[http://cs.ndsu.edu/~helsene/backup/backup.php|configuration generator]]. ==== Win XP 64-bit ==== Untested - not supported ==== Vista 32-bit ==== Works well, much like Win XP 32-bit. ==== Vista 64-bit ==== Untested, contact [[Adam.Helsene@ndsu.edu|Adam]] for setup assistance - not supported, should be similar to Win7 ==== Win 7 32-bit ==== Untested, contact [[adam.helsene@ndsu.edu|Adam]] for setup assistance - not supported ==== Win 7 64-bit ==== Windows 7 has had a number of directory structure and security improvement. While is is very much welcome, it complicates the Bacula client installation significantly. Because of this, the installation for Bacula on Windows 7 has configuration files and working directories in c:\programdata\bacula instead of c:\program files\bacula\. The installation generator should produce appropriate install scripts and configs. ===== Mac ===== Bacula 5.0.1 has been compiled and installed on a mac, unfortunately there is a compilation error in findlib. This is a 64-bit conversion error of some form and so a 32-bit compile is required. This is unfortunate but should work just fine. The following was used to compile this for 32-bit systems, it is known to work for 10.6(?) CFLAGS="-arch i386 -g -O0" CXXFLAGS="$CFLAGS" LDFLAGS="-arch i386" ./configure --enable-client-only make sudo make install ====== Using the Console ====== Along with the Bacula client, you will get the bconsole program (as well as bwx-console for 32-bit windows). The console program allows you to queue a backup job or run a restore. Below is a list of some of the commands/functions that you may want to use. ===== Running a Backup ===== To run a backup using your Bacula client, first execute Linux: bconsole --or-- Windows: c:\program files\bacula\bconsole.exe -or- c:\program files\bacula\bin\bconsole.exe depending on your client version. Once bconsole has connected back to the server, you need to execute: setip This tells the server to set your client's IP address to your current IP. This is necessary on all non-servers as we are given dynamic IPs on our campus network. You can then run your backup using the 'run' command, you will then get a prompt similar to one below. *run A job name must be specified. The defined Job resources are: 1: 123456-lastname 2: 123457-lastname_lab Select Job resource (1-2): Here you select the client you would like to back up. Most commonly, you will have access to a single Job, and it will be automatically selected. You will then see the details of the job, most of these will not be of much importance to you, and are server-side configuration settings. Run Backup job JobName: 123456-lastname Level: Incremental Client: 123456-lastname FileSet: StandardWindows Pool: WorkstationIncr (From Job resource) Storage: WorkstationIncr (From Pool resource) When: 2009-12-07 15:29:08 Priority: 10 OK to run? (yes/mod/no): If all is well, type 'yes', hit enter and your backup will be put in the queue. ===== Running a Restore ===== ==== Start bconsole ==== To run a backup using your Bacula client, first execute Linux: bconsole --or-- Windows: c:\program files\bacula\bconsole.exe -or- c:\program files\bacula\bin\bconsole.exe depending on your client version. ==== Telling the Server Your IP ==== Once bconsole has connected back to the server, you need to issue the setip command: setip This tells the server to set your client's IP address to your current IP. This is necessary on all non-servers as we are given dynamic IPs on our campus network. ==== Choosing Which Jobs to Restore ==== You can then run your restore by using the restore command, you will then be given a very large number of options so that you can choose from. *restore First you select one or more JobIds that contain files to be restored. You will be presented several methods of specifying the JobIds. Then you will be allowed to select which files from those JobIds are to be restored. To select the JobIds, you have the following choices: 1: List last 20 Jobs run 2: List Jobs where a given File is saved 3: Enter list of comma separated JobIds to select 4: Enter SQL list command 5: Select the most recent backup for a client 6: Select backup for a client before a specified time 7: Enter a list of files to restore 8: Enter a list of files to restore before a specified time 9: Find the JobIds of the most recent backup for a client 10: Find the JobIds for a backup for a client before a specified time 11: Enter a list of directories to restore for found JobIds 12: Select full restore to a specified JobId 13: Cancel Select item: (1-13): === Selecting the Most Recent Backup === Selecting option '5' here will give you the most recent files for a given client. If you have access to multiple clients, you will be prompted to choose one of them, otherwise the current client will be chosen. This is the computer that originally had the files. (You can choose an optional destination client later, allowing you to move files from one computer to another). Select item: (1-13): 5 Defined Clients: 1: 123456-lastname 2: 123457-lastname_lab Select the Client (1-2): === Selecting an Older Version of a File === If you would like a specific version of a file, you can specify a point in time and Bacula will apply the incremental backups to reconstruct your files as of that time. Select option #6 and you will be given a prompt for a time: Select item: (1-13): 6 The restored files will the most current backup BEFORE the date you specify below. Enter date as YYYY-MM-DD HH:MM:SS : === After Choosing Jobs === After selecting the jobs you would like restored, the system then builds the most recent version of your file set. This will look something like: Select the Client (1-2): 1 Automatically selected FileSet: 123456-lastnameFileSet +-------+-------+----------+---------------+---------------------+------------+ | JobId | Level | JobFiles | JobBytes | StartTime | VolumeName | +-------+-------+----------+---------------+---------------------+------------+ | 2,307 | F | 58,968 | 2,686,111,462 | 2009-12-05 02:37:18 | Full-0278 | | 2,356 | I | 58 | 164,984,258 | 2009-12-06 02:01:02 | Incr-0277 | | 2,381 | I | 10 | 4,494,735 | 2009-12-07 02:01:01 | Incr-0277 | | 2,410 | I | 15 | 4,690,608 | 2009-12-08 02:01:02 | Incr-0277 | +-------+-------+----------+---------------+---------------------+------------+ You have selected the following JobIds: 2307,2356,2381,2410 Building directory tree for JobId(s) 2307,2356,2381,2410 ... ++++++++++++++++++++++++++++++++++++++++++++++ 54,326 files inserted into the tree. This display is informational, to show which jobs are included in the restore. ==== Choosing Files to be Restored ==== You will then be given the following prompt, which will allow you to choose which files to restore: You are now entering file selection mode where you add (mark) and remove (unmark) files to be restored. No files are initially added, unless you used the "all" keyword on the command line. Enter "done" to leave this mode. cwd is: / $ From this prompt, you can use common filesystem navigation commands, such as 'ls' or 'dir'. ** Caution: In Windows, you need to use forward slashes instead of backslashes as the directory delimiter! This is because Bacula stores everything using UNIX-style paths ** To select/deselect directories and files for restoration, use the 'mark' and 'unmark' commands. The list of commands usable in file selection mode are listed below ^Command^Description^ |add|add dir/file to be restored recursively, wildcards allowed| |cd|change current directory| |count|count marked files in and below the cd| |delete|delete dir/file to be restored recursively in dir| |dir|long list current directory, wildcards allowed| |done|leave file selection mode| |estimate|estimate restore size| |exit|same as done command| |find|find files, wildcards allowed| |help|print help| |ls|list current directory, wildcards allowed| |lsmark|list the marked files in and below the cd| |mark|mark dir/file to be restored recursively, wildcards allowed| |markdir|mark directory name to be restored (no files)| |pwd|print current working directory| |unmark|unmark dir/file to be restored recursively in dir| |unmarkdir|unmark directory name only no recursion| |quit|quit and do not do restore| |?|print help| After marking files/directories that you'd wish to restore, use the 'done' command. ==== Final Restore Options ==== You will then be shown a summary of your restore job. **You will still need to change one or more options before your restore is ready!** Run Restore job JobName: RestoreFiles Bootstrap: /var/lib/bacula3/csbackup.restore.15.bsr Where: /tmp/bacula-restores Replace: ifnewer FileSet: 123456-lastnameFileSet Backup Client: 123456-lastname Restore Client: 123456-lastname Storage: WorkstationFull When: 2009-12-08 11:08:30 Catalog: MyCatalog Priority: 10 Plugin Options: *None* OK to run? (yes/mod/no): You will need to answer 'mod' to modify one or more options. answering with 'mod' will bring you the following list: OK to run? (yes/mod/no): mod Parameters to modify: 1: Level 2: Storage 3: Job 4: FileSet 5: Restore Client 6: When 7: Priority 8: Bootstrap 9: Where 10: File Relocation 11: Replace 12: JobId 13: Plugin Options Select parameter to modify (1-13): === (OPTIONAL) #5: 'Restore Client': Restoring Files to a Different Computer === If you are working with multiple clients, such as restoring to a computer different from the one the files were originally backed up from, then you will also want to change option #5, 'Restore Client'. You'll be prompted with a list of clients, select the one you would like to restore files to. === #9: 'Where': Change Restore Target on Local Filesystem === By default, the system will try to restore your files to '/tmp/bacula-restores/', of course this is not suitable for Windows systems, so you will need to change option #9, 'Where'. This defines the location on your local filesystem where you would like your files to be written to. Remember to use forward slashes in Windows. When Bacula tries to restore a file that already exists, by default, it will keep the newer version (determined by timestamp). Because of this, it is possible to set the 'Where' variable to the root of a drive, so Bacula will restore to where the file originally existed. Please use caution when restoring files using the root as the destination of your files === (OPTIONAL) #11: 'Replace': Modify Default Overwrite Behavior === When restoring a file onto an already existing file, the default behavior is for Bacula to compare timestamps and keep the newest version. If you'd like to change this behavior, this is the place to do so. You will be presented with 4 options: Select parameter to modify (1-13): 11 Replace: 1: always 2: ifnewer 3: ifolder 4: never Select replace option (1-4): ^Option^Behavior^ |always|Always replace the existing file with the version from the backup system| |ifnewer (default)|Replace the existing file if the one from the backup system is newer than the existing file| |ifolder|Replace the existing file if the one from the backup system is older than the existing file| |never|Never replace existing files| === Other Options === Changing other options will almost certainly cause your restore job to fail. They're mostly useful for administrative use and special cases. ==== The Short Version === Run the following commands in bconsole: setip restore 5 then choose backup client if prompted mark files to be restored, see [[above|http://wiki.cs.ndsu.nodak.edu/admin/software/bacula#choosing_which_jobs_to_restore]] for more detail on marking files mod 9 enter local directory to restore files to. If you would like to restore to a different computer: mod 5 then choose destination client Finally, confirm your restore options and enter yes