3 remsync - remotely synchronize file trees
26 synchronizes file trees of distant machines, i.e. machines that do not have
27 a fast network between them. It accomplishes this in three steps:
30 Create a state file containing a description of the machine to be updated.
34 Compute a file of differences on the source machine using the state file to
35 compare the two file trees.
39 Update the target machine using the data in the differences file.
42 This process requires that you move two files, a state file from the target
43 machine to the source machine, and a differences file from the source
44 machine to the target machine. The state file is an ASCII file that may be
45 edited, usually to make
47 ignore some files or file trees.
51 may be a single file or a directory. A directory is traversed recursively.
56 arguments may be of any file type. The differences file contains an end
57 marker, so it may be followed by trailing junk. Standard input or
58 output is used if these arguments are omitted or replaced by a minus
60 .SS "State file format"
61 A state file has a line for each file in a tree. A line looks like this
62 formally for a simple file:
65 .I "name mode owner group length date"
70 The best way to show how each type of file is represented is by example:
74 .ta +10 +8 +4 +4 +6 +12 +4
78 [ 644 2 0 233 759160857 1
79 cat 755 2 0 3772 768742021
80 test 755 2 0 233 759160857 1 last
90 usr ignore (Cross-device link)
94 The root of the tree is always represented by a /, no matter what type of
95 file it may be. Directory entries of the root follow at the same level.
96 Files in subdirectories are indented by two spaces. (Eight spaces are
97 replaced by a TAB.) Normal files have their length and modified time in the
98 state file, devices have their device number in hex, etc. If files are hard
99 linked to each other then they all get an extra "link number" to bind them
100 together. The last link is marked with the word
103 One usually only modifies a state file to ignore differences between two
104 files. One does this by replacing the file attributes with the word
107 generates this keyword too, with the reason why added in parentheses.)
111 Generate a state file.
114 Generate a differences file. (The default is to apply a differences file.)
117 Only add new files or update files with newer versions.
120 Do not cross device boundaries. This allows one to operate on the root file
121 system for instance ignoring the
126 Debug differences file generation. With this flag no file contents are
127 added to the differences file. The result is then human readable.
130 Lists the commands added to the differences file, or the actions done
131 applying a differences file. The output looks like \s-2UNIX\s+2 commands
132 except for the words "add", "restore" and "update" indicating addition of a
133 new file, replacing a file with an older version, or replacement by a newer
136 Actions taken by the author to update his notebook "finiah" from his main
141 finiah# remsync -s /usr /tmp/finiah.state
143 Edit the state file to ignore .Xauthority files and /usr/var.
145 finiah# tar cvf /dev/fd0 /tmp/finiah.state
147 darask# tar xvf /dev/fd0
149 darask# remsync -dv /usr /tmp/finiah.state | vol 1440 /dev/fd0
151 finiah# vol 1440 /dev/fd0 | remsync -v /usr
155 One could add a file compression/decompression program between
159 to reduce the number of floppies to move about, but that actually slows
160 things down! (Note that one only needs to shuffle two floppies about if the
161 two machines are adjacent. To update a remote machine it does make sense to
162 use compression to reduce the number of floppies to carry.)
168 Nothing stops you from using
170 over a fast network of course.
172 can be a bit tedious if you only want to ignore a few files. Editing a
173 state file is then easier.
175 Files are overwritten, not removed, when they are updated. This means
176 that links outside the tree are also updated. The less desirable
177 alternative to this is to break the link before the update.
179 The verbose option may say that a link is to be created when making a
180 differences file. The link is often already there when the update takes
181 place, so no action is taken, and thus no talk about it. So you may miss a
182 few mutterings about links if you compare the messages.
184 Kees J. Bot (kjb@cs.vu.nl)