1%% 2%% 3 4\chapter{Data Spooling} 5\label{SpoolingChapter} 6\index[general]{Data Spooling } 7\index[general]{Spooling!Data } 8 9Bacula allows you to specify that you want the Storage daemon to initially 10write your data to disk and then subsequently to tape. This serves several 11important purposes. 12 13\begin{itemize} 14\item It takes a long time for data to come in from the File daemon during 15 an Incremental backup. If it is directly written to tape, the tape will 16 start and stop or shoe-shine as it is often called causing tape wear. 17 By first writing the data to disk, then writing it to tape, the tape can 18 be kept in continual motion. 19\item While the spooled data is being written to the tape, the despooling 20 process has exclusive use of the tape. This means that you can spool 21 multiple simultaneous jobs to disk, then have them very efficiently 22 despooled one at a time without having the data blocks from several jobs 23 intermingled, thus substantially improving the time needed to restore 24 files. While despooling, all jobs spooling continue running. 25\item Writing to a tape can be slow. By first spooling your data to disk, 26 you can often reduce the time the File daemon is running on a system, 27 thus reducing downtime, and/or interference with users. Of course, if 28 your spool device is not large enough to hold all the data from your 29 File daemon, you may actually slow down the overall backup. 30\end{itemize} 31 32Data spooling is exactly that "spooling". It is not a way to first write a 33"backup" to a disk file and then to a tape. When the backup has only been 34spooled to disk, it is not complete yet and cannot be restored until it is 35written to tape. 36 37Bacula version 1.39.x and later supports writing a backup 38to disk then later {\bf Migrating} or moving it to a tape (or any 39other medium). For 40details on this, please see the \ilink{Migration}{MigrationChapter} chapter 41of this manual for more details. 42 43The remainder of this chapter explains the various directives that you can use 44in the spooling process. 45 46\label{directives} 47\section{Data Spooling Directives} 48\index[general]{Directives!Data Spooling } 49\index[general]{Data Spooling Directives } 50 51The following directives can be used to control data spooling. 52 53\begin{itemize} 54\item To turn data spooling on/off at the Job level in the Job resource in 55 the Director's conf file (default {\bf no}). 56 57{\bf SpoolData = yes\vb{}no} 58 59\item To override the Job specification in a Schedule Run directive in the 60 Director's conf file. 61 62{\bf SpoolData = yes\vb{}no} 63 64\item To override the Job specification in a bconsole session using the \texttt{run} 65 command. Please note that this does {\bf not } refer to a configuration 66 statement, but to an argument for the run command. 67 68{\bf SpoolData=yes\vb{}no} 69 70\item To limit the the maximum spool file size for a particular job in the Job 71 resource 72 73{\bf Spool Size = size} 74 Where size is a the maximum spool size for this job specified in bytes. 75 76\item To limit the maximum total size of the spooled data for a particular 77 device. Specified in the Device resource of the Storage daemon's conf file 78 (default unlimited). 79 80{\bf Maximum Spool Size = size} 81 Where size is a the maximum spool size for all jobs specified in bytes. 82 83\item To limit the maximum total size of the spooled data for a particular 84 device for a single job. Specified in the Device Resource of the Storage 85 daemon's conf file (default unlimited). 86 87{\bf Maximum Job Spool Size = size} 88 Where size is the maximum spool file size for a single job specified in 89 bytes. 90 91\item To specify the spool directory for a particular device. Specified in 92 the Device Resource of the Storage daemon's conf file (default, the working 93 directory). 94 95{\bf Spool Directory = directory} 96\end{itemize} 97 98\label{warning} 99 100% TODO: fix this section name 101\section{!!! MAJOR WARNING !!!} 102\index[general]{WARNING! MAJOR } 103\index[general]{ MAJOR WARNING } 104 105Please be very careful to exclude the spool directory from any backup, 106otherwise, your job will write enormous amounts of data to the Volume, and 107most probably terminate in error. This is because in attempting to backup the 108spool file, the backup data will be written a second time to the spool file, 109and so on ad infinitum. 110 111Another advice is to always specify the maximum spool size so that your disk 112doesn't completely fill up. In principle, data spooling will properly detect a 113full disk, and despool data allowing the job to continue. However, attribute 114spooling is not so kind to the user. If the disk on which attributes are being 115spooled fills, the job will be canceled. In addition, if your working 116directory is on the same partition as the spool directory, then Bacula jobs 117will fail possibly in bizarre ways when the spool fills. 118 119\label{points} 120\section{Other Points} 121\index[general]{Points!Other } 122\index[general]{Other Points } 123 124\begin{itemize} 125\item When data spooling is enabled, Bacula automatically turns on attribute 126 spooling. In other words, it also spools the catalog entries to disk. This is 127 done so that in case the job fails, there will be no catalog entries 128 pointing to non-existent tape backups. 129\item Attribute despooling occurs near the end of a job. The Storage daemon 130 accumulates file attributes during the backup and sends them to the 131 Director at the end of the job. The Director then inserts the file 132 attributes into the catalog. During this insertion, the tape drive may 133 be inactive. When the file attribute insertion is completed, the job 134 terminates. 135\item Attribute spool files are always placed in the working directory of 136 the Storage daemon. 137\item When Bacula begins despooling data spooled to disk, it takes exclusive 138 use of the tape. This has the major advantage that in running multiple 139 simultaneous jobs at the same time, the blocks of several jobs will not be 140 intermingled. 141\item It probably does not make a lot of sense to enable data spooling if you 142 are writing to disk files. 143\item It is probably best to provide as large a spool file as possible to 144 avoid repeatedly spooling/despooling. Also, while a job is despooling to 145 tape, the File daemon must wait (i.e. spooling stops for the job while it is 146 despooling). 147\item If you are running multiple simultaneous jobs, Bacula will continue 148 spooling other jobs while one is despooling to tape, provided there is 149 sufficient spool file space. 150\end{itemize} 151