Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] resizing EFI partition, btrfs context
Date: Tue, 06 Oct 2015 12:32:38
Message-Id: CAGfcS_mds-j9wnxFXWt=g_cSaeZbcY8i8hGUgriCxT+_tvKcAA@mail.gmail.com
In Reply to: Re: [gentoo-user] resizing EFI partition, btrfs context by "Stefan G. Weichinger"
1 On Tue, Oct 6, 2015 at 3:52 AM, Stefan G. Weichinger <lists@×××××.at> wrote:
2 > Am 2015-10-06 um 09:45 schrieb Neil Bothwick:
3 >> On Tue, 6 Oct 2015 09:35:40 +0200, Stefan G. Weichinger wrote:
4 >>
5 >>>> How about btrfs send/receive? I've never used them but used
6 >>>> the equivalent with ZFS and it was simple to do.
7 >>>
8 >>> I think "btrfs-replace" is my friend. Will try that later.
9 >>
10 >> If you want to keep the system live, replace will do the trick, but
11 >> when I tried it to replace a drive that was showing SMART errors it
12 >> was VERY slow. btrfs send serialises your whole filesystem to a
13 >> file so it should be much faster.
14 >
15 > btrfs send would also have the benefit that I won't lose the
16 > source-dev in the process. btrfs-replace would "empty" my hdd, if then
17 > things fail I don't have that backup again to start from.
18 >
19 > I just have to find out how to keep the UUID to keep the copy booting etc
20 >
21 > I will try that later this day, after some job work.
22 >
23
24 I doubt send/receive would preserve the UUID.
25
26 I'd probably use btrfs-replace.
27
28 If you do want to keep the same UUID via any mechanism make sure the
29 original drive isn't visible or btrfs may try to use it instead of the
30 new one. That is more of a concern in raid configs, but it might
31 apply to single volume. Btrfs can't tell the difference between the
32 active volume you unmounted yesterday and the lvm snapshot of it from
33 six months ago, and will potentially try to mix-and-match them
34 resulting in carnage.
35
36 Btrfs does support resizing if you just want to shrink the filesystem
37 and then dd it over to the new partition. Just make sure the old one
38 isn't attached when you try to mount it. Just shrink your btrfs
39 partition down to a size smaller than where it is going, use dd to
40 copy it, then you can run btrfs resize to expand it back to the full
41 size. The syntax is slightly different but it works the same as
42 resize2fs, and I believe it works either online or offline.
43
44 However, if you're able to figure out how to use btrfs and migrate it
45 from one drive to another, you could probably just edit the UUID in
46 your grub config if necessary. It just takes a text editor, and maybe
47 a run of grub2-mkconfig if you're using that. You'll also want to
48 update your fstab, and if you're using dracut you should update that
49 as well (as long as it gets a decent UUID from the command line I
50 think it will figure things out on its own though - dracut saves a
51 copy of your fstab to help find things when you build it but then it
52 will remount filesystems using the real fstab before it finishes).
53
54 --
55 Rich

Replies

Subject Author
Re: [gentoo-user] resizing EFI partition, btrfs context "Stefan G. Weichinger" <lists@×××××.at>