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. 4.\" 5.\" 6.\" $DragonFly: src/bin/cpdup/cpdup.1,v 1.10 2006/04/27 10:23:20 swildner Exp $ 7.Dd October 28, 1999 8.Dt CPDUP 1 9.Os BSD 4 10.Sh NAME 11.Nm cpdup 12.Nd mirror filesystems 13.Sh SYNOPSIS 14.Nm cpdup 15.Op Fl v[vv..] 16.Op Fl u 17.Op Fl I 18.Op Fl f 19.Op Fl s0 20.Op Fl i0 21.Op Fl q 22.Op Fl o 23.Op Fl m 24.Oo 25.Fl M 26.Ar file 27.Oc 28.Op Fl k 29.Oo 30.Fl K 31.Ar file 32.Oc 33.Oo 34.Fl X 35.Ar file 36.Oc 37.Op Fl x 38.Ar source_dir 39.Ar target_dir 40.Sh DESCRIPTION 41The 42.Nm 43utility makes an exact mirror copy of the source in the destination, creating 44and deleting files and directories as necessary. UTimes, hardlinks, 45softlinks, devices, permissions, and flags are mirrored. By default, 46.Nm 47asks for confirmation if any file or directory needs to be removed from 48the destination and does not copy files which it believes to have already 49been synchronized (by observing that the source and destination file's size 50and mtimes match). 51.Nm 52does not cross mount points in either the source or the destination. 53As a safety measure, 54.Nm 55refuses to replace a destination directory with a file. 56.Pp 57The following options are available: 58.Bl -tag -width flag 59.It Fl v[vv] 60Set verboseness. By default 61.Nm 62does not report its progress except when asking for confirmation. A single 63.Fl v 64will only report modifications made to the destination. 65.Fl vv 66will report directories as they are being traversed as well as 67modifications made to the destination. 68.Fl vvv 69will cause all files and directories to be reported whether or not 70modifications are made. 71.It Fl u 72Causes the ouptut generated by 73.Fl v[vv] 74to be unbuffered. 75This can be useful for obtaining prompt progress updates through a pipe. 76.It Fl I 77will cause cpdup to print a summary at the end with performance counter. 78.It Fl f 79Forces file updates to occur even if the files appear to be the same. 80.It Fl s0 81Disable the disallow-file-replaces-directory safety feature. This 82safety feature is enabled by default to prevent user mistakes from blowing 83away everything accidently. 84.It Fl i0 85Do not request confirmation when removing something. 86.It Fl q 87Quiet operation 88.It Fl o 89Do not remove any files, just overwrite/add. 90.It Fl m 91Generate and maintain a MD5 checkfile in each directory on the source 92and do an MD5 check on each file of the destination when the destination 93appears to be the same as the source. If the check fails, 94.Nm 95the source is recopied to the destination. When you specify a destination 96directory the MD5 checkfile is only updated as needed and may not be updated 97even if modifications are made to a source file. If you do not specify a 98destination directory the 99.Nm 100command forcefully regenerates the MD5 checkfile for every file in the source. 101.It Fl M Ar file 102Works the same as 103.Fl m 104but allows you to specify the name of the MD5 checkfile. 105.It Fl k 106Generate and maintain a FSMID checkfile called .FSMID.CHECK in each 107directory on the target. 108.Nm 109will check the FSMID for each source file or directory against the checkfile 110on the target and will not copy the file or recurse through the directory 111when a match occurs. Any source file or directory with the same name as the 112checkfile will be ignored. The FSMID will be re-checked after the copy 113has been completed and 114.Nm 115will loop on that directory or file until it is sure it has an exact copy. 116.Pp 117Warning: FSMID is not always supported by a filesystem and may not be 118synchronized if a crash occurs. DragonFly will simulate an FSMID when 119it is otherwise not supported by the filesystem, and users should be aware 120that simulated FSMIDs may change state in such cases even if the underlying 121hierarchy does not due to cache flushes. 122Additionally, the FSMID may not reflect changes made to remote filesystems 123by other hosts. For example, using these options with NFS mounted sources 124will not work well. 125.It Fl K Ar file 126Works the same as 127.Fl k 128but allows you to specify the name of the FSMID checkfile. 129.It Fl x 130Causes 131.Nm 132to use the exclusion file ".cpignore" in each directory on the source to 133determine which files to ignore. When this option is used, the exclusion 134filename itself is automatically excluded from the copy. If this option is 135not used then the filename ".cpignore" is not considered special and will 136be copied along with everything else. 137.It Fl X Ar file 138Works the same as 139.Fl x 140but allows you to specify the name of the exclusion file. This file is 141automatically excluded from the copy. Only one exclusion file may be 142specified. 143.El 144.Sh DIAGNOSTICS 145The 146.Nm 147utility exits 0 if no modifications were made, and >0 if modifications 148were made to the destination. 149.Sh SEE ALSO 150.Xr cp 1 , 151.Xr cpio 1 , 152.Xr tar 1 153.Sh HISTORY 154The 155.Nm 156command was original created to update servers at BEST Internet circa 1997 157and was placed under the FreeBSD copyright for inclusion in the ports area 158in 1999. The program was written by Matthew Dillon and Dima Ruban. 159