Gentoo Archives: gentoo-user

From: Michael Hampicke <gentoo-user@××××.biz>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] backing up system files
Date: Mon, 03 Dec 2012 08:41:22
Message-Id: 50BC654A.2070802@hadt.biz
In Reply to: [gentoo-user] backing up system files by Philip Webb
1 Am 02.12.2012 21:29, schrieb Philip Webb:
2 > My recently-built machine has an SSD for everyday storage
3 > + an HDD for less often used stuff + back-ups (in dir /y ).
4 > To avoid having to re-install the system if the SSD collapses one day,
5 > I wanted to make a simple back-up copy of vital files on the HDD.
6 > There are lots of apps in 'app-backup' & I looked at 3
7 > -- Backintime, Luckybackup, Kbackup -- , which did the job,
8 > tho' configuring them took a bit of concentration.
9 > I also wrote a simple Bash script, which also does the job very well
10 > & which has caused me to remove the GUI apps & use it instead;
11 > it uses 2 exclude files & the code is below (from /usr/local/bin/ ).
12 >
13 > root:510 bin> cat bsys
14 > #!/bin/bash
15 > mount /dev/sdb8 /y
16 > rsync -av /bin /y/bkp-sys
17 > rsync -av /etc /y/bkp-sys
18 > rsync -av /lib32 /y/bkp-sys
19 > rsync -av /lib64 /y/bkp-sys
20 > rsync -av /opt /y/bkp-sys
21 > rsync -av /root /y/bkp-sys
22 > rsync -av /sbin /y/bkp-sys
23 > rsync -av /usr --exclude-from '/usr/local/bin/bsys-usrx' /y/bkp-sys
24 > rsync -av /var --exclude-from '/usr/local/bin/bsys-varx' /y/bkp-sys
25 > umount /y
26 > echo "done"
27 >
28 > root:508 bin> cat bsys-usrx
29 > # bsys-usrx : 121116 -- files to exclude from /usr
30 > local/
31 > portage/
32 > src/
33 >
34 > root:509 bin> cat bsys-varx
35 > # bsys-varx : 121116 -- files to exclude from /var
36 > empty/
37 > log/emerge-logs/
38 > tmp/
39 >
40 > HTH others.
41 >
42
43 How about:
44
45 work ~ # cat backup.sh
46 #!/bin/bash
47
48 mount /dev/sdb8 /y
49 rsync -av /bin /etc /lib32 /lib64 /opt /root /sbin /usr /var /y/bkp-sys/ \
50 --exclude-from 'exclude'
51
52 umount /y
53 echo "done"
54
55
56 work ~ # cat exclude
57 /usr/local/
58 /usr/portage/
59 /usr/src/
60 /var/empty/
61 /var/log/emerge-logs/
62 /var/tmp/
63
64 You can rsync multiple directories, just put dem down there one after
65 another, the last on is the target.
66
67 You should also consider setting the --delete flag (deletes file in
68 backup when deleted on your root filesystem and --delete-excluded which
69 will delete the files you have excluded in your backup.
70
71 I also exclude /var/cache and /var/run