0

Or, perhap equivalently, can a bootable root volume be named other than "root"?

While installing a new version of a Linux IS I created an lvm2 logical volume named "ub20-root" intended as a bootable root with near success. I had a line in systemd-boot configuration file

options    root=/dev/mapper/crypt3--vg-ub20--root

(systemd-boot is an simpler to configure alternative to grub).

However, when trying to boot, an error message occurred stating that crypt3--vg-root couldn't be found. I renamed the volume from ub20-root to root, change the config line to

options    root=/dev/mapper/crypt3--vg-root

and it booted successfully.

I am unclear as to whether the constraint to name the volume root originates from systemd-boot or elsewhere. However, perusing various examples of creating lvm2 bootable root volumes, they are all named root, even though grub is the standard boot manager.

Another possibly equivalent question is - Is there a way to have multiple bootable root volumes on a single volume group? If not, why not?

1
1

I'm not sure about systemd-boot, but grub works with any name. Naming / lv root is just a "best practice" to make it clear what the lv contains. I have a system with root lv named 00 and swap lv 01 and it works just fine.

$ cat /proc/cmdline 
BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.8.6-301.fc33.x86_64 root=/dev/mapper/fedora-00 ro resume=/dev/mapper/fedora-01 rd.lvm.lv=fedora/00 rd.lvm.lv=fedora/01 rhgb quiet

It is possible systemd-boot is confused because there is a dash in the name. Dash is usually used as a divider between vg and lv name, but that is just a wild guess.

You can have multiple systems in the same vg, but there would be problem with booting -- /boot can't be placed on an lv, but it might be possible with a shared /boot/efi (I'm not sure, I'm not very familiar with booting on EFI systems). But the lv names should be the problem in this setup.

1
  • You answered my question - grub allows a BOOT_IMAGE lvm volume not named root. However, just clear up a misunderstanding, I am not asking about /boot, the boot manager, or the boot loader, being on an lvm volume - I was only asking about the name of a bootable volume with a linux OS root on on it (and you answered that question.) – Craig Hicks Oct 12 '20 at 20:00
1

/boot partition cannot be an LVM devices is because when the system boots, it first searches for /boot/vmlinuz, and at this time, lvm cannot be recognized because there is no module for lvm loaded at this time. So, the /boot partition can not be a lvm partition.

However it can be done, but not recommended as it is described in the link I provided in the comment.

I never tried this, but you can read: BOOTING LINUX FROM LVM VOLUMES

Grub2 can handle boot on lvm.

The name of the volume group does not matter.

All you have to do is to create physical volume, volume group and logical volumes. It does not matter how the volume group will be called it can be root-vg or centos-vg, rhel-vg.

See this tutorial, to learn: LFCS: How to Manage and Create LVM Using vgcreate, lvcreate and lvextend Commands

I do not know can many logical volumes be bootable. I suppose not. but have no knowledge to answer this question.

1
  • "Grub2 can handle boot on lvm. The name of the volume group does not matter." - great, and thanks for answering my question. The selected answer also answered the question, but came in just a little but earlier, so I selected that one, all else being equal. – Craig Hicks Oct 12 '20 at 20:05

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.