clone
—
A file tree cloning tool
clone |
[-c roff|woff|rwoff]
[-d |-i |-s ]
[-l ] [-v
level] [-x
exclude-list] [-X
excl-list-file] [-y ]
[-h |-? |?]
source/ destination/ |
clone
is a file tree cloning tool which runs 3 threads -
a scheduler (main), a reader, and a writer thread. Reading and writing occurs
in parallel. While this is most beneficial for copying data from one physical
disk to another, clone
is also very well suited for
cloning a file tree to any place on the same disk.
Cloning includes the whole directory hierarchy, i.e.
sub-directories, files, hard links, symbolic links, attributes (modes,
flags, times), extended attributes and access control lists.
clone
is useful for cloning (thus
backing-up) live file systems, and it can also be used in incremental and
synchronization mode.
clone
works on FreeBSD and macOS.
clone
is very fast, for example, cloning a
whole UFS2 file hierarchy on FreeBSD 9.1 of in total 2.3 TBytes of data from
one hard disk to another took 7.5 h, so the average transfer rate for all
kind of files (very small up to very big ones) was about 89 MByte/s.
Optional flags:
-c
roff | woff |
rwoff
- Selectively turn off the file system cache for reading or writing or for
reading and writing -- the caches are on by default.
- The options -d, -i, -s are mutually exclusive:
-
-d
- Delete the contents of the destination before cloning, but do not remove
the destination directory or mount point itself. Stop on error. Deletion
requires user confirmation, unless it is confirmed inherently by the
-y flag. Be careful, deletion cannot be undone! NOTE: It may take
its time to empty hugh file trees, and it may be faster to use
newfs(8) for initializing big volumes.
-i
- Incrementally add new content to or change content in the destination, but
do not touch content in destination that does not exist in source.
-s
- Completely synchronize destination with source.
-l
- Don't copy, but create hard links of regular files in the cloned directory
tree.
-v
- Verbosity level (default = 1):
0 - no output
1 - show directory action: + for add, - for delete, = for keep
2 - indicate cloned files by '.'
3 - display the path names of cloned file system items
-x
exclude-list
- Colon separated list of entity names or full path names to be excluded
from cloning. Use full path names to single out exactly one item. Use
entity names for all existing entities having that name being excluded.
For example: -x ".snap:/.sujournal:.DS_Store:/fullpath/to a/volatile
cache"
-X
excl-list-file
- File containing a list of entity names or full path names to be excluded
-- one item per line.
-y
- Automatically answer with y(es) to y|n confirmation prompts.
-h
|
-?
|
?
- Show the usage instructions.
Required arguments:
- source/
- Path to the source directory or mount point to be cloned. The final '/'
may be omitted.
- destination/
- Path to the destination directory or mount point. If the destination does
not exist, then it will be created. The final '/' may be omitted.
- Initial cloning of the root volume / to a volume mounted on
/mnt:
- clone / /mnt
- Same as above, but empty /mnt before cloning:
- clone -d / /mnt
- Incrementally update the clone with respect to the master:
- clone -i / /mnt
- Keep the clone exactly synchronized to the master:
- clone -s / /mnt
- Create a non-versioned clone of a versioned source tree:
- clone -x .svn /path/to/my/project /path/to/non-versioned/project
- Clone a directory to a share and strip file system specific meta
data:
- clone -x ".DS_Store:.AppleDouble:.AppleDesktop:.appdisk"
/path/to/afpvol /path/to/the/share
Dr. Rolf Jansen. Copyright (c) 2013-2019. All rights
reserved.
Improper use of clone
may delete or overwrite data. Take
special care with the -d and the -s option. Also always be sure, that the last
command line argument designates a path to a file tree which really is under
disposition.
In NO event shall the author and/or copyright owner be liable for
ANY damages resulting from ANY use of this software. Use
clone
at your own risk!
clone
has been carefully developed and tested. Anyway,
clone
is provided without any expressed or implied
warrantee on being 100 % bug free.