Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Backups and snapshots [Was: Organising btrfs subvolumes]
Date: Tue, 27 May 2014 15:28:26
Message-Id: CAGfcS_kiU8KapA8SYUUi7C5quWuSvvb1QuUpHTF8Akduv1kzoA@mail.gmail.com
In Reply to: [gentoo-user] Backups and snapshots [Was: Organising btrfs subvolumes] by "J. Roeleveld"
1 On Tue, May 27, 2014 at 11:12 AM, J. Roeleveld <joost@××××××××.org> wrote:
2 > On Tuesday, May 27, 2014 10:31:26 AM Rich Freeman wrote:
3 >> btrfs wouldn't have any issues with this at all. You'd have an
4 >> advantage in that you wouldn't have to unmount the filesystem to
5 >> cleanly create the snapshot (which you have to do with lvm).
6 >
7 > That, or a "sync" prior to creating the snapshot. :)
8
9 If the filesystem is still mounted, I'm not sure that a sync is
10 guaranteed to give you a clean remount. It only flushes the
11 caches/etc. You need to remount read-only or unmount before doing the
12 sync (and the sync probably isn't actually necessary as I'd think LVM
13 would snapshot the contents of the cache as well).
14
15 > I have a yearly (full), monthly, weekly and daily. Each incremental is against
16 > the most recent one of itself or longer period.
17 > That means having to keep multiple snapshots active, which I prefer to avoid.
18
19 You only need to store snapshots for use with incremental backups.
20 So, if all your backups are full, then you don't need to retain any
21 snapshots (and you wouldn't use btrfs send anyway). If your yearly is
22 full and your monthlies are incremental against the yearly then you
23 need to keep your yearly snapshot for a year. If your yearly is full
24 and your monthlies are incremental against the last month, then you
25 only need to keep the yearly until the next monthly. If your
26 monthlies are full then you only need to keep the current monthly
27 assuming your dailies are incremental against those, but if they're
28 incremental from the last daily then you never need to keep anything
29 for more than a day.
30
31 >
32 > But, it is a good idea for backing up desktops and laptops.
33
34 It is really intended more for something like datacenter replication.
35 Snapshot every 5 min, send the data to the backup datacenter, delete
36 the snapshots upon confirmation of successful receipt. In such a
37 scenario you wouldn't retain the sent files but just keep playing them
38 against the replicate filesystem.
39
40 They'd be fine for backups as well, as long as you can store the
41 snapshots online until no longer needed for incrementals.
42
43 >
44 >> But, you can always just create a snapshot, write it to backup with
45 >> your favorite tool (it is just a directory tree), and then remove it
46 >> as soon as you're done with it. Creating a snapshot is atomic at the
47 >> filesystem level, though again if you want application level
48 >> consistency you need to deal with that until somebody comes up with a
49 >> transactional way to store files on Linux that is more elegant that
50 >> fsyncing on every write.
51 >
52 > That would require a method to keep database and filesystem perfectly in sync
53 > when they are not necessarily on the same machine.
54 >
55
56 Well, right now we can't even guarantee consistency when everything is
57 written by a single process on the same machine. The best we have is
58 a clunky fsync operation which kills the write cache and destroys
59 performance, and even that doesn't do anything if you have more than
60 one file that must be consistent.
61
62 The result is journals on top of journals as nobody can trust the next
63 layer down to do its job correctly.
64
65 Going across machines does complicate things further as there are more
66 failure modes that take out one part of the overall system but not
67 another. However, I'd like to think that an OS that natively supports
68 transactions could at least standardize things so that every layer
69 along the path isn't storing its own journal.
70
71 In fact, many of the optimizations possible with zfs and btrfs are due
72 to the fact that you eliminate all those layers.
73
74 Rich

Replies

Subject Author
Re: [gentoo-user] Backups and snapshots [Was: Organising btrfs subvolumes] Joost Roeleveld <joost@××××××××.org>