Ubuntu Server 24.04.1 LTS
При установке Ubuntu Server выбрал вариант с LVM разделом.
sda1:MBR
sda2:boot/efi
sda3:корень/LVM
Решил попробовать режим зеркала "lvconvert -m 1 ubuntu-vg/ubuntu-lv". Добавил второй раздел с другого диска и зеркало успешно создалось, ОС загружается в штатном режиме.
Далее сэмулировал потерю диска- выключил ПК, отключил физически второй диск и запустил снова.
Ожидал загрузки ОС и статуса отсутствия части зеркала.
Получил, что при загрузке ОС вываливается в initramfs c криками mdadm, что массивы не найдены и /dev/mapper/ubuntu--vg-ubuntu-lv отсутствует.
Если набрать в initramfs> exit, то все повторяется- снова вываливается в initramfs с алертом /dev/mapper/ubuntu--vg-ubuntu-lv отсутствует.
Если в initramfs набрать lvm, в lvm>vgchange -ay, то раздел LVM ubuntu-vg/ubuntu-lv активируется и при выходе из initramfs происходит дальнейшая загрузка ОС в штатном режиме и да, в статусе LVM раздела появляется информация об отсутствии части раздела.
Подскажите, как сделать, что бы при загрузке ОС не вываливалась в initramfs, а продолжала загружаться без части зеркала?
Пользователь добавил сообщение 03 Декабря 2024, 15:39:33:
Нашел конфиг, вероятно это именно то, что нужно, но еще не пробовал.
Activating an LV with missing devices
A RAID LV that is missing devices may be activated or not, depending on the "ac‐
tivation mode" used in lvchange:
lvchange -ay --activationmode complete|degraded|partial LV
complete
The LV is only activated if all devices are present.
degraded
The LV is activated with missing devices if the RAID level can tolerate
the number of missing devices without LV data loss.
partial
The LV is always activated, even if portions of the LV data are missing
because of the missing device(s). This should only be used to perform
extreme recovery or repair operations.
Default activation mode when not specified by the command:
lvm.conf(5) activation/activation_mode
The default value is printed by:
# lvmconfig --type default activation/activation_mode
Пользователь добавил сообщение 03 Декабря 2024, 20:42:14:
Может конфиг что-то и регулирует, но в моем случае не помогло.
Помогла принудительная активация разделов через скрипт (нашел в инете).
Ubuntu's LVM autodetect didn't work at all for me either. To fix it, I made a script in
/etc/initramfs-tools/scripts/local-top/forcelvm
with the following contents:
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
. /scripts/functions
# Begin real processing below this line
# This was necessary because ubuntu's LVM autodetect is completely broken. This
# is the only line they needed in their script. It makes no sense.
# How was this so hard for you to do, Ubuntu?!?!?
lvm vgchange -ay
Then did
# chmod +x `/etc/initramfs-tools/scripts/local-top/forcelvm`
for good measure and
# update-initramfs -u -k all
That fixed everything, while persisting after a system update.