chmod 755 src/cats/make_catalog_backup src/cats/delete_catalog_backup
 chmod 755 src/cats/grant_mysql_privileges
 chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables 
+chmod 755 src/cats/update_sqlite_tables
 chmod 755 src/cats/make_bacula_tables src/cats/drop_bacula_tables 
+chmod 755 src/cats/update_mysql_tables
 chmod 755 src/cats/update_bacula_tables src/cats/update_mysql_tables
-chmod 755 src/cats/update/mysql_tables
 chmod 755 src/cats/create_sqlite_database
 chmod 755 src/cats/sqlite
 chmod 755 src/cats/make_bdb_tables src/cats/drop_bdb_tables 
 
 chmod 755 src/cats/make_catalog_backup src/cats/delete_catalog_backup
 chmod 755 src/cats/grant_mysql_privileges
 chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables
+chmod 755 src/cats/update_sqlite_tables
 chmod 755 src/cats/make_bacula_tables src/cats/drop_bacula_tables
+chmod 755 src/cats/update_mysql_tables
 chmod 755 src/cats/update_bacula_tables src/cats/update_mysql_tables
-chmod 755 src/cats/update/mysql_tables
 chmod 755 src/cats/create_sqlite_database
 chmod 755 src/cats/sqlite
 chmod 755 src/cats/make_bdb_tables src/cats/drop_bdb_tables
 
 - Setup a standard job that builds a bootstrap file and saves
   it with the catalog database.
 - Document Dan's new --with-dir-user, ... options.
+- Document estimate command in tree.
+- Document lsmark command in tree.
                 
 For 1.33
-- Change "create_media_record in bscan to use Archive instead of Full.
 - Implement RestoreJobRetention? Maybe better "JobRetention" in a Job,
   which would take precidence over the Catalog "JobRetention".
 - Implement Label Format in Add and Label console commands.
 - Create VolAddr for disk files in place of VolFile and VolBlock. This
   is needed to properly specify ranges.
 - Print bsmtp output to job report so that problems will be seen.
-- Have some way to estimate the restore size or have it printed.
 - Pass the number of files to be restored to the FD for reporting 
 - Add progress of files/bytes to SD and FD.
 - Don't continue Restore if no files selected.
 - Add a date and time stamp at the beginning of every line in the 
   Job report (Volker Sauer).
 - Client does not show busy during Estimate command.
-- Volume problems occurs if you have valid volume, written, then it is
-  truncated. You get 12-Nov-2003 11:48 rufus-sd: kernsave.2003-11-12_11.48.09 Warning: mount.c:228 Volume on /tmp is not a Bacula labeled Volume, because:
-     block.c:640 Read zero bytes on device /tmp.
 - Implement Console mtx commands.
 - Look at 2Gb limit for SQLite.
 - Implement 3 Pools for a Job:
 - Make mark/unmark report how many files marked/unmarked.
 - Keep last 5 or 10 completed jobs and show them in a similar list.
 - Make a Running Jobs: output similar to current Scheduled Jobs:
+- Change "create_media_record in bscan to use Archive instead of Full.
+- Have some way to estimate the restore size or have it printed.
+- Volume problems occurs if you have valid volume, written, then it is
+  truncated. You get 12-Nov-2003 11:48 rufus-sd: kernsave.2003-11-12_11.48.09 Warning: mount.c:228 Volume on /tmp is not a Bacula labeled Volume, because:
+     block.c:640 Read zero bytes on device /tmp.
 
 
    MaxVolBytes BIGINT UNSIGNED NOT NULL,
    AutoPrune TINYINT DEFAULT 0,
    Recycle TINYINT DEFAULT 0,
-   PoolType ENUM('Backup', 'Copy', 'Cloned', 'Archive', 'Migration') NOT NULL,
+   PoolType ENUM('Backup', 'Copy', 'Cloned', 'Archive', 'Migration', 'Scratch') NOT NULL,
    LabelFormat TINYBLOB,
+   Enabled TINYINT DEFAULT 1,
+   ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+   RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
    UNIQUE (Name(128)),
    PRIMARY KEY (PoolId)
    );
 
    Recycle TINYINT DEFAULT 0,
    PoolType VARCHAR(20) NOT NULL,
    LabelFormat VARCHAR(128) NOT NULL,
+   Enabled TINYINT DEFAULT 1,
+   ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+   RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
    UNIQUE (Name),
    PRIMARY KEY (PoolId)
    );
 
 ALTER TABLE Media ADD COLUMN Drive INTEGER NOT NULL DEFAULT 0;
 ALTER TABLE Media ADD COLUMN InChanger TINYINT NOT NULL DEFAULT 0;
 
+ALTER TABLE Pool ADD COLUMN Enabled TINYINT DEFAULT 1;
+ALTER TABLE Pool ADD COLUMN ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;
+ALTER TABLE Pool ADD COLUMN RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool;
 
 DROP TABLE BaseFiles;
 
 
    VolMounts, VolBytes, VolErrors, VolWrites,
    VolCapacityBytes, VolStatus, Recycle,
    VolRetention, VolUseDuration, MaxVolJobs,
