Working with BACKUP & RESTORE
Contents of Article
When are Retention Criteria Evaluated?
SPFLite provides a simple to use file Backup and Restore facility. This enables you to easily create multiple date and time stamped backups for your files, on demand, and to restore them simply if and when needed. All without leaving the SPFLite session to run other tools.
In order to provide a consistent location, and to prevent 'cluttering up' your normal file storage folders, backup files are stored in a sub-folder of the normal file's location. SPFLite will create a new folder $BACKUP in the file's normal data folder, and store all backups there.
Note: This means there is not one single $BACKUP folder for your system, it is one $BACKUP folder for each data folder you use for files edited by SPFLite. This simplifies Restore as the destination for the Restore is always the folder above the one which contains the actual Backup file.
Backup files are 100% unmodified clones of the original file. Their only difference is the filename which has had a Date / Time-stamp portion appended . In addition, the file type extension is also repeated at the end. This means the file is perfectly usable, if needed, by it's normal application without any additional processing.
e.g. For a file name of TESTDATA.TXT
The Backup file would be: TESTDATA.TXT.190503-1321.190504.TXT
where the time-tamp (190503-1321) is the Last Update date and time of the original file
and the next portion (190504) is the date the backup itself was created.
When the file being backed up has been edited by SPFLite and has an associated STATE file, the STATE file will also be backed up and will take the same name as the original file's backup with .STATE appended. Using the example above it would be called:
Note: Since the time-stamp in the backup file name only includes an hhmm (Hour and minute) format for the time, you will not be able to perform multiple backups within the same minute. We're sure this will not prove restrictive in normal use.
SPFLite provides you with the ability to request NO management support for your Backup files (i.e. you will perform this yourself outside of SPFLite) or to request SPFLite assist in managing your Backups under Retention criteria which you specify.
Regardless of what method you choose, SPFLite will always, when a BACKUP request is performed, inform you of how many current Backups there are for the file just processed.
SPFLite allows you to specify Retention Control Criteria via the OPTIONS => General setting tab. This entry requires the entry of the three required fields. The RETPD (Retention Period), The Minimum Generations (MinGen) and the Maximum Generations (MaxGen). There three fields are all inter-related to control how long Backups are retained.
SPFLite supports the following types of retention.
Full User Control
This is indicated by setting all three values to Zero
(RETPD = 0, MinGens= 0, MaxGens=0)
When this is specified, SPFLite will never delete any Backups created, responsibility for Backup file cleanup lies with the user, using any means they desire.
Retention Period Only
This is indicated by entering in the RETPD the number of days you wish to retain the Backups and leaving the MinGens and MaxGens values as Zero.
(RETPD = nnn, MinGens=0, MaxGens=0)
When this is specified, the nnn value indicates the number of days each Backup file is to be retained before it becomes 'obsolete' and is deleted.
This is indicated by entering Zero for RETPD and MinGens and specifying the number of Backup generations you wish to keep as the MaxGens value.
(RETPD = 0, MinGens=0, MaxGens=xxx)
When specified in this format, the xxx value indicates the number of generations of each Backup file that are to be retained. Older generations over this value are considered 'obsolete' and will be deleted.
Generation / Retention Hybrid Control
This is indicated by entering values for all three control values.
(RETPD = rrr, MinGens=mmm, MaxGens=xxx)
When specified in this format, the rrr value indicates the number of days each Backup file is to be retained before it becomes eligible for removal and deletion. The mmm indicates the minimum number of generations of each Backup file that are to be retained. The xxx indicates the maximum number of generations of each Backup file that are to be retained.
Wow! That's complicated! So how does this all work? It seems very confusing. It's really not too bad, here's the process of evaluating the backups for a single file:
- First, any Backups exceeding the maximum xxx value will be deleted, regardless of their expiry date.
- Second, all remaining backups over the minimum mmm value will be evaluated based on their Retention rrr value and will be deleted if over the number of days.
Thus, you will always have a minimum of mmm backups available, and a maximum of xxx backups available. The rrr value is basically used to keep the total number of backups as low as possible (between the mmm value and the xxx value).
When retention processing removes all files from a $BACKUP folder, the actual $BACKUP folder will itself be removed.
The criteria you specify for Backup Retention are evaluated at the following times:
At SPFLite Startup (Once per day)
SPFLite will, on its first startup of a day, perform evaluation of all known $BACKUP folders to determine if any Backup file are eligible for deletion. This evaluation will be done in the background and will not impact the operation of normal startup.
At a specific Backup request (Including AUTOBKUP requests)
Whenever an actual backup is performed, SPFLite will evaluate the single $BACKUP folder to which this backup is directed.
Note: When generation control is in effect, you may notice that 1 more generation might be retained than the Retention MaxGen value. This is normal as the evaluation is performed before the actual backup is performed. The additional generation will be removed at the next evaluation (probably the following day on startup). This condition is perfectly normal.
There are several ways to request a new Backup be created.
- In File Manager, enter BACKUP | BACK | BK as a line command next to the desired file.
- While in Edit / View / Browse of a file, enter BACKUP | BACK | BK on the command line.
- Turn AUTOBKUP ON for the profile used by the file. AUTOBKUP will trigger a Backup for a file:
- At most ONCE per Edit session. i.e. a Backup of how the file looked when Edit started.
- Only if a SAVE is performed (or the file is Saved during END processing)
- Only for the first SAVE issued. (Variation of the comment in the 1st bullet above)
For ALL cases, a backup will not be created if one already exists for the file and the Last Modified Date & Time stamps are the same.
If SPFLite detects the presence of an existing backup of the file, with the same Date/Time stamp, it will not create a new backup and will also verify the file size in addition to the date time.
If it rejects the backup and indicates the files are the same size, all is well. (Simply - no Backup is needed)
If it rejects the backup and indicates the files are of different sizes, This is a problem. It indicates that somehow either the file or the Backup of it were modified somehow outside normal activity. i.e. If the backup and real file have the same Last Modified date/Time, how can they not have the same file size? This should be investigated to determine the reason, or, the real file should be examined for validity and if OK, then it should be re-saved, and a new Backup created.
To request a Restore:
- Use File Manager to browse to the $BACKUP folder located in the same folder of the file that needs to be Restored.
- Enter either RESTORE | RS or RESTORET | RST next to the specific backup you wish to choose to be restored. (Details below)
Note: When you use File Manager to browse the $BACKUP folder, the folder may contain both normal Backup files as well as Backup files of the associated STATE data. This means some backups may appear as pairs of lines, which could be confusing. To alleviate this, SPFLite will automatically add a File Mask to the FM criteria so that these extra STATE entries do not appear. If you really want to see all the folder entries (say you are using totally manual Retention Control) then simply remove the filter request from the File Mask area and press Enter.
When you Browse the $BACKUP folder you will see the Backup files created using the following format for the file name.
The original filename
The yymmdd-hhmm time-stamp of the backed up file
NOTE: This is the last modified date/time of the original file,
NOT the date/time the Backup was created.
The date (yymmdd) the backup was created.
The file extension of the original file is used so that the Backup file could be opened directly by it associated application without any prior manipulation to make it acceptable.
Types of Restore
You may request two types of RESTORE, based on the Restore command used.
RESTORE | RS
If you choose RESTORE | RS the file will be restored to it's original location. If the file still exists at that location, you will be prompted for permission to replace the file.
RESTORET | RST
If you choose the RESTORE | RST option, then the file will be restored to it's original location, but with the Time-stamp shown above as part of the restored filename. This enables you to restore a backup copy without overlaying / destroying the original file. This enables you to compare the old / new files for comparison purposes. If this is done, any associated STATE files are also restored to make the restored file fully editable, including the STATE data.
The Backups created by SPFLite are full, 100% identical copies of the original file. No changes or additions are made. Thus, these files are, if needed, perfectly usable by their normal application program.
If the file being backed u is an SPFLite editable file, and there is existing STATE data for this file, the STATE file will be backed up as well into the $BACKUP folder.
If the file is selected for RESTORE, any associated STATE file will be restored as well to maintain the association between the files. For information on STATE handling see "Saving the Edit State"
Created with the Personal Edition of HelpNDoc: Generate Kindle eBooks with ease