Setting up isolated mode

To explain what to do, we will go step-by-step through a simple example using configuration files.27

You can go through this demo and later adopt the paths to your environment.

Running a backup to master backup

First of all, I will do something you should already have done: I will create a backup in the master backup directory.

For this demo, I'll create a master backup repository in the directory isol-test in my home directory (backup), a source directory to backup (source), copy a file to backup into it and generate a configuration file:

# cd
# mkdir isol-test
# cd isol-test
# mkdir backup source
# ls
# cp -v /bin/ls source
# ls -l source
# storeBackup.pl -g stbu.conf

Next, use an editor of your choice and change the following items in stbu.conf:

sourceDir=source
backupDir=backup

We need a full backup so we can copy its meta data to the external media:

# storeBackup.pl -f stbu.conf
WARNING   2012.06.09 09:07:57  5647 created directory <backup/default>
...  <snip, deleted output of storeBackup.pl>

The warning tells you that storeBackup.pl created a subdirectory for the series default.

Setting up isolated mode

You may want to use ls (or maybe a file browser) to see that the backup into directory backup was successful.

Now plug in your external media, e.g., a memory stick; it has to be formatted with a Linux file system or with NTFS (not FAT). Make sure it is mounted in the same path always. You can do this in several ways, maybe depending on you distribution and / or the GUI you are using. If you have no idea how to do this, search for "blkid fstab" with an internet search engine like Google or another one.

In the following settings I assume your external media has been mounted at /media/stick. Please adjust the path /media/stick to your local settings!

Now it is time to set up the stick after creating a backup directory /media/stick/stbu on it:

# mkdir /media/stick/stbu
# storeBackupSetupIsolatedMode.pl -f stbu.conf -t /media/stick/stbu
INFO    2012.06.09 09:27:29  5888 ./isolate-stbu.conf: changed <backupDir> to '/media/stick/stbu'
INFO    2012.06.09 09:27:29  5888 ./isolate-stbu.conf: created <mergeBackupDir> as 'backup'
INFO    2012.06.09 09:27:29  5888 ./isolate-stbu.conf: setting <otherBackupSeries> to 0:default
INFO    2012.06.09 09:27:29  5888 ./isolate-stbu.conf: changed <lateLinks> to 'yes'
INFO    2012.06.09 09:27:29  5888 you may want to adjust <./isolate-stbu.conf> to your needs
The program storeBackupSetupIsolatedMode.pl told you that it had created a new configuration file called isolate-stbu.conf with some adjustments: backupDir has been set to the directory on the stick and lateLinks (storeBackup.pl's option lateLinks) has been switched on. It also created an entry mergeBackupDir which is used later by storeBackupMergeIsolatedBackup.pl to integrate your isolated backups on the stick into the central ones in the directory backup (in this example). Finally, otherBackupSeries is set to this backup series only. Generating references to other backup series (which do not exist in this simple example) is not possible when making backups on your stick.28
Have a look at the generated configuration file. The adjustment of options will only work if unused options are commented using a semicolon (;), not a hash sign (#).

If you want to use the functionality of isolated mode later again, you can take a fresh memory stick where the backup directory on the stick is accessible with the same path as configured here the first time. Then simply take the generated configuration file to copy the meta data to the stick:

# storeBackupSetupIsolatedMode.pl -f isolate-stbu.conf -v

Option -v will produce some output so you can see what's happening.

Run backups on your local media

Now lets copy a new file to source directory and run a backup on it:

# cp /bin/pwd source
# storeBackup.pl -f isolate-stbu.conf

That's it. Now let's see what happend:

# ls -lh /media/stick/stbu/default/*
/media/stick/stbu/default/2012.06.09_09.07.57:
total 0

/media/stick/stbu/default/2012.06.09_09.56.36:
total 16K
-rw------- 1 root root 13K Jun  9 09:56 pwd.bz2

As you can see, there is no saved file in the first backup directory (2012.06.09_09.07.57) because meta data was copied by storeBackupSetupIsolatedMode.pl. In the second backup you see the new file pwd but not ls because it wasn't changed. It will be hard linked after being integrated into the master backup. If you want to see some internals, you can look into the command file for storeBackupUpdateBackup.pl to see it has to be linked:

# bzcat /media/stick/stbu/default/*/.storeBackupLinks/linkFile.bz2 
# link md5sum
#	existingFile
#	newLink
# compress md5sum
#	fileToCompress
# dir dirName
# symlink file
#	target
# linkSymlink link
#	existingFile
#	newLink
link 92385e9b8864032488e253ebde0534c3
../2012.06.09_09.07.57/./ls.bz2
ls.bz2

You can run as many additional backups as you want, but naturally space on you local media must be sufficient. Use df -h /media/stick (adjust the path to your needs) to see how much space is free. You can also run du to see how much space has been used so far for your isolated backups:

# du -sh /media/stick/stbu/default/*
24K	/media/stick/stbu/default/2012.06.09_09.07.57
44K	/media/stick/stbu/default/2012.06.09_09.56.36

Merging your isolated backups back into the central one

Merging into the master backup simply means to copy the incremental backups. This job is done by storeBackupMergeIsolatedBackup.pl:

# storeBackupMergeIsolatedBackup.pl -f isolate-stbu.conf 
in directory </media/stick/stbu/default>, copy
	<2012.06.09_09.56.36>
to
	<backup/default>
?
yes / no -> yes
INFO    2012.06.09 10:15:11  6557 copying data . . .
INFO    2012.06.09 10:15:11  6557 finished copying data
INFO    2012.06.09 10:15:11  6557 please run
INFO    2012.06.09 10:15:11  6557 	storeBackupUpdateBackup.pl -b "backup"

The program uses the parameter of the option mergeBackupDir inserted by storeBackupSetupIsolatedMode.pl to get the path to the master backup. For safety reasons, it asks you if you want to copy the presented list of backups (only one in this example) to the master backup at backup/default. After answering yes, the data is copied.

To get a ``normal'' full backup, run storeBackupUpdateBackup.pl -b backup.

If you use isolated mode in the same way a second time (after re-merging backup to the master backup), you can use the option --backupDir of storeBackupSetupIsolatedMode.pl (because you already have a valid configuration file) or simply generate a new configuration file with another name (see option --generate) and use the old one which you may have adjusted to your needs.

Heinz-Josef Claes 2014-04-20