Gentoo Archives: gentoo-user

From: Wol <antlists@××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] LVM and moving things around
Date: Sun, 03 Apr 2022 19:33:42
Message-Id: ad4b07d7-a576-2f8e-be13-1da5c4222dfb@youngman.org.uk
In Reply to: Re: [gentoo-user] LVM and moving things around by Frank Steinmetzger
1 On 03/04/2022 19:37, Frank Steinmetzger wrote:
2 > Am Sun, Apr 03, 2022 at 05:05:07PM +0100 schrieb Wol:
3 >
4 >>>>> Rsync has a bwlimit argument which helps here. Note that rsync copies
5 >>>>> the whole file on what it considers local storage (which can be mounted
6 >>>>> network shares) ... this can cause a real slowdown.
7 >>>> It won't help on the initial copy, but look at the - I think it is -
8 >>>> --in-place option.
9 >>
10 >>> This one is mostly useful if space on the destination is tight or the data
11 >>> link (for FS commands) is slooow, because normally rsync creates a new temp
12 >>> file and moves it into place once the transfer is complete.
13 >
14 >> And making a temporary file may be exactly what you DON'T want. I make heavy
15 >> use of hard links,
16 >
17 > … which the -H option is for.
18 >
19 >> and "make a temp file" absolutely buggers file system integrity ...
20 >
21 > Can you elaborate? A temp file is just like any other file. If you do
22 > in-place syncing, then it “buggers up” the original file instead of a temp.
23
24 "Make a temp file" breaks hard links. My file system is full of them,
25 and keeping track of hard links can easily bring a system to its knees
26 (it brought a previous system of mine to its knees :-)
27
28 >
29 >> And my use case with LVM and backups, "make a temp file" does both
30 >> absolutely nothing to protect file system integrity
31 >
32 > I was not actually talking about file *system* integrity, but that if you
33 > overwrite in-place and the connection is lost during transfer, you are left
34 > with an incomplete file. Hence you just lost data on the destination. The FS
35 > itself is not adversely affected by that, only the file.
36
37 If the link is lost (unlikely on my system where both drives are on the
38 same system) you just start again ... and you haven't actually lost any
39 data, you've just got a corrupt copy to recover.
40 >
41 >> and makes every backup waste far more space than is necessary ...
42 >
43 > How so? If it’s a COW filesystem, I can understand it (insofar as if you do
44 > in-place, then the existing file is deleted first, which gives the FS more
45 > space for the new copy).
46 >
47 An LVM snapshot *IS* a COW filesystem. And no, --in-place doesn't delete
48 the original, it just overwrites the bits that have changed.
49
50 So my backups, all the identical data is de-duplicated. I have two
51 separate filesystems I can mount, each of which is a full backup, but
52 they only take up disk space for "one and a bit".
53
54 >> So --in-place actually has a lot of uses outside your two examples. I have
55 >> oodles of space, and both my source and target are on fast sata links in the
56 >> same computer, but not using --in-place would be *very* costly for me.
57 >
58 > Well I admit I don’t know much outside of my realm of local disks with ext4,
59 > zfs and ssh. While I do run LVM on my laptop, it’s just so that I can have
60 > “partitions” on an otherwise fully encrypted block device. I never used any
61 > of its more fancy features.
62 >
63 Read up on it. Especially if you're running linux, snapshotting root is
64 a very good idea. I always snapshot root on a friday evening then do my
65 emerge, and while it's never happened, if it all goes pear-shaped I can
66 mount my backup and go back to where I was. And if you're doing anything
67 at all dangerous, snapshotting will protect your "pre" state.
68
69 (I only know how to make a snapshot, I've never really investigated
70 rolling back, but it's nice knowing it's an option :-)
71
72 Cheers,
73 Wol