1 .\" (c) Copyright 1997-2010 by Matthew Dillon, Dima Ruban, and Oliver Fromme.
2 .\" Permission to use and distribute based on the DragonFly copyright.
3 .\" Supplied as-is, USE WITH CAUTION.
10 .Nd mirror filesystems
14 .Op Fl v Ns Op Cm v Ns Op Cm v
36 .Oo Oo Ar user Ns Li @ Oc Ns Ar host : Oc Ns Ar source_dir
37 .Oo Oo Ar user Ns Li @ Oc Ns Ar host : Oc Ns Ar target_dir
41 utility makes an exact mirror copy of the source in the destination, creating
42 and deleting files and directories as necessary. UTimes, hardlinks,
43 softlinks, devices, permissions, and flags are mirrored. By default,
45 asks for confirmation if any file or directory needs to be removed from
46 the destination and does not copy files which it believes to have already
47 been synchronized (by observing that the source and destination files' sizes
50 does not cross mount points in either the source or the destination.
53 refuses to replace a destination directory with a file.
55 The following options are available:
58 If the source or target is a remote host, request that the
60 session be compressed.
64 .It Fl v Ns Op Cm v Ns Op Cm v
65 Set verboseness. By default
67 does not report its progress except when asking for confirmation. A single
69 will only report modifications made to the destination.
71 will report directories as they are being traversed as well as
72 modifications made to the destination.
74 will cause all files and directories to be reported whether or not
75 modifications are made.
77 Print directories as they are being traversed.
78 Useful to watch the progress;
79 this typically produces much less output than
82 Go through the motions but don't actually make any changes to
85 Causes the output generated by
90 This can be useful for obtaining prompt progress updates through a pipe.
94 to print a summary at the end with performance counters.
96 Forces file updates to occur even if the files appear to be the same. If
99 option is used, this option will force a byte for byte comparison
100 between the original file and the file in the hardlink path, even if
101 all the stat info matches, but will still use a hardlink if they match.
107 Note the lack of a space.
109 Disable the disallow-file-replaces-directory safety feature. This
110 safety feature is enabled by default to prevent user mistakes from blowing
111 away everything accidentally.
113 Do not request confirmation when removing something.
115 Do not try to recreate CHR or BLK devices.
117 Line buffer verbose output.
121 Do not remove any files, just overwrite/add.
123 Generate and maintain a MD5 checkfile called
125 in each directory on the source
126 and do an MD5 check on each file of the destination when the destination
127 appears to be the same as the source. If the check fails,
128 the source is recopied to the destination. When you specify a destination
129 directory, the MD5 checkfile is only updated as needed and may not be updated
130 even if modifications are made to a source file. If you do not specify a
131 destination directory the
133 command forcefully regenerates the MD5 checkfile for every file in the source.
137 but allows you to specify the name of the MD5 checkfile.
140 will create a hardlink from a file found under
142 to the target instead of copying the source to the target if the file found
145 is identical to the source.
146 Note that a remote host specification should not be used for this option's
150 will be relative to the target machine.
152 This allows one to use
154 to create incremental backups of a filesystem. Create a direct
156 backup, and then specify the level 0 backup path with this option when
157 creating an incremental backup to a different target directory.
158 This method works so long as the filesystem does not hit a hardlink limit.
159 If the system does hit a hardlink limit,
161 will generate a warning and copy the file instead.
164 must record file paths for any hardlinked file while operating and therefore
165 uses a great deal more memory when dealing with hardlinks or hardlink-based
166 backups. Example use:
168 .Dl cpdup \-i0 \-s0 \-I \-H /backup/home.l0 /home /backup/home.l1
170 WARNING: If this option is used
172 must record the paths for all files it encounters while it operates
173 and it is possible that you may run the process out of memory.
175 The file found via the hardlink path will be byte-by-byte compared with the
180 option is also used, otherwise only the stat info is checked to determine
181 whether it matches the source.
183 This forces the contents of regular files to be verified, even if the
184 files appear to the be the same. Whereas the
186 (force) option forces a copy regardless, this option will avoid rewriting
187 the target if everything matches and the contents are verified to be the
190 This works the same as
192 but ignores mtime entirely, making it suitable for comparing HAMMER
193 master and slave filesystems or copies made without mtime retention.
197 into slave mode and is used to initiate the slave protocol on a remote
199 This option is not intended to be used by humans.
201 Place the slave into read-only mode.
202 Can only be used when the source is remote.
203 Useful for unattended backups via SSH keys.
207 to use the exclusion file
209 in each directory on the source to
210 determine which files to ignore. When this option is used, the exclusion
211 filename itself is automatically excluded from the copy. If this option is
212 not used then the filename
214 is not considered special and will
215 be copied along with everything else.
219 but allows you to specify the name of the exclusion file. This file is
220 automatically excluded from the copy. Only one exclusion file may be
223 When an absolute path is used, the same exclusive file is read for
224 every directory and may contain full paths or wildcarded paths based
225 on the full source path as specified on the cpdup command line.
226 In this situation, the exclusive file is read from the host running
227 the command, NOT from the source host (if remote).
229 When a relative path is used (or
231 is specified), the exclusion file is only applicable to the directory
232 it resides in on the source host and only path elements (the directory
233 elements) are matched against it.
237 can mirror directory structures across machines and can also do third-party
239 This also works between machines that use different byte order.
241 sessions are used and
243 is run on the remote machine(s) in slave mode.
246 option to pass additional flags to the ssh command if necessary.
248 The syntax of remote path specifications is similar to
250 In particular, that means that a local path containing a colon must
251 be preceded by a slash to prevent it being considered a remote host:
255 to look for a directory called
261 denotes the directory
263 on the local machine.
268 prefix which is silently discarded but prevents any colons in the remainder
269 of the path from being interpreted as a host:path form.
270 this form can be used with relative filenames when you do not want colons in
271 the filename to be misinterpreted.
283 command was originally created to update servers at BEST Internet circa 1997
284 and was placed under the
286 copyright for inclusion in the ports area in 1999.
287 The program was written by Matthew Dillon, Dima Ruban, and later
288 significantly improved by Oliver Fromme.
291 has a hardlink limit of 32767. Many programs, in particular CVS
292 with regards to its CVS/Root file, will generate a lot of hard links.
295 option it may not be possible for
297 to maintain these hard links. If this occurs,
299 will be forced to copy the file instead of link it, and thus not be able
300 to make a perfect copy of the filesystem.
302 When so-called sparse files (i.e. files with "holes") are copied,
303 the holes will be filled in the target files, so they occupy
304 more physical disk space than the source files.
306 For compatibility reasons, the slave protocol is not as efficient
307 for writing remote files as it is for reading them.
308 Therefore it is recommended to run
310 on the target machine when making remote copies,
311 so the source machine is remote.
312 If you do it the other way,
314 will run somewhat slower.