Gentoo Archives: gentoo-user

From: Alex Schuster <wonko@×××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] backup to a cold-swap drive
Date: Tue, 04 May 2010 14:01:38
Message-Id: 201005041511.20344.wonko@wonkology.org
In Reply to: Re: [gentoo-user] backup to a cold-swap drive by Iain Buchanan
1 Iain Buchanan writes:
2
3 > On Thu, 2010-04-29 at 16:44 +0200, Alex Schuster wrote:
4 >
5 > [snip]
6 >
7 > > All my partitions are LVM volumes, so before the backup starts, I
8 > > make a LVM snapshot of the partition. This way I can modify it while
9 > > the backup is still in progress.
10 >
11 > hmm, never got into LVM. Sounds interesting though...
12
13 It is. it gives you great flexibility. Your /home is becoming too small?
14 So just add a Gigabyte:
15 lvresize -L +1G /dev/system/home
16 resize2fs /dev/system/home
17
18 Takes half a minute, and you don't need to unmount anything before that.
19
20 You want to backup your large /home partition, and want to continue
21 working meanwhile? Create a snapshot, mount it, and backup this:
22 lvcreate -s -L 1G -n home-snapshot /dev/system/home
23 mount /dev/system/home-snapshot /mnt
24
25
26 > [snip]
27 >
28 > > I wrote a shell script to do this, so I do not have to issue a lot of
29 > > commands every time I want to do the backup.
30 >
31 > I don't use too many commands, something like this
32 > in /etc/cron.daily/custom-backup:
33 >
34 > sudo /usr/bin/ionice -c 3 /usr/bin/rsync -aAx --exclude suspend_file
35 > --delete-delay --delete-excluded --partial
36 > --human-readable / /<unique-mount-of-external-drive> || echo external
37 > backup failed!
38
39 That's okay, I did it in this way, too. Well, the backup may be
40 inconsistent when you are modifying the root partition in the meantime, so
41 I would not emerge things when the backup is running.
42 But now I am using LVM for everything, and so I just create a snapshot.
43 And I prefer to use rdiff-backup, so I can have incremental backups.
44
45 > > As there are now some others
46 > > using this script, adapted to their needs, I started to rewrite it in
47 > > a way that it reads a config file, and no modification of the script
48 > > itself is necessary. If anyone is interested, send me an email.
49 >
50 > interested! So is it on sourceforge yet ;)
51
52 Um, no... not yet. Not really sure if it belongs there...
53
54 The script has become a little large, but I think it's working now. I will
55 do some testing, and inform you when it's done. I'm a little ill at the
56 moment, so it may take 1-2 more days.
57
58 Wonko