Re: CopyBlocks= from initrd systemd-repart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fr, 23.08.24 16:28, Renjaya Raga Zenta (ragazenta@xxxxxxxxx) wrote:

> Hi,
>
> I want to duplicate partition 1 and partition 2 using systemd-repart.
> This is for SBC, I use mkosi to create the OS image.
>
> By default, it needs 2 partitions
>
> 1. Boot partition: FAT32 used by 1st stage bootloader
> 2. Root partition: EXT4
>
> This works fine.
>
> Then I want to create "recovery mode", it needs 4 partition
>
> 1. Default Boot partition
> 2. Default Root partition
> 3. Secondary Boot partition
> 4. Secondary Root partition
>
> Partition [3] should be copied from partition [1] and partition [4] should
> be copied from partition [2].
>
> I've configured the systemd-repart to run in initrd, I've also configured
> udev rules to create symlink to device node:
>
> 1. /dev/gpt-part-boot -> /dev/nvme0n1p1
> 2. /dev/gpt-part-root -> /dev/nvme0n1p2 (mounted on /sysroot,
> systemd-repart need this path because it's hardcoded in the source code)
>
> But when I specify CopyBlocks=/dev/gpt-part-boot in the repart.d conf file,
> it failed with this error message:
> "Failed to open '/dev/gpt-part-boot': No such file or directory"
>
> The systemd-repart failed in initrd, but then it will run again after
> switch-root, and it works fine.
>
> Any hints? I want the systemd-repart to run fine in initrd, not after
> switch-root.

Hmm, so far this usecase hasn't come up. I mean, why make a
byte-by-byte copy of the first partitions? That sounds redundant, no?

I mean, creating the 2nd partition at boot makes sensse, but as an exact copy
of the first one? The goal of having A/B stuff is of course to have
*different* versions of the OS in there, not the same!

Hence, if you copy the OS in there you are doing a lot of busywork at
boot, for nothing really?

or in other words: the contents of the 2nd partition set should be
initialized at the moment you update to the next version, not already
on first boot.

What am I not getting?

(That said, there's a PR somewhere to add a set of symlinks which
allows referenceing additional partitions on the soon-to-be-root disk
via symlinks, but it hasn't been merged yet. With that you should be
able to do this, as long as you have something indicating the root
disk, i.e. ESP efi var or so)

Lennart

--
Lennart Poettering, Berlin



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux