Backups
Backups can be made to a external location (recommended to tolerate disk failures)
or within an installed host.
External backups (i.e., to an external location) are made using the lxbackup
tool,
installed at the bin
directory, which works with a given configuration file.
Internal backups (i.e., to a directory on installed hosts) are made using the lx backup
command.
Using lxbackup
is exactly like using lx backup
with a few
differences:
-
Flag
-f
is mandatory and must be used to provide the installed configuration file. -
The default backup directory is not
$LXDIR/dump
, but./lxdump
.
By default, internal backups (lx backup
),
the backup is $LXDIR/dump
at the host used to issue
backup commands. The convention is to use the first host to keep
backups.
The lxbackup
command can be found at the installed $LXDIR/bin
directory on any installed host. If you are not sure regarding the
$LXDIR
value, use this command to find it:
unix$ lx -d pwd /usr/local/leanxcale unix$
Flag -d
for lx
makes it change to the $LXDIR
directory
before running the given command.
The detailed configuration file to be used with lxbackup
is created at lxinst.conf
when installing. The configuration can be retrieved also by the
lx config
command. For example:
unix$ lx config -o lxinst.conf saved lxinst.conf
On external backups, the backup directory is ./dump
unless otherwise specified
to the backup command.
This directory can be a mount point or a link to a remote directory to keep backups at a different machine.
Directories under dump/
are named using the date, with .1
,
.2
, etc. appended if more than one backup is created on the same
date. If the backup is incremental, a final +
is added to the
directory name.
For example, create a full, cold, backup on the installed system (e.g., atlantis
)
when leanXcale is not running:
unix$ lx backup backup... host atlantis... backup: /usr/local/leanxcale/dump/230720 unix$
The printed path is the path for the directory keeping the backup, as used when restoring it.
Or, to setup the external host orion
for backups, copy the backup
program and save and copy the installed configuration:
unix$ lx config -o lxinst.conf saved lxinst.conf unix$ lx -d pwd /usr/local/leanxcale unix$ scp /usr/local/leanxcale/bin/lxbackup lxinst.conf orion:~
And then, to create a full, cold, backup on orion
:
orion$ lxbackup -f lxinst.conf backup... host atlantis... backup: lxdump/230720 ... orion$
In the examples that follow, orion
is used as the external backup host.
An important note is that file modification times are preserved in backup files. They are used to learn if a file must be copied or not in an incremental backup. If a backup is relocated to a different place, and later copied back into the standard location, preserve file modification times in the process.
Using flag -z
makes the tool gzip
backup files, preserving
modification times despite compression.
Cold Incremental Backups
Flag -i
performs an incremental backup, made with respect to the last total backup
made on the same backup location.
This is done after the system is stopped. The system should not be running while doing a cold backup.
For example, from the external backup host in the running example:
orion$ lxbackup -i -f lxinst.conf backup... host atlantis... ... orion$
Or, from the installed system backup in our example:
unix$ lx backup -i backup... host atlantis... backup: dump/230720.3+ ... unix$
The system should not be running while doing a cold backup.
Hot Incremental Backups
To perform a hot backup, backup the redo logs as an incremental dump by specifying lxqe:
orion$ lxbackup -i -f lxinst.conf lxqe backup... host atlantis... backup: dump/230720.4+ ... orion$
Listing Backups
With flag -p
, both lxbackup
and lx backup
list the known backups:
unix$ lx backup -p backup... /usr/local/leanxcale/dump/230720 /usr/local/leanxcale/dump/230720.1+ ...
Those with a +
in their names are incremental backups.
Removing Old Backups
To remove a backup, it suffices to remove its directory. For example:
unix$ lx -d rm -rf dump/230720.2
Here we used the flag “-d” for lx
to change to $LXDIR
before
executing the remove command, which makes it easy to name the directory
used for the dump.
Or, from our external backup example host:
orion$ rm -rf dump/230720.2
Beware that if you remove a backup, you should remove those incremental backups that follow up to the next total backup.
Restore
To restore a backup, use the -r
flag for lxbackup
or lx backup
and name
the backup directory to restore.
For example, this restores the given full backup path:
orion$ lxbackup -f lxinst.conf -r lxdump/230720 ...
Do this while the system is stopped.
To restore an incremental backup (and therefore, all previous incremental backups and the total backup made before them), supply an incremental backup path.
This restores the previous total backup made and the incremental backups that follow up to the given one.