1

Is it possible to boot from a system where /boot is located within an lvm2 raid1 partition. I've tried a variety of configurations, but I have yet to discover how to do it.

I am using two 2TB disks. Each disk contains a GPT partition table with a 1MB bios_grub partition and a 2TB partition. The large 2TB partition on each disk is allocated as a physical volume to lvm2.

I am using Ubuntu 14.04 LTS as my OS. Initially I configured Ubuntu with two 5GB logical volumes. The first one for / and the second for /home. The Ubuntu setup did not have options to configure these logical volumes with a segment type of raid1. So, I just installed it with what it defaulted to, which was linear. This worked fine and the system booted without any issues.

I then rebooted into a live CD environment, and converted the two partitions into raid1 with the following commands.

lvconvert --type raid1 -m1 /dev/vg_storage/os_root
lvconvert --type raid1 -m1 /dev/vg_storage/os_home

These operations completed without any errors. I then monitored the progress of lvm2 mirroring both of these logical volumes until copy% was 100%

root@ubuntu:~# lvs
  LV          VG         Attr      LSize   Pool Origin Data%  Move Log Copy%  Convert
  os_home     vg_storage rwi-a-r--   4.66g                             100.00       
  os_root     vg_storage rwi-a-r--   4.66g                             100.00 

Now the system fails to boot. I get the following error immediately after BIOS attempts to boot from the first of the two disks. And I am left with a grub rescue prompt.

error: disk 'lvmid/L1VIor-PKIM-mtCO-TUQ2-iWe2-ndnY-df2wOu/yCDXMZ-2q4X-jbJJ-qZhI-sHNL-hrjw-Q5bg6v' not found.
Entering rescue mode...
grub rescue>

I'm thinking there is a grub2 module that isn't being loaded. One that supports the raid1 functionality of lvm2. Either that or such support does not yet exist within grub2.

0

Four years go by and...

yes, boot from mirrored LVM volume (lvconvert -m1 /dev/vg0/root) works for us in Debian 9 (stretch). GRUB lvm.mod module understands mirrored LVN volumes out of box, GRUB successfully reads /boot/grub/grub.cfg which resides on the mirrored root volume, presents the boot menu, loads the kernel and initrd. Then it gets stuck, unable to mount LVM root:

device-mapper: table: 254:5: raid: Failed to run raid array
device-mapper: reload ioctl on (254:5) failed: Invalid argument

This is solved by adding the following modules to /etc/initramfs-tools/modules (order matters), and running update-initramfs:

xor
async_tx
raid6_pq
async_xor
async_pq
async_memcpy
async_raid6_recov
md_mod
raid1
raid456
dm_raid
dm_log
dm_region_hash
dm_mirror
lvm

(probably one can leave out raid6_pq, async_raid6_recov, raid456 -- I cannot verify right now).

Now the mirrored LVM root should mount OK. The final step is to make both physical disks bootable, so should any one of them fail, the other will still boot the system:

pvdisplay -m | egrep 'PV Name|_rimage_'  # find out which physical disks root lv resides on
grub-install /dev/firstdisk
grub-install /dev/seconddisk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.