Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[help is no longer required] RAID, UEFI, GPT and GRUB2...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Jimini
Guru
Guru


Joined: 31 Oct 2006
Posts: 543
Location: Göttingen, Germany

PostPosted: Sun Jul 14, 2013 8:16 pm    Post subject: [help is no longer required] RAID, UEFI, GPT and GRUB2... Reply with quote

Hey there,

I set up a system with 4 HDDs (3TB each). Now I'm stuck at getting this system to boot. Since I was told to set up seperate partitions for / and /boot, I created 2 arrays:

/dev/md1 -> RAID1 (metadata version 0.90) with 4 devices -> /boot (ext4)
/dev/md2 -> RAID5 with 4 devices -> / (ext4)

The mainboard is a ASRock B75 Pro3-M, which uses UEFI. Since booting a UEFI system is completely new to me, I have problems to figure out how to set up GRUB2 correctly. I read many discussions and tutorials, but the only effect is, that I'm getting more and more confused.

The current status is that the system seems to find a bootable device but reboots immediately (otherwise I would get an error message like "no bootable medium found").

Output of "gdisk -l /dev/sda" (similar to sdb sdc, sdd):
Code:
livecd / # gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 9D247197-4C86-4084-874C-03AC5010185B
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF02  Linux filesystem
   2          206848      5860533134   2.7 TiB     8300  Linux filesystem


What do I have to do to get this system to boot?

Best regards,
Jimini

Edit: I changed the type of sda1, sdb1, sdc1 and sdd1 to EF00, but the problem persists.
_________________
"The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents." (H.P. Lovecraft: The Call of Cthulhu)


Last edited by Jimini on Fri Jul 19, 2013 6:10 am; edited 2 times in total
Back to top
View user's profile Send private message
Dippmopser
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jun 2013
Posts: 92

PostPosted: Sun Jul 14, 2013 9:56 pm    Post subject: Reply with quote

There are 4 HDDs in total, may I ask how you did set up Aa RAID 1 and a RAID 5? Since RAID 5 needs 3 Disks minimum and RAID 1 needs 2 Disks minimum.

Or are you talking about a software-raid?
Back to top
View user's profile Send private message
pums974
n00b
n00b


Joined: 27 Feb 2010
Posts: 74

PostPosted: Sun Jul 14, 2013 10:28 pm    Post subject: Reply with quote

Quote:
Or are you talking about a software-raid?

Quote:
/dev/md?

Is the name of software raid array
Quote:
(metadata version 0.90)

Doesn't have any sense with hardware raid
Quote:
gdisk -l /dev/sda

Would be useless since with hardware raid, linux would see the arrays as two disk formated with ext4

So yes he is

Jimini, I'm currently running gentoo on a software raid-array since some time without any problem.
I think you need to have grub 2 and an initrd (with genkernel for example)

I just have a remark, why don't you give a try to btrfs and it's raid capabilities ?
https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices
Back to top
View user's profile Send private message
Jimini
Guru
Guru


Joined: 31 Oct 2006
Posts: 543
Location: Göttingen, Germany

PostPosted: Mon Jul 15, 2013 5:13 am    Post subject: Reply with quote

Sorry, for clearness I should have mentioned, that I set up 2 software RAIDs on 4 drives - every array uses 4 filesystems.

Yes, I am going to use an initramfs, but since the system does not even find a boot entry, the problem seems to be somewhere in my GRUB2 config, I assume. The current status is, that I only get "GRUB" with a blinking prompt, when I try to boot up the system.

Best regards,
Jimini
_________________
"The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents." (H.P. Lovecraft: The Call of Cthulhu)
Back to top
View user's profile Send private message
pums974
n00b
n00b


Joined: 27 Feb 2010
Posts: 74

PostPosted: Mon Jul 15, 2013 6:59 am    Post subject: Reply with quote

Seems to me that in order to boot with efi, you still need 1 fat32 filesystem on every disk
These filesystems will have only one file /boot/efi/EFI/gentoo/grubx64.efi
In order to put this file you can mount them successively on /boot/efi and make a grub2-install

Concerning /boot on raid, make sure that you have this line in /etc/default/grub
Quote:
GRUB_PRELOAD_MODULES="lvm mdraid09 mdraid1x mdraid09_be raid5rec raid6rec"


And for information this is my menuentry
Quote:
menuentry 'Openrc' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
insmod mdraid1x
insmod mdraid09
insmod mdraid09_be
insmod raid5rec
insmod raid6rec
insmod lvm
set root='(lvm/vg-Boot)'
linux /boot/kernel root=/dev/mapper/vg-Root ro rootfstype=ext4 splash=silent,fadein,theme:natural_gentoo video=uvesafb:1280x1024-32,mtrr:3,ywrap console=tty1 quiet init=/sbin/init dolvm domdadm
initrd /boot/initramfs
}
Back to top
View user's profile Send private message
Jimini
Guru
Guru


Joined: 31 Oct 2006
Posts: 543
Location: Göttingen, Germany

PostPosted: Mon Jul 15, 2013 12:40 pm    Post subject: Reply with quote

