1 .\" (c) Copyright 1997-1999 by Matthew Dillon and Dima Ruban. Permission to
2 .\" use and distribute based on the DragonFly copyright. Supplied as-is,
3 .\" USE WITH EXTREME CAUTION.
6 .\" $DragonFly: src/bin/cpdup/cpdup.1,v 1.31 2008/05/30 18:00:23 swildner Exp $
12 .Nd mirror filesystems
48 .Ar [[user@]host:]source_dir
49 .Ar [[user@]host:]target_dir
53 utility makes an exact mirror copy of the source in the destination, creating
54 and deleting files and directories as necessary. UTimes, hardlinks,
55 softlinks, devices, permissions, and flags are mirrored. By default,
57 asks for confirmation if any file or directory needs to be removed from
58 the destination and does not copy files which it believes to have already
59 been synchronized (by observing that the source and destination file's size
62 does not cross mount points in either the source or the destination.
65 refuses to replace a destination directory with a file.
67 The following options are available:
70 If the source or target is a remote host request that the
72 session be compressed.
74 Set verboseness. By default
76 does not report its progress except when asking for confirmation. A single
78 will only report modifications made to the destination.
80 will report directories as they are being traversed as well as
81 modifications made to the destination.
83 will cause all files and directories to be reported whether or not
84 modifications are made.
86 Causes the ouptut generated by
89 This can be useful for obtaining prompt progress updates through a pipe.
93 to print a summary at the end with performance counter.
95 Forces file updates to occur even if the files appear to be the same. If
98 option is used, this option will force a byte for byte comparison
99 between the original file and the file in the hardlink path, even if
100 all the stat info matches, but will still use a hardlink if they match.
102 Disable the disallow-file-replaces-directory safety feature. This
103 safety feature is enabled by default to prevent user mistakes from blowing
104 away everything accidentally.
106 Do not request confirmation when removing something.
108 Do not try to recreate CHR or BLK devices.
110 Line buffer verbose output.
112 Use threaded transactions with up to the specified
115 This typically improves operation when a remote host specification is
120 Do not remove any files, just overwrite/add.
122 Generate and maintain a MD5 checkfile in each directory on the source
123 and do an MD5 check on each file of the destination when the destination
124 appears to be the same as the source. If the check fails,
126 the source is recopied to the destination. When you specify a destination
127 directory the MD5 checkfile is only updated as needed and may not be updated
128 even if modifications are made to a source file. If you do not specify a
129 destination directory the
131 command forcefully regenerates the MD5 checkfile for every file in the source.
134 will create a hardlink from a file found under
136 to the target instead of copying the source to the target if the file found
139 is identical to the source.
140 Note that a remote host specification should not be used for this option's
141 path, but the path will be relative to the target machine.
143 This allows one to use
145 to create incremental backups of a filesystem. Create a direct 'level 0'
146 backup, and then specify the level 0 backup path with this option when
147 creating an incremental backup to a different target directory.
148 This method works so long as the filesystem does not hit a hardlink limit.
149 If the system does hit a hardlink limit
151 will generate a warning and copy the file instead.
154 must record file paths for any hardlinked file while operating and therefore
155 uses a great deal more memory when dealing with hardlinks or hardlink-based
156 backups. Example use:
158 .Dl cpdup -i0 -s0 -I -H /backup/home.l0 /home /backup/home.l1
160 WARNING: If this option is used
162 must record the paths for all files it encounters while it operates
163 and it is possible that you may run the process out of memory.
165 The file found via the hardlink path will be byte-by-byte compared with the
170 option is also used, otherwise only the stat info is checked to determine
171 whether it matches the source.
175 but allows you to specify the name of the MD5 checkfile.
177 This forces the contents of regular files to be verified, even if the
178 files appear to the be the same. Whereas the
180 (force) option forces a copy regardless, this option will avoid rewriting
181 the target if everything matches and the contents are verified to be the
186 into slave mode and is used to initiate the slave protocol on a remote
189 Generate and maintain a FSMID checkfile called .FSMID.CHECK in each
190 directory on the target.
192 will check the FSMID for each source file or directory against the checkfile
193 on the target and will not copy the file or recurse through the directory
194 when a match occurs. Any source file or directory with the same name as the
195 checkfile will be ignored. The FSMID will be re-checked after the copy
196 has been completed and
198 will loop on that directory or file until it is sure it has an exact copy.
200 Warning: FSMID is not always supported by a filesystem and may not be
201 synchronized if a crash occurs.
203 will simulate an FSMID when
204 it is otherwise not supported by the filesystem, and users should be aware
205 that simulated FSMIDs may change state in such cases even if the underlying
206 hierarchy does not due to cache flushes.
207 Additionally, the FSMID may not reflect changes made to remote filesystems
208 by other hosts. For example, using these options with NFS mounted sources
213 but allows you to specify the name of the FSMID checkfile.
217 to use the exclusion file ".cpignore" in each directory on the source to
218 determine which files to ignore. When this option is used, the exclusion
219 filename itself is automatically excluded from the copy. If this option is
220 not used then the filename ".cpignore" is not considered special and will
221 be copied along with everything else.
225 but allows you to specify the name of the exclusion file. This file is
226 automatically excluded from the copy. Only one exclusion file may be
231 can mirror directory structures across machines and can also do third-party
234 sessions are used and
236 is run on the remote machine(s) in slave mode.
240 utility exits 0 if no error occurred and >0 if an error occurred.
248 command was originally created to update servers at BEST Internet circa 1997
249 and was placed under the
251 copyright for inclusion in the ports area in 1999.
252 The program was written by Matthew Dillon and Dima Ruban.
255 has a hardlink limit of 32767. Many programs, in particular CVS
256 with regards to its CVS/Root file, will generate a lot of hard links.
259 option it may not be possible for
261 to maintain these hard links. If this occurs
263 will be forced to copy the file instead of link it, and thus not be able
264 to make a perfect copy of the filesystem.