C
C
Cyril2019-08-28 07:36:57
linux
Cyril, 2019-08-28 07:36:57

Should I push the /boot and swap partition into LVM?

Modern Grub supports booting from LVM volumes. I decided to create a software RAID 1 with only two HDDs. I decided to use LVM over software RAID.
Can the partition for /boot and the swap file be placed on an LVM logical volume? Old versions of Grub don't know how to work with LVM, but the new one does.
Is there any reason? First, I created the partition for /boot and the swp file outside of the RAID array, just like normal partitions. On one HDD, and on another HDD.
But when I decided to simulate the failure of one of the HDDs (I did it on a VMware virtual machine) by removing the first HDD, Ubuntu Server could not boot. But if you remove the second HDD, it boots normally.
After installing Ubuntu Server, everything was done as expected:
1. I copied the /boot partition from one HDD to the second HDD:
dd if=/dev/sda1 of=/dev/sdb1
2. Installed Grub on the second HDD:
grub-install /dev/sdb
As a guide, I used this article on creating a software RAID 1.
Please tell me how to correctly create a software RAID 1 on Ubuntu Server 18 so that when any disk failure is simulated, the system will boot. Maybe something was missed in the article? So far, I'm doing everything in VMware Workstation

Answer the question

In order to leave comments, you need to log in

5 answer(s)
R
Ronald McDonald, 2019-08-28
@Zoominger

It would be correct to create an array mdadm.

S
Saboteur, 2019-08-28
@saboteur_kiev

I would not transfer boot to LVM. The main convenience of LVM is a convenient expansion / change of devices online. For a boot partition, this is not critical; it is usually not required to expand it. In general, I would leave the entire OS on a regular raid, and only put /opt or /var/lib/
SWAP into LVM, yes, it is quite possible to do it in LVM.

Y
yogire, 2019-08-29
@yogire

In order for the system to boot from the second disk, you must copy the bootloader from the MBR to it.
MBR (Master Boot Record) is the first 512 bytes of the device, of which 446 bytes is the bootloader (which needs to be copied), and the rest is the partition table.
# Copy bootloader
dd if=/dev/sda of=/dev/sdb bs=446 count=1
As far as /boot and swap are concerned, I think it makes sense to put them on mdraid.
swap so that the system does not "fall" when a disk fails, and /boot to automatically keep it up to date on the second disk. I can't think of a good reason for or against putting them in LVM.

R
Ruslan, 2019-08-28
@Dvlbug

If /boot is on different disks, then you should specify Raid's UUID (for example, md0p1 for boot), at the same time check mdadm if it does not start because it is in the Degraded state

D
DesktopWarrior, 2019-08-29
@DesktopWarrior

If we are talking about Debian / Ubuntu, because they have support for booting from Booth, which is present in the lvm. In rhel centos flatly refuses to accept this hornbeam functionality. However, as in Fedora. Creates a mirror raid1 from two screws. Further, on top of this raid, an lvm volume is made for the entire size. Well, TD lvm volume, volume group. The main thing is to check the box that the lvm volume is bootable, i.e. has a boot flag. About rekoveri ... in rekoveri, both lvm and volumes are seen there. You just need to activate the volume group vgchange -ay before that. There are a lot of manuals about the restoration of the mdraid .... first you need to transfer it to the degraded if the smart screw writes that it is a khan ... well, or just then remove this disk from the already degraded mdraid. About the fact that it is reliable - I use it always and everywhere already probably with debian7 and Ubuntu 10.04. All OK. It's already stable and reliable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question