-   MaxVolFiles, MaxVolBytes
+   MaxVolFiles, MaxVolBytes, 0, 0
    FROM Media;
 
 
    VolMounts, VolBytes, VolErrors, VolWrites,
    VolCapacityBytes, VolStatus, Recycle,
    VolRetention, VolUseDuration, MaxVolJobs,
-   MaxVolFiles, MaxVolBytes)
+   MaxVolFiles, MaxVolBytes, Drive, InChanger)
    SELECT * FROM Media_backup;
 
 DROP TABLE Media_backup;
 
 CREATE INDEX inx8 ON Media (PoolId);
 
+CREATE TABLE Pool_backup (
+   PoolId INTEGER UNSIGNED AUTOINCREMENT,
+   Name VARCHAR(128) NOT NULL,
+   NumVols INTEGER UNSIGNED DEFAULT 0,
+   MaxVols INTEGER UNSIGNED DEFAULT 0,
+   UseOnce TINYINT DEFAULT 0,
+   UseCatalog TINYINT DEFAULT 1,
+   AcceptAnyVolume TINYINT DEFAULT 0,
+   VolRetention BIGINT UNSIGNED DEFAULT 0,
+   VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+   MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+   MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+   MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+   AutoPrune TINYINT DEFAULT 0,
+   Recycle TINYINT DEFAULT 0,
+   PoolType VARCHAR(20) NOT NULL,
+   LabelFormat VARCHAR(128) NOT NULL,
+   Enabled TINYINT DEFAULT 1,
+   ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+   RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+   UNIQUE (Name),
+   PRIMARY KEY (PoolId)
+   );
+
+INSERT INTO Pool_backup SELECT
+   PoolId,
+   Name,
+   NumVols,
+   MaxVols,
+   UseOnce,
+   UseCatalog,
+   AcceptAnyVolume,
+   VolRetention,
+   VolUseDuration,
+   MaxVolJobs,
+   MaxVolFiles,
+   MaxVolBytes,
+   AutoPrune,
+   Recycle,
+   PoolType,
+   LabelFormat, 1, 0, 0
+   FROM Pool;
+
+DROP TABLE Pool;
+
+CREATE TABLE Pool (
+   PoolId INTEGER UNSIGNED AUTOINCREMENT,
+   Name VARCHAR(128) NOT NULL,
+   NumVols INTEGER UNSIGNED DEFAULT 0,
+   MaxVols INTEGER UNSIGNED DEFAULT 0,
+   UseOnce TINYINT DEFAULT 0,
+   UseCatalog TINYINT DEFAULT 1,
+   AcceptAnyVolume TINYINT DEFAULT 0,
+   VolRetention BIGINT UNSIGNED DEFAULT 0,
+   VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+   MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+   MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+   MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+   AutoPrune TINYINT DEFAULT 0,
+   Recycle TINYINT DEFAULT 0,
+   PoolType VARCHAR(20) NOT NULL,
+   LabelFormat VARCHAR(128) NOT NULL,
+   Enabled TINYINT DEFAULT 1,
+   ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+   RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+   UNIQUE (Name),
+   PRIMARY KEY (PoolId)
+   );
+
+INSERT INTO Pool (
+   PoolId,
+   Name,
+   NumVols,
+   MaxVols,
+   UseOnce,
+   UseCatalog,
+   AcceptAnyVolume,
+   VolRetention,
+   VolUseDuration,
+   MaxVolJobs,
+   MaxVolFiles,
+   MaxVolBytes,
+   AutoPrune,
+   Recycle,
+   PoolType,
+   LabelFormat, Enabled, ScratchPoolId, RecyclePoolId)
+   SELECT * FROM Pool_backup;
+
+DROP TABLE Pool_backup;
+
+
 DROP TABLE BaseFiles;
 
 CREATE TABLE BaseFiles (
 
 #  AutomaticMount = yes;               # when device opened, read it
 #  AlwaysOpen = yes;
 #  RemovableMedia = yes;
+#  RandomAccess = no;
 #}
 
 #
 #  AutomaticMount = yes;               # when device opened, read it
 #  AlwaysOpen = Yes;
 #  RemovableMedia = yes;
+#  RandomAccess = no;
 #}
 
 # 
 
    struct date_time dt;
    struct tm tm;
 
-   bstrncpy(mr->VolStatus, "Full", sizeof(mr->VolStatus));
+   /* We mark Vols as Archive to keep them from being re-written */
+   bstrncpy(mr->VolStatus, "Archive", sizeof(mr->VolStatus));
    mr->VolRetention = 365 * 3600 * 24; /* 1 year */
    if (vl->VerNum >= 11) {
       mr->FirstWritten = btime_to_utime(vl->write_btime);