Requirements
- boot from any hard disk/PV
- boot when disks are missing
Prerequisites
mirroring over an arbitrary number of copies; RAID(n,n-1).
fault-tolerant mirroring.
- changes to GRUB2
Details
An LV is bootable, if it has a contiguous copy at the beginning of every PV marked as bootable. An LV is marked as bootable if the user requested that the LV be bootable. On a Linux system, usually /boot would be marked as bootable.
A PV is bootable if it has a contiguous copy of the bootable LV at its beginning. An PV is marked as bootable if the user requested that the PV be bootable. By default, the first PV on a disk drive that belongs to a VG is marked as bootable.
A VG is bootable if it has at least one bootable PV. A VG is marked as bootable if it has a LV marked as bootable.
LVM user space tools will try to ensure that every LV/PV marked as bootable becomes and remains bootable:
- On a PV marked as bootable, tools will not allocate space at the beginning (unless --force'd)
- When a PV is marked as bootable, tools will automatically create a degraded copy of the LV marked as bootable on it.
- When a LV is marked as bootable, tools will automatically create a degraded copy of it on every PV marked as bootable.
- When enough space at the beginning of a PV is deallocated (pvmove, lvdelete), tools will automatically create a degraded copy of the LV marked as bootable if it's missing.
- The hypothetic VG re-organiser (defrag) will automatically try to make room at the beginning.
- lvchange will refuse to enlarge a bootable LV if there's not enough room on every bootable PV.
Making a VG bootable could be done like this:
# lvcreate --boot y -L 100M -n boot acme … WARNING: Not enough room to make /dev/sda2 bootable. WARNING: Not enough room to make /dev/sdb1 bootable. WARNING: Not enough room to make /dev/sdc1 bootable. WARNING: Not enough room to make /dev/sdd1 bootable. WARNING: There are no bootable PVs in VG acme.
# pvs PV VG Fmt Attr PSize PFree /dev/sda2 lvm2 --B 200,00G 5,00G /dev/sdb1 lvm2 --B 100,00G 0,00G /dev/sdb2 lvm2 --- 100,00G 2,00G /dev/sdc1 lvm2 --B 200,00G 0,00G /dev/sdd1 lvm2 --B 100,00G 3,00G /dev/sdd2 lvm2 --- 100,00G 0,00G
(NB: B denotes marked as bootable but not bootable)
# pvmove --defrag --quick …
# pvs PV VG Fmt Attr PSize PFree /dev/sda2 lvm2 --b 200,00G 4,80G /dev/sdb1 lvm2 --b 100,00G 0,00G /dev/sdb2 lvm2 --- 100,00G 2,00G /dev/sdc1 lvm2 --b 200,00G 0,00G /dev/sdd1 lvm2 --b 100,00G 2,90G /dev/sdd2 lvm2 --- 100,00G 0,00G
(NB: b denotes bootable)
# mkfs … /dev/boot/acme # mount /dev/boot/acme /mnt # cp -av /boot /mnt # $EDITOR /dev/fstab # grub2-install /dev/boot/acme