]> arthur.barton.de Git - bup.git/blob - README
Update the README to reflect recent changes.
[bup.git] / README
1
2 bup 0.04: It backs things up
3 ============================
4
5 bup is a program that backs things up.  It's short for "backup." Can you
6 believe that nobody else has named an open source program "bup" after all
7 this time?  Me neither.
8
9 Despite its unassuming name, bup is pretty cool.  To give you an idea of
10 just how cool it is, I wrote you this poem:
11
12                              Bup is teh awesome
13                           What rhymes with awesome?
14                             I guess maybe possum
15                            But that's irrelevant.
16                         
17 Hmm.  Did that help?  Maybe prose is more useful after all.
18
19
20 Reasons bup is awesome
21 ----------------------
22
23 bup has a few advantages over other backup software:
24
25  - It uses a rolling checksum algorithm (similar to rsync) to split large
26    files into chunks.  The most useful result of this is you can backup huge
27    virtual machine (VM) disk images, databases, and XML files incrementally,
28    even though they're typically all in one huge file, and not use tons of
29    disk space for multiple versions.
30    
31  - It uses the packfile format from git (the open source version control
32    system), so you can access the stored data even if you don't like bup's
33    user interface.
34    
35  - Unlike git, it writes packfiles *directly* (instead of having a separate
36    garbage collection / repacking stage) so it's fast even with gratuitously
37    huge amounts of data.
38    
39  - Data is "automagically" shared between incremental backups without having
40    to know which backup is based on which other one - even if the backups
41    are made from two different computers that don't even know about each
42    other.  You just tell bup to back stuff up, and it saves only the minimum
43    amount of data needed.
44    
45  - Even when a backup is incremental, you don't have to worry about
46    restoring the full backup, then each of the incrementals in turn; an
47    incremental backup *acts* as if it's a full backup, it just takes less
48    disk space.
49    
50  - It's written in python (with some C parts to make it faster) so it's easy
51    for you to extend and maintain.
52
53
54 Reasons you might want to avoid bup
55 -----------------------------------
56
57  - This is a very early version. Therefore it will most probably not work
58    for you, but we don't know why.  It is also missing some
59    probably-critical features.
60    
61  - It requires python 2.5, a C compiler, and an installed git version >= 1.5.2.
62  
63  - It currently only works on Linux, MacOS X 10.5, or Windows (with Cygwin).
64    Patches to support other platforms are welcome.
65  
66  - It has almost no documentation.  Not even a man page!  This file is all
67    you get for now.
68    
69    
70 Getting started
71 ---------------
72
73  - check out the bup source code using git:
74  
75         git clone git://github.com/apenwarr/bup
76
77  - install the python 2.5 development libraries.  On Debian or Ubuntu, this
78    is:
79         apt-get install python2.5-dev
80         
81  - build the python module and symlinks:
82  
83         make
84         
85  - run the tests:
86  
87         make test
88         
89    (The tests should pass.  If they don't pass for you, stop here and send
90    me an email.)
91    
92  - Try making a local backup as a tar file:
93  
94         tar -cvf - /etc | bup split -n local-etc -vv
95         
96  - Try restoring your backup tarball:
97  
98         bup join local-etc | tar -tf -
99         
100  - Look at how much disk space your backup took:
101  
102         du -s ~/.bup
103         
104  - Make another backup (which should be mostly identical to the last one;
105    notice that you don't have to *specify* that this backup is incremental,
106    it just saves space automatically):
107  
108         tar -cvf - /etc | bup split -n local-etc -vv
109         
110  - Look how little extra space your second backup used on top of the first:
111  
112         du -s ~/.bup
113         
114  - Restore your old backup again (the ~1 is git notation for "one older than
115    the most recent"):
116    
117         bup join local-etc~1 | tar -tf -
118  
119  - get a list of your previous backups:
120  
121         GIT_DIR=~/.bup git log local-etc
122         
123  - make a backup on a remote server (which must already have the 'bup' command
124    somewhere in the PATH, and be accessible via ssh; make sure to replace
125    SERVERNAME with the actual hostname of your server):
126    
127         tar -cvf - /etc | bup split -r SERVERNAME: -n local-etc -vv
128  
129  - try restoring the remote backup tarball:
130  
131         bup join -r SERVERNAME: local-etc | tar -tf -
132         
133  - try using the new (slightly experimental) 'bup index' and 'bup save'
134    style backups, which bypass 'tar' but have some missing features (see
135    "Things that are stupid" below):
136         
137         bup index -uv /etc
138         bup save -n local-etc /etc
139         
140  - do it again and see how fast an incremental backup can be:
141  
142         bup index -uv /etc
143         bup save -n local-etc /etc
144         
145    (You can also use the "-r SERVERNAME:" option to 'bup save', just like
146     with 'bup split' and 'bup join'.  The index itself is always local,
147     so you don't need -r there.)
148         
149 That's all there is to it!
150
151
152 How it works
153 ------------
154
155 Basic storage:
156
157 bup stores its data in a git-formatted repository.  Unfortunately, git
158 itself doesn't actually behave very well for bup's use case (huge numbers of
159 files, files with huge sizes, retaining file permissions/ownership are
160 important), so we mostly don't use git's *code* except for a few helper
161 programs.  For example, bup has its own git packfile writer written in
162 python.
163
164 Basically, 'bup split' reads the data on stdin (or from files specified on
165 the command line), breaks it into chunks using a rolling checksum (similar to
166 rsync), and saves those chunks into a new git packfile.  There is one git
167 packfile per backup.
168
169 When deciding whether to write a particular chunk into the new packfile, bup
170 first checks all the other packfiles that exist to see if they already have that
171 chunk.  If they do, the chunk is skipped.
172
173 git packs come in two parts: the pack itself (*.pack) and the index (*.idx).
174 The index is pretty small, and contains a list of all the objects in the
175 pack.  Thus, when generating a remote backup, we don't have to have a copy
176 of the packfiles from the remote server: the local end just downloads a copy
177 of the server's *index* files, and compares objects against those when
178 generating the new pack, which it sends directly to the server.
179
180 The "-n" option to 'bup split' and 'bup save' is the name of the backup you
181 want to create, but it's actually implemented as a git branch.  So you can
182 do cute things like checkout a particular branch using git, and receive a
183 bunch of chunk files corresponding to the file you split.
184
185 If you use '-b' or '-t' or '-c' instead of '-n', bup split will output a
186 list of blobs, a tree containing that list of blobs, or a commit containing
187 that tree, respectively, to stdout.  You can use this to construct your own
188 scripts that do something with those values.
189
190 The bup index:
191
192 'bup index' walks through your filesystem and updates a file (whose name is,
193 by default, ~/.bup/bupindex) to contain the name, attributes, and an
194 optional git SHA1 (blob id) of each file and directory.
195
196 'bup save' basically just runs the equivalent of 'bup split' a whole bunch
197 of times, once per file in the index, and assembles a git tree
198 that contains all the resulting objects.  Among other things, that makes
199 'git diff' much more useful (compared to splitting a tarball, which is
200 essentially a big binary blob).  However, since bup splits large files into
201 smaller chunks, the resulting tree structure doesn't *exactly* correspond to
202 what git itself would have stored.  Also, the tree format used by 'bup save'
203 will probably change in the future to support storing file ownership, more
204 complex file permissions, and so on.
205
206 If a file has previously been written by 'bup save', then its git blob/tree
207 id is stored in the index.  This lets 'bup save' avoid reading that file to
208 produce future incremental backups, which means it can go *very* fast unless
209 a lot of files have changed.
210
211  
212 Things that are stupid for now but which we'll fix later
213 --------------------------------------------------------
214
215 Help with any of these problems, or others, is very, very welcome.  Let me
216 know if you'd like to help.  Maybe we can start a mailing list.
217
218  - 'bup save' doesn't know about file metadata.
219  
220    That means we aren't saving file attributes, mtimes, ownership, hard
221    links, MacOS resource forks, etc.  Clearly this needs to be improved.
222
223  - There's no 'bup restore' yet.
224  
225    'bup save' saves files in the standard git 'tree of blobs' format, so you
226    could then "restore" the files using something like 'git checkout'.  But
227    that's a git command, not a bup command, so it's hard to explain and
228    doesn't support retrieving objects from a remote bup server without first
229    fetching and packing an entire (possibly huge) pack, which could be very
230    slow.  Also, like 'bup save', you would need extra features in order to
231    properly restore file metadata.  And files that bup has split into
232    chunks would need to be recombined somehow.
233    
234  - 'bup index' is slower than it should be.
235  
236    It's still rather fast: it can iterate through all the filenames on my
237    600,000 file filesystem in a few seconds.  But sometimes you just want to
238    change a filename or two, so this is needlessly slow.  There should be
239    a way to binary search through the file list rather than always going
240    through it sequentially.  And if you only add a couple of filenames,
241    there's no need to rewrite the entire index; just leave the new files
242    in a second "extra index" file or something.
243    
244  - bup could use inotify for *really* efficient incremental backups.
245
246    You could even have your system doing "continuous" backups: whenever a
247    file changes, we immediately send an image of it to the server.  We could
248    give the continuous-backup process a really low CPU and I/O priority so
249    you wouldn't even know it was running.
250
251  - bup currently has no features that prune away *old* backups.
252  
253    Because of the way the packfile system works, backups become "entangled"
254    in weird ways and it's not actually possible to delete one pack
255    (corresponding approximately to one backup) without risking screwing up
256    other backups.
257    
258    git itself has lots of ways of optimizing this sort of thing, but its
259    methods aren't really applicable here; bup packfiles are just too huge.
260    We'll have to do it in a totally different way.  There are lots of
261    options.  For now: make sure you've got lots of disk space :)
262
263  - bup doesn't ever validate existing backups/packs to ensure they're
264    correct.
265    
266    This would be easy to implement (given that git uses hashes and CRCs all
267    over the place), but nobody has implemented it.  For now, you could try
268    doing a test restore of your tarball; doing so should trigger git's error
269    handling if any of the objects are corrupted.  'git fsck' would
270    theoreticaly work too, but it's too slow for huge backups.
271
272  - bup has never been tested on anything but Linux, MacOS, and Linux+Cygwin.
273  
274    There's nothing that makes it *inherently* non-portable, though, so
275    that's mostly a matter of someone putting in some effort.  (For a
276    "native" Windows port, the most annoying thing is the absence of ssh in
277    a default Windows installation.)
278    
279  - bup has no GUI.  Actually, that's not stupid, but you might consider it
280    a limitation.  There are a bunch of Linux GUI backup programs; someday
281    I expect someone will adapt one of them to use bup.
282
283
284 How you can help
285 ----------------
286
287 bup is a work in progress and there are many ways it can still be improved.
288 If you'd like to contribute patches, ideas, or bug reports, please join the
289 bup mailing list.
290
291 You can find the mailing list archives here:
292
293         http://groups.google.com/group/bup-list
294         
295 and you can subscribe by sending a message to:
296
297         bup-list+subscribe@googlegroups.com
298
299 Have fun,
300
301 Avery
302 January 2010