Next: llt
Up: Components / Programs to
Previous: storeBackupConvertBackup.pl
Contents
linkToDirs.pl
Make a de-duplicated copy of files in defined directories to another
location. Utilizes hard links to the full extent possible to avoid
wasting storage space.
linkToDirs.pl is a general purpose tool. However, it is very
helpful if you want to copy a storeBackup backup to another disk.
Usage note: whereas many file copy utilities have just two primary
parameters (the source and destination), linkToDirs.pl allows
three primary parameters:
- source(s),
- destination
- and a reference location(s).
The reference location is the place to look for existing content which
can be hard linked to (see --linkWith option).
The --linkWith option is not required. If you use it, you can
optionally specify multiple link references for hard linking (i.e.,
the --linkWith option can be repeated).
Files with the same content as the specified link reference(s) and on
the same file system will be hard linked. Hard links within the copied
files will be maintained or re-created: linkToDirs.pl will
always hard link identical files, with one exception. That exception
is: files in the directories specified by --linkWith will never
be changed. So if there are two identical files which are not hard
linked, they will remain that way (unlinked). linkToDirs.pl
supports hard linking of symbolic links with at least as much
capability as the main storeBackup.pl program does.
(Naturally, if there are no identical files, it will only copy files.)
Hard links on Linux have these rules:
- Hard links cannot link directories.
- Hard links cannot cross file system boundaries.
If it is not possible to create a hard link to the reference file (due
to the limitations of hard links) linkToDirs.pl will generate a new
file copy (on the target file system) and then hard link to that one
going forward. In this way, linkToDirs.pl can be used to maintain a
de-duplicated state of source files when copying them to another
filesystem.
linkToDirs.pl is a general purpose tool. However, it has a
special synergy with storeBackup. As you know, storeBackup eliminates
wasted space in the storage location by maintaining a de-duplicated
state through the use of hard links (even if the target filesystem
supports less hard links per file than the source filesystem). But
hard links cannot be maintained across different file systems.
Therefore, when you want to copy an existing storeBackup backup to a
new disk (or new file system), linkToDirs.pl allows you to do so and
to maintain all the storage efficiency benefits of the original
storeBackup backup.
linkToDirs.pl [--linkWith copyBackupDir] [--linkWith ...]
--targetDir targetForSourceDir
[--progressReport number] [--dontLinkSymlinks]
[--ignoreErrors] [--saveRAM] [-T tmpdir]
sourceDir ...
- --help / -h
- print a help message
- --linkWith / -w
- the reference location; consider the
files in these directories for hard linking. This option can be
repeated. (The directories are recursed, as you would expect.)
- --targetDir / -t
- the destination; files from
sourceDirs will be copied to this directory.
- --dontLinkSymlinks
- do not hard link identical symbolic
links (symlinks). The default is to hard link each existing symlink
rather than copy the symlink.
- --progressReport / -P
- write a progress report after
analysing the specified number of files
- sourceDir
- the source directory; files (or existing
storeBackup backups) from this directory will be copied to
targetDir. sourceDir may be repeated multiple times
with different directories. Normal shell file and directory
conventions, including wildcards, are acceptable. Copy functionality
is recursive into all subdirectories within the listed
sourceDir.
- --ignoreErrors
- Don't stop copying in case of errors
during copying / linking.
- --saveRAM / saveRAM
- Use this option if storeBackup.pl
runs on a system with very low memory configuration. You will then
see some dbm files in ``tmpDir''. This will slow down storeBackup.pl
a little bit, so do this only if you run into problems without
it. On modern computers, it should only be necessary to use this
option if you copy millions of files.
- --tmpDir / -T /tmpDir
- Directory for temporary files, the
default value is picked from the environment variable
$tmpdir. If it does not exist, /tmp is set as
the default value.
Next: llt
Up: Components / Programs to
Previous: storeBackupConvertBackup.pl
Contents
Heinz-Josef Claes
2013-05-09