Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How to compress lots of tarballs
Date: Wed, 29 Sep 2021 23:17:59
Message-Id: CAGfcS_ma20+JVYU+4ExO1W8DjZGLrow0Qeaiswo-FvGe9YgL3g@mail.gmail.com
In Reply to: Re: [gentoo-user] How to compress lots of tarballs by Wols Lists
1 On Wed, Sep 29, 2021 at 5:48 PM Wols Lists <antlists@××××××××××××.uk> wrote:
2 >
3 > An LVM snapshot creates a "copy on write" image. I'm just beginning to
4 > dig into it myself, but I agree it's a bit confusing.
5
6 So, snapshots in general are a solution for making backups atomic.
7 That is, they allow a backup to look as if the entire backup was taken
8 in an instant.
9
10 The simplest way to accomplish that is via offline backups. Unmount
11 the drive, mount it read-only, then perform a backup. That guarantees
12 that nothing changes between the time the backup starts/stops. Of
13 course, it also can mean that for many hours you can't really use the
14 drive.
15
16 Snapshots let you cheat. They create two views of the drive - one
17 that can be used normally, and one which is a moment-in-time snapshot
18 of what the drive looked like. You backup the snapshot, and you can
19 use the regular drive.
20
21 With something like LVM you probably want to unmount the filesystem
22 before snapshotting it. Otherwise it is a bit like just pulling the
23 plug on the PC before doing an offline backup - the snapshot will be
24 in a dirty state with things in various state of modification. This
25 is because LVM knows nothing about your filesystem - when you run the
26 snapshot it just captures the state of every block on the disk in that
27 instant, which means dirty caches/etc (the filesystem caches or file
28 buffers wouldn't be covered, because those are above the LVM layer,
29 but caches below LVM would be covered, like the physical disk cache).
30
31 Some filesystems like btrfs and zfs also support snapshotting. Those
32 are much safer to snapshot while online, since the filesystem is aware
33 of everything going on. Of course even this will miss file buffers.
34 The cleanest way to snapshot anything is to ensure the filesystem is
35 quiescent. This need only be for a few seconds while snapshotting
36 though, and then you can go right back to using it.
37
38 If you do a full backup on a snapshot, then if you restore that backup
39 you'll get the contents of the filesystem at the moment the snapshot
40 was taken.
41
42 You can also use snapshots as a sort-of backup as well. Of course
43 those are on the same physical disk so it only protects you against
44 some types of failures. Often there is a way to serialize a snapshot,
45 perhaps incrementally - I know zfs and btrfs both allow this. This
46 can be a super-efficient way to create backup files since the
47 filesystem metadata can be used to determine exactly what blocks to
48 back up with perfect reliability. The downside of this is that you
49 can only restore to the same filesystem - it isn't a simple file-based
50 solution like with tar/etc.
51
52 So as to not do a second reply I want to address an earlier question,
53 regarding backups that span multiple volumes. This is a need I have,
54 and I haven't found a simple tool that does it well. I am VERY
55 interested in suggestions here. Tar I think can support something
56 like this, since it is common for tape backups to span multiple
57 volumes. I have no idea how clean that is. Most tools want you to
58 use LVM or a union filesystem or whatever to combine all the drives
59 into a single mountpoint and let linux manage the spanning. I'm using
60 bacula which can sort-of handle multiple volumes, but not very
61 cleanly, and it is an overly complex tool for backing up one system.
62 I wouldn't really endorse it wholeheartedly, but it can be made to
63 work.
64
65 --
66 Rich

Replies

Subject Author
Re: [gentoo-user] How to compress lots of tarballs antlists <antlists@××××××××××××.uk>