Grub and LVM on a RAID1

Help with issues regarding installation of Debian

Grub and LVM on a RAID1

Postby rollopack » 2018-03-15 06:35

Hi, I have a server with LVM on a RAID1, but the installation of grub gives me the following message:

Code: Select all
Installation for the i386-pc platform.
grub-install: warning: this GPT partition label does not contain BIOS Boot Partition, embed is not possible.
grub-install: error: The embed is not possible, but is required for installation on RAID and LVM


df
Code: Select all
File system                  Tipo      Dim. Usati Dispon. Uso% Montato su
udev                         devtmpfs  4,2G     0    4,2G   0% /dev
tmpfs                        tmpfs     833M   88M    746M  11% /run
/dev/mapper/server--vg-root  ext4       30G  1,6G     27G   6% /
/dev/md0p1                   ext2      247M   39M    196M  17% /boot
/dev/mapper/server--vg-home  ext4      2,0T   53G    1,8T   3% /home


fdisk -l /dev/sda
Code: Select all
Disk /dev/sda: 1,8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: F0410B1C-0E86-400A-8465-EF0919E1D2D3

Device     Start        End    Sectors  Size Type
/dev/sda1   2048 3907028991 3907026944  1,8T Linux RAID

fdisk -l /dev/md0
Code: Select all
Disk /dev/md0: 1,8 TiB, 2000263577600 bytes, 3906764800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x3ac62615

Device     Boot  Start        End    Sectors  Size Id Type
/dev/md0p1        2048     499711     497664  243M 83 Linux
/dev/md0p2      501758 3906762751 3906260994  1,8T  5 Extended
/dev/md0p5      501760 3906762751 3906260992  1,8T 8e Linux LVM


I read in some forums that the partition flag should not be "Linux RAID" but "bios_grub" and fix it with parted, but I see that other servers I have with the same configuration have a "Linux raid autodetect" flag with DOS disklabel. ..

Currently the system is up and running, but I am afraid to restart the machine :(

Looking at the installation logs I see that already there the installation on sda and sdb had failed, can the bios be able to boot by accessing the partition / boot directly?
rollopack
 
Posts: 2
Joined: 2018-03-15 06:31

Re: Grub and LVM on a RAID1

Postby p.H » 2018-03-15 08:03

Do not set the bios_grub "flag" or "BIOS boot" type on any partition containing data or grub-install will overwrite it.

It appears that /dev/md0 is a partitioned RAID array, which is rather unusual (and quite useless with LVM). IME the Debian installer disk manager (partman) does not allow to create a partition table on a RAID array (but can use an existing one), so you have to create it by hand. And /boot is in a partition on the RAID array.

GRUB BIOS (grub-pc) allows 3 possible locations for its core image when the boot image is installed in the MBR :
- in the unallocated space between the MBR and the first physical partition if the disk format (disklabel) is MSDOS
- in a dedicated unformatted partition of type "BIOS boot" if the disk format is GPT
- as a last resort if the above (called "embedding") is not possible (insufficient space or no BIOS boot partition), in the file /boot/grub/i386-pc/core.img if it is on a plain partition of the same disk as the boot image with a supported filesystem type such as extN.

Here, /dev/sda has a GPT partition table (disklabel) but no BIOS boot partition, so embedding is not possible. Also /boot/grub is not in a plain partition of /dev/sda but is in a RAID array, so installing the core image as a file is not possible either.

Available options :
- Create a BIOS boot partition. Its size need not to be bigger than 100 Ko (yes, kilobytes) and it does not need to be aligned, so it can fit in any tiny unallocated space. I usually use the space between the primary GPT partition table and the first physical partition, which is a bit less than 1 MB.
- Convert the partition table on /dev/sda to MSDOS with gdisk if you do not use PARTLABEL or PARTUUID (you know if you do ; if you don't know, you don't). GPT is not required as the disk has only one partition and its size is less than 2 TiB.
p.H
 
Posts: 340
Joined: 2017-09-17 07:12

Re: Grub and LVM on a RAID1

Postby rollopack » 2018-03-15 09:16

First of all thanks for your answer.
Which solution is "safer"?
With parted I saw that I have a little empty space to create the boot partition.

Code: Select all
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
        17,4kB  1049kB  1031kB  Free Space
 1      1049kB  2000GB  2000GB                     raid
        2000GB  2000GB  73,2kB  Free Space
rollopack
 
Posts: 2
Joined: 2018-03-15 06:31

Re: Grub and LVM on a RAID1

Postby p.H » 2018-03-15 09:20

Creating a BIOS boot partition is probably safer that converting the partition table.
In parted, the "BIOS boot" type is represented by the bios_grub flag.

Note that if you want boot redundancy you have to install GRUB on both disks.
p.H
 
Posts: 340
Joined: 2017-09-17 07:12


Return to Installation

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable