Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] What utility do you use to sync user files?
Date: Sun, 02 Dec 2012 20:26:04
Message-Id: 20121202222105.42091cd4@khamul.example.com
In Reply to: [gentoo-user] What utility do you use to sync user files? by Randy Westlund
1 As soon as you said "svn" I got the idea you want revisions of files
2 you send to storage, which is a fine idea. Backups are fine, but if you
3 have to work at the granularity of "yesterday or maybe the day before"
4 it can become cumbersome.
5
6 To my mind the first question to answer is how do you want to commit
7 these files to a revision control system. This determines what you do
8 next.
9
10 If you want it file-by-file, then getting a single file is a
11 simple svn checkout, but rolling everything back to yesterday (eg for
12 when you accidentally did an rm on .kde or .mail) will be tricky. To do
13 this, commit the files to remote svn and just put up with the hassles
14 of the binary files. Yes, I know binary in SVN is amazingly evil and
15 makes the worst ever out of Redmond look like child's play, but
16 sometimes you have no choice... Or use a revision control system that
17 can deal with binaries OK. All depends on what *you* need stuff to do.
18
19 If you are happy committing an entire Makefile run and are OK to work
20 with that, then you use an FS (or LVM) that can do snapshots, and make
21 one as the last command in your Makefile. Restores are a case of mount
22 the snapshot, find the file of interest and do what you need with it.
23
24 It really comes down to the old story of "precisely define first
25 what exactly you want to achieve" and then the tools to do that often
26 present themselves.
27
28
29 On Sun, 2 Dec 2012 12:21:40 -0500
30 Randy Westlund <rwestlun@×××××.com> wrote:
31
32 > I've been using rsync to sync binary files, shell scripts, my
33 > workspace, and random user files under my home directory across
34 > multiple machines. I'm using one server as the master copy, which
35 > makes daily incremental backups of my files to a separate disk with
36 > rsync. At the moment, I have my sync script set up as a Makefile with
37 > the following targets. I run this from multiple workstations.
38 >
39 > It would be nice to use something as easy as svn, but many of my files
40 > are binary. Or something like dropbox would be great. I don't work
41 > from windows, so I don't need a cross-platform solution.
42 >
43 > What utilities do you guys use? Is there a better way to do this? It
44 > would be nice to move everything to the background, but I've already
45 > clobbered a few files by calling this in the wrong order and might
46 > move the Makefile to an interactive script to protect against that. I
47 > have to call 'make clobber' after I remove a local file to push that
48 > change to the server, and if I forgot to call 'make get' first, I have
49 > to fix it manually.
50 >
51 > -------sync makefile--------
52 > get:
53 > rsync -azOuvihh --progress -e ssh $(EXCLUDE) \
54 > --delete \
55 > $(HOST):$(SERVER_DIR) $(LOCAL_DIR)
56 >
57 > put:
58 > rsync -azOuvihh --progress -e ssh $(EXCLUDE) \
59 > $(LOCAL_DIR) $(HOST):$(SERVER_DIR)
60 >
61 > clobber:
62 > rsync -azOuvihh --progress -e ssh $(EXCLUDE) \
63 > --delete \
64 > $(LOCAL_DIR) $(HOST):$(SERVER_DIR)
65 > ------end-------
66 >
67 > -------backup script--------
68 > # if files are already there, hard link
69 > # the last lines mark it as complete and move a soft link pointer
70 > rsync -zavi --progress --delete \
71 > --link-dest=$BACKUP_PATH/current \
72 > $SOURCE $BACKUP_PATH/backup_part_$DATE \
73 > && mv $BACKUP_PATH/backup_part_$DATE $BACKUP_PATH/backup_$DATE \
74 > && unlink $BACKUP_PATH/current \
75 > && ln -s $BACKUP_PATH/backup_$DATE $BACKUP_PATH/current
76 > -------end---------
77 >
78 > Randy
79 >
80
81
82
83 --
84 Alan McKinnon
85 alan.mckinnon@×××××.com