As shown in https://wiki.gentoo.org/wiki/UEFI_Gentoo_Quick_Install_Guide , I formatted /dev/md1 with FAT32 and mounted it as /boot/efi. Then I created the folder /boot/efi/boot and copied /usr/src/linux/arch/x86/boot/bzImage to /boot/efi/boot/bootx64.efi.
The next step should be to format a flash drive with FAT32, create a folder "efi" on it and copy the file bootx64.efi there. Afterwards, the system should be booted with this flash drive - which does not work in my case, I always get back to the boot media selection menu.

I think, that this should work first before I touch GRUB.

Any ideas?

Best regards,
Jimini
_________________
"The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents." (H.P. Lovecraft: The Call of Cthulhu)
Back to top
View user's profile Send private message
pums974
n00b
n00b


Joined: 27 Feb 2010
Posts: 74

PostPosted: Mon Jul 15, 2013 1:13 pm    Post subject: Reply with quote

I dont think that the efi filesystem can be a raid partition. Your Bios doesn't know anything about software-raid.
But since it contain only grub, you will only touch this when you will upgrade grub.
So i don't think that if you must duplicate manually this filesystem every time there is a grub update, that would be a problem

I personnally used an easyer way. To do this procedure.
I take an ubuntu key (unetbootin) and boot it with uefi.
then I chrooted inside my gentoo system and I simply did an grub2-install with a non-raid fat32 filesystem mounted on /boot/efi.
grub2-install took care of everything else
Back to top
View user's profile Send private message
vaxbrat
Guru
Guru


Joined: 05 Oct 2005
Posts: 582
Location: DC Burbs

PostPosted: Mon Jul 15, 2013 2:32 pm    Post subject: keep boot a simple n-way mirror Reply with quote

Agreed that RAID complicates /boot. Just do a simple n-way (4 in your case) mirror for /boot. It's a bit of a waste but the size wasted should be less than 1gb. The bios will then think that the first drive's /boot is just a normal disk for the initrd process.

Actually don't the UEFI guys look down their noses at calling their bios a BIOS? :D
Back to top
View user's profile Send private message
pums974
n00b
n00b


Joined: 27 Feb 2010
Posts: 74

PostPosted: Mon Jul 15, 2013 3:07 pm    Post subject: Reply with quote

To be clearer :
There is (almost) no problem for /boot on a raid1 array with grub2.
It's for the efi filesystem that you need to have a standard fat filesystem
My grubx64.efi file have a size of 146K here, so a 1Mo filesystem for efi should be enough wich won't be a large waste of space
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 432
Location: Woonsocket, RI

PostPosted: Mon Jul 15, 2013 4:12 pm    Post subject: Reply with quote

Jimini wrote:
Code:
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF02  Linux filesystem
   2          206848      5860533134   2.7 TiB     8300  Linux filesystem


As others have pointed out, EFI requires an EFI System Partition (ESP) with a FAT filesystem (officially FAT32, although in practice FAT16 can work). I recommend making this partition at least 550MiB in size; although a smaller partition can work, some EFIs have bugs in their FAT drivers that can cause weird problems with smaller FAT32 filesystems. The ESP is identified with a partition type code of EF00 in gdisk.

The EF02 type code you've specified for your /boot partition is incorrect; that type code is reserved for the BIOS Boot Partition, which is used by GRUB 2 when booting from GPT disks on BIOS-based computers. In a RAID setup, you'd ordinarily set all your RAIDed partitions with a type code of FD00, although some people prefer to use another (random) type code for this purpose because of problems with tools that try to auto-assemble degraded RAID arrays based on the type code. IMHO, that means the tools need to be fixed, but that's another matter....

On a much more general note, IMHO creating a huge root (/) filesystem with no split-off filesystems as you've done is asking for trouble. Depending on how the computer is to be used, creating a separate /home or /var partition (whichever will hold most of the users' files) is extremely wise. Failing to do so will complicate a full re-installation, should that be necessary. Separating system data from user data can also help protect from filesystem damage; should there be filesystem trouble, it will affect either the system or the user data, not both. Some administrators like splitting off /tmp, /usr, or other directories, too. Note that using Btrfs subvolumes can help mitigate these problems, though, so if you're using Btrfs and plan to create suitable subvolumes, that may be sufficient.

Jimini wrote:
As shown in https://wiki.gentoo.org/wiki/UEFI_Gentoo_Quick_Install_Guide , I formatted /dev/md1 with FAT32 and mounted it as /boot/efi.


In theory, the ESP should be a non-RAID device, such as /dev/sda1. In practice, if the device is in a RAID 1 array it should still work fine, although the EFI spec does say it needs to be marked with the type code identified as EF00 in gdisk.

Jimini wrote:
Then I created the folder /boot/efi/boot and copied /usr/src/linux/arch/x86/boot/bzImage to /boot/efi/boot/bootx64.efi.
The next step should be to format a flash drive with FAT32, create a folder "efi" on it and copy the file bootx64.efi there. Afterwards, the system should be booted with this flash drive - which does not work in my case, I always get back to the boot media selection menu.


