Make-initrd development discussion
 help / color / mirror / Atom feed
From: Alexey Gladkov <gladkov.alexey@gmail.com>
To: make-initrd@lists.altlinux.org
Subject: Re: [make-initrd] I: pipeline feature
Date: Sat, 20 Feb 2021 12:33:54 +0100
Message-ID: <20210220113354.rkip37y5vrcrjkmr@example.org> (raw)
In-Reply-To: <3df000f0-0021-6c5f-a3f4-2663212be91b@gmail.com>

On Sat, Feb 20, 2021 at 02:05:01PM +0300, Leonid Krivoshein wrote:
> 
> 20.02.2021 13:31, Alexey Gladkov пишет:
> > On Sat, Feb 20, 2021 at 12:58:03PM +0300, Leonid Krivoshein wrote:
> > > 19.02.2021 13:49, Alexey Gladkov пишет:
> > > > [...]
> > > > > Поэтому я и предложил затягивать в initramfs один из двух файлов:
> > > > > 
> > > > > /etc/mdadm-initrd.conf (если есть, то его)
> > > > > /etc/mdadm.conf (fallback)
> > > > Как быстрое решение это может сработать. Нужно только удостовериться, что
> > > > это решит упомянутые в треде баги.
> > > Да, решило: https://bugzilla.altlinux.org/show_bug.cgi?id=39695#c9
> > > 
> > > Причём, что удивительно, там хоть нет и нет inactive, но есть resync после
> > > ребута, значит какие-то костылики udev-rules уже работают во второй стадии.
> > Есть подозрение, что для создания mdadm.conf достаточно:
> > 
> > mddev=$(findmnt -n -o SOURCE "$mountpoint")
> > mdadm --verbose --detail --scan "$mddev" > mdadm.conf
> 
> Видимо тут опечатка:
> 
> ... >> mdadm.conf

Нет. Это будет весь конфиг.

Посмотрев на вывод mdadm, я бы ещё чуть-чуть отредактировал вывод.

mdadm --verbose --detail --scan "$mddev" |
	tr '\n' ' ' |
	sed -r \
		-e 's/^(.*[[:space:]])devices=[^[:space:]]+([[:space:]].*)$/\1\2/' \
		-e 's/^(.*[[:space:]])name=\(none\):[^[:space:]]+([[:space:]].*)$/\1\2/'

В devices указываются файлы устройств, что не очень хорошо. Можно также
добавить первой строчкой:

echo 'DEVICE partitions'

> > Можно придумать такую последовательность:
> > 
> > 1. Если есть /etc/mdadm-initrd.conf, то берём его.
> > 2. Если в /etc/mdadm.conf только один ARRAY, то можно брать его.
> > 3. Если ARRAY в /etc/mdadm.conf больше одного, то генерируем свой.
> 
> Разумный алгоритм! Вопрос лишь в том, как в п.3 выбрать нужный массив.

Выбрать как раз совсем не сложно. Мы же определяем, что нашли raid в
цепочке [1]. В "$SYSFS_PATH$1"/dev есть major:minor устройства. Далее
можно просто посмотреть findmnt -n -o MAJ:MIN,SOURCE и найти устройство,
если не хочется делать mknod. А далее будет работать уже указанный код.

> > или же можно просто пропустить второй шаг и если нет mdadm-initrd.conf, то
> > сразу генерировать конфиг.
> 
> Как я понимаю, сейчас не для всех MOUNTPOINTS дотягиваются нужные модули в
> initramfs, это уже другой баг с /boot.

Для всех [2]. Иначе в MOUNTPOINTS не было бы никакого смысла. Вот только
никто не просил make-initrd искать модули рейда для /boot.

Я пока не сделал тест и не могу с уверенностью утверждать, но мне кажется,
что mdadm и его udev-правила как-то учитывают, описанный в mdadm.conf
/boot.

[1] https://github.com/osboot/make-initrd/blob/master/features/mdadm/guess/device
[2] https://github.com/osboot/make-initrd/blob/master/guess/root/action#L180

-- 
Rgrds, legion



  reply	other threads:[~2021-02-20 11:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 11:40 Alexey Gladkov
2020-05-08 14:20 ` Michael Shigorin
2020-05-08 14:43   ` Alexey Gladkov
2020-05-09 13:08 ` Leonid Krivoshein
2020-05-09 14:28   ` Alexey Gladkov
2020-05-10 16:04   ` Alexey Gladkov
2020-05-21 13:36 ` Alexey Gladkov
2021-02-18 16:55   ` Leonid Krivoshein
2021-02-18 17:38     ` Alexey Gladkov
2021-02-18 18:18       ` Leonid Krivoshein
2021-02-18 19:37         ` Alexey Gladkov
2021-02-18 20:29           ` Leonid Krivoshein
2021-02-19 10:49             ` Alexey Gladkov
2021-02-19 13:40               ` Leonid Krivoshein
2021-02-20  9:58               ` Leonid Krivoshein
2021-02-20 10:31                 ` Alexey Gladkov
2021-02-20 11:05                   ` Leonid Krivoshein
2021-02-20 11:33                     ` Alexey Gladkov [this message]
2021-02-20 14:29                   ` Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210220113354.rkip37y5vrcrjkmr@example.org \
    --to=gladkov.alexey@gmail.com \
    --cc=make-initrd@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Make-initrd development discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/make-initrd/0 make-initrd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 make-initrd make-initrd/ http://lore.altlinux.org/make-initrd \
		make-initrd@lists.altlinux.org make-initrd@lists.altlinux.ru make-initrd@lists.altlinux.com
	public-inbox-index make-initrd

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.make-initrd


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git