Your filenames are incorrect. First, note that the EFI doesn't know a thing about Linux mount points, so when referring to files used in EFI booting, references are to the EFI System Partition (ESP), and their location within the Linux directory tree depend on where you mount the ESP. (More on that shortly....)

A bootable USB flash drive or other removable medium uses a boot file called EFI/BOOT/bootx64.efi. Your description places this file as EFI/bootx64.efi, which won't work. A bootable hard disk normally has a boot loader stored in a subdirectory of the "EFI" directory named after the OS or boot loader, such as EFI/gentoo/grubx64.efi or EFI/grub/grubx64.efi. Your procedure creates boot/bootx64.efi, which violates the standard but could probably be made to work if you specified the correct path via the "efibootmgr" command in Linux. When setting up an EFI computer to boot from its hard disk, you must normally create an NVRAM entry that refers to the boot loader by using "efibootmgr", as in:

Code:
efibootmgr -c -l '\EFI\gentoo\grubx64.efi' -L "Gentoo (GRUB)"


A further comment: Given your configuration, you might want to consider using the ESP as your /boot partition. This can simplify things a bit, although it's not the most common way to set it up in Linux. (Arch Linux users are quite fond of this setup, though.) When set up this way, you'd have a directory called /boot/EFI/gentoo in Linux that would hold your boot loader.

Personally, I'm not a fan of GRUB 2, particularly not on EFI-based computers. I consider it difficult to configure and finicky to the point of unreliability. Several other EFI boot loaders for Linux are available, and most of them are superior to GRUB 2, IMHO. (The brand-new SYSLINUX EFI variant is the one real exception to that rule, but only because of its newness.) My personal favorite is the EFI stub loader, which is best used with a separate boot manager, such as gummiboot or my own rEFInd. If you use gummiboot, mounting your ESP at /boot is particularly helpful, since gummiboot requires its kernels to be on the partition from which gummiboot was launched, and mounting the ESP at /boot makes this natural. rEFInd is more flexible on this score; but if you put the ESP in a RAID array, rEFInd will most likely detect all your kernels multiple times, which may be a pain. You could work around this by disabling auto-detection and instead create a manual boot stanza for each kernel in refind.conf.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 432
Location: Woonsocket, RI

PostPosted: Mon Jul 15, 2013 4:32 pm    Post subject: Reply with quote

pums974 wrote:
My grubx64.efi file have a size of 146K here, so a 1Mo filesystem for efi should be enough wich won't be a large waste of space


Don't create an ESP that's as small as 1MiB!!! There are a couple of reasons for this:


  • A 1MiB FAT filesystem must be FAT12; the minimum size for FAT16 is 4.1MiB or 2MiB, depending on the source you believe; and the FAT32 limit is higher than that (32MiB, according to Wikipedia). The EFI spec, however, says that the ESP must be FAT32. In practice, a FAT12 ESP is likely to work; but it also violates the spec, which is something that shouldn't be done casually. It could be that a hidden bug will come back to haunt you.
  • A dinky 1MiB ESP gives you no room for expansion. What if you want to change from GRUB to another boot loader that requires more disk space? What if you want to install some extra EFI tools, like an EFI shell? (Some EFI shell binaries exceed 1MiB in size.) What if GRUB increases significantly in size in the future? What if you decide to reconfigure the computer to dual-boot in the future, and the new OS needs more space than remains on the ESP? What if you decide to enable Secure Boot, and therefore want to install shim? (The signed shim binary is 1.4MiB, and its support MokManager binary is 1.2MiB.) Even if you discard some of these scenarios as unlikely in your case, you shouldn't dismiss them all.


As I wrote in my previous post, I now recommend 550MiB as the minimum size for the ESP. I've seen reliable reports of some EFIs that have problems with sub-512MiB FAT32 filesystems, and in fact I've encountered such problems myself. The Linux mkdosfs utility defaults to FAT32 only with partitions a bit larger than this (530-something MiB, IIRC). The figure 550MiB is (relatively) easy to remember and gives enough "wiggle room" in case of MiB vs. MB confusions. The OP has disks that are 3TB (2.7TiB) in size, which means that 550MiB is about 0.02% of the available disk space -- a trivial amount of space.
Back to top
View user's profile Send private message
pums974
n00b
n00b


Joined: 27 Feb 2010
Posts: 74

PostPosted: Mon Jul 15, 2013 4:39 pm    Post subject: Reply with quote

Quote:
Don't create an ESP that's as small as 1MiB!!!

Yes you're right, that was a really bad advice. Sorry
Back to top
View user's profile Send private message
Jimini
Guru
Guru


Joined: 31 Oct 2006
Posts: 543
Location: Göttingen, Germany

PostPosted: Fri Jul 19, 2013 6:08 am    Post subject: Reply with quote

Dear all,

thank you for your postings and your support. After a few days, I became too impatient and put / on a single disk. Additionally, I discovered that the system _can_ be booted in BIOS mode, so the setup wasn't a real problem anymore.
Since the time will come, when I am forced to deal with GRUB2, your postings will help me.

Best regards,
Jimini
_________________
"The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents." (H.P. Lovecraft: The Call of Cthulhu)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum