You are not logged in.

#1 2020-01-10 19:29:12

likemike
Member
Registered: 2019-12-29
Posts: 54

Raid 0 begins booting for split second then fails

After completing installing arch on a raid 0 array and attempting to boot exiting OS it shows the syslinux screen for a split second then goes back to the bootable USB grub. I have followed the raid guide on: https://wiki.archlinux.org/index.php/RAID Below is a detailed list of all the steps I'm taking.

fdisk /dev/sda

created partition /dev/sda1 with 1M (for boot) with BIOS boot partition type, created partition /dev/sda2 with 2G (for swap) with Linux RAID partition type, created partition /dev/sda3 with 109.8G (for root and home) with Linux RAID partition type.

fdisk /dev/sdb

(repeated same partition steps as /dev/sda for this disk save for root/home partition is 109G)

mdadm --create --verbose --level=0 --metadata=1.2 --chunk=512 --homehost=Thinkpad-X220 --raid-devices=2 /dev/md/zero /dev/sda3 /dev/sdb3

It then gives me the error:

md/raid0:md127: cannot assemble multi-zone RAID0 with default_layout setting
md/raid0: please set raid0.default_layout to 1 or 2

I tried to handle this error by running:

echo 2 > /sys/module/raid0/parameters/default_layout

but I later found out that I needed to pass a kernel parameter which I did at the end of this process
Then I assemble the array:

mdadm --assemble /dev/md127 /dev/sda3 /dev/sdb3

Then I format the array with a filesystem and calculate then set the stride and stripe width:

mkfs.ext4 -v -L myarray -m 0.5 -b 4096 -E stride=128,stripe-width=256 /dev/md127

Then I make /dev/sda2 and /dev/sdb2 into swap partitions.

mkswap /dev/sda2
mkswap /dev/sdb2

Swap on:

swapon /dev/sda2
swapon /dev/sdb2

I then connect to wifi and update the system clock
I then mount /dev/md127 to /mnt
I then pacstrap the base and base-devel packages, linux kernel, linux firmware and vim to /mnt
I then update the mdadm.conf file

mdadm --detail --scan >> /mnt/etc/mdadm.conf

I then generate fstab file:

genfstab -U /mnt >> /mnt/etc/fstab

Next I changeroot into the system and set the timezone localization and netwok configuration
Then I pacman -S the mdadm package
Then I add mdadm_udev to the HOOKS section of the mkinitcpio.conf and regenerate initramfs

mkinitcpio -P

Then I download grub package and install it on /dev/sda and /dev/sdb:

grub-install --target=i386-pc /dev/sda
grub-install --target=i386-pc /dev/sdb

Then I generate my grub config:

grub-mkconfig -o >> /boot/grub/grub.cfg

Then I set my lang variable in /etc/locale.conf
Then I install network manager and enable it with systemctl enable
Then I add mdraid09 and mdraid1x in "GRUB_PRELOAD_MODULES" in /etc/default/grub
Then I add raid0.default_layout=2 in "GRUB_CMDLINE_LINUX_DEFAULT" and regenerate grub config with

grub-mkconfig -o /boot/grub/grub.cfg

Exit from changeroot
Unmount all partitions:

umount -R /mnt

and reboot.

If needed I can post the output of some diagnostic commands.

UPDATE: raid array is not detected in BIOS

Thanks for reading,
-likemike

Last edited by likemike (2020-01-11 05:39:55)

Offline

#2 2020-01-10 19:40:09

frostschutz
Member
Registered: 2013-11-15
Posts: 978

Re: Raid 0 begins booting for split second then fails

likemike wrote:
mdadm --create --verbose --level=0 --metadata=1.2 --chunk=512 --homehost=Thinkpad-X220 --raid-devices=2 /dev/md/zero /dev/sda3 /dev/sdb3

It then gives me the error:

md/raid0:md127: cannot assemble multi-zone RAID0 with default_layout setting
md/raid0: please set raid0.default_layout to 1 or 2

I tried to handle this error by running:

echo 2 > /sys/module/raid0/parameters/default_layout

but I later found out that I needed to pass a kernel parameter which I did at the end of this process

raid0 had a kernel bug which caused layouts to be different (without that being reflected in the on disk metadata), hence the hoop jumping with setting one of two possible layouts manually.

however this bug should only affect raid0 arrays with different size disks. are your partitions not the same size?

(blockdev --getsize64 /dev/sda3 /dev/sdb3)

I'm not sure if this could be related to your grub problem as with different size disks it would also be a slightly more exotic raid configuration.

Personally I prefer a raid1 /boot partition (1.0 metadata at end of partition) so the bootloader doesn't really have to deal with any raid at all (looks like regular filesystem partition)

Offline

#3 2020-01-10 19:42:13

loqs
Member
Registered: 2014-03-06
Posts: 11,668

Re: Raid 0 begins booting for split second then fails

If you remove the live media what bootloader if any starts?

Offline

#4 2020-01-10 19:53:49

likemike
Member
Registered: 2019-12-29
Posts: 54

Re: Raid 0 begins booting for split second then fails

The partition /dev/sda3 and /dev/sdb3 are different sizes. One is 109G and the other is 109.8G.
Although I thought I fixed the default layout problem by adding the raid0.default_layout=2 in GRUB_CMDLINE_LINUX_DEFAULT, It still gave me the please set raid0.default_layout to 1 or 2 in the list of things it displays when it boots.
I'll try making both partitions the exact same size
And you're saying that you create a raid1 array out of the two boot partitions? Would doing this possibly help me?

Last edited by likemike (2020-01-10 19:54:27)

Offline

#5 2020-01-10 20:07:22

likemike
Member
Registered: 2019-12-29
Posts: 54

Re: Raid 0 begins booting for split second then fails

loqs wrote:

If you remove the live media what bootloader if any starts?

No bootloader starts. It attempts a network boot and then after that fails the BIOS asks me to boot from either of the disks

Offline

#6 2020-01-10 20:31:02

frostschutz
Member
Registered: 2013-11-15
Posts: 978

Re: Raid 0 begins booting for split second then fails

can you show parted --list?

some systems (gpt with bios grub partition) require 'disk_set pmbr_boot on' (in parted, no idea how fdisk calls it)

Offline

#7 2020-01-10 20:53:44

likemike
Member
Registered: 2019-12-29
Posts: 54

Re: Raid 0 begins booting for split second then fails

frostschutz wrote:

can you show parted --list?

some systems (gpt with bios grub partition) require 'disk_set pmbr_boot on' (in parted, no idea how fdisk calls it)

parted --list shows that partion 1 on /dev/sda has bios_grub flag and partition 2 has linux-swap(v1) filesystem and raid flag. partition 3 shows no filesystem and has raid flag.
/dev/sdb shows the same thing the partition tables are gpt

Offline

#8 2020-01-10 20:55:16

loqs
Member
Registered: 2014-03-06
Posts: 11,668

Re: Raid 0 begins booting for split second then fails

https://bbs.archlinux.org/viewtopic.php?id=57855
Please post the actual output from `parted -l`.  See the tip box from pastebin to pipe the output directly to a pastebin.

Offline

#9 2020-01-10 22:00:28

likemike
Member
Registered: 2019-12-29
Posts: 54

Re: Raid 0 begins booting for split second then fails

loqs wrote:

https://bbs.archlinux.org/viewtopic.php?id=57855
Please post the actual output from `parted -l`.  See the tip box from pastebin to pipe the output directly to a pastebin.

Ok here is the ouptut of fdisk -l:

Disk /dev/sda: 111.81 GiB, 120034123776 bytes, 234441648 sectors
Disk model: Samsung SSD 850 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 6DA26F1E-8D97-FF4C-9940-04B938B5DD42

Device       Start       End   Sectors   Size Type
/dev/sda1     2048      4095      2048     1M BIOS boot
/dev/sda2     4096   4198399   4194304     2G Linux RAID
/dev/sda3  4198400 234441614 230243215 109.8G Linux RAID


Disk /dev/sdb: 447.13 GiB, 480103981056 bytes, 937703088 sectors
Disk model: KINGSTON SA400S3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 9321D9E0-0D9F-2D40-BCE0-EDAF59F5664A

Device       Start       End   Sectors  Size Type
/dev/sdb1     2048      4095      2048    1M BIOS boot
/dev/sdb2     4096   4198399   4194304    2G Linux filesystem
/dev/sdb3  4198400 232787967 228589568  109G Linux filesystem


Disk /dev/sdc: 14.48 GiB, 15539896320 bytes, 30351360 sectors
Disk model: USB Flash Drive 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2830b4d0

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1  *     2048 30351359 30349312 14.5G  c W95 FAT32 (LBA)


Disk /dev/loop0: 541.5 MiB, 567787520 bytes, 1108960 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Offline

#10 2020-01-10 22:06:20

likemike
Member
Registered: 2019-12-29
Posts: 54

Re: Raid 0 begins booting for split second then fails

frostschutz wrote:

can you show parted --list?

some systems (gpt with bios grub partition) require 'disk_set pmbr_boot on' (in parted, no idea how fdisk calls it)

Disk /dev/sda: 111.81 GiB, 120034123776 bytes, 234441648 sectors
Disk model: Samsung SSD 850 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 6DA26F1E-8D97-FF4C-9940-04B938B5DD42

Device       Start       End   Sectors   Size Type
/dev/sda1     2048      4095      2048     1M BIOS boot
/dev/sda2     4096   4198399   4194304     2G Linux RAID
/dev/sda3  4198400 234441614 230243215 109.8G Linux RAID


Disk /dev/sdb: 447.13 GiB, 480103981056 bytes, 937703088 sectors
Disk model: KINGSTON SA400S3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 9321D9E0-0D9F-2D40-BCE0-EDAF59F5664A

Device       Start       End   Sectors  Size Type
/dev/sdb1     2048      4095      2048    1M BIOS boot
/dev/sdb2     4096   4198399   4194304    2G Linux filesystem
/dev/sdb3  4198400 232787967 228589568  109G Linux filesystem


Disk /dev/sdc: 14.48 GiB, 15539896320 bytes, 30351360 sectors
Disk model: USB Flash Drive 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2830b4d0

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1  *     2048 30351359 30349312 14.5G  c W95 FAT32 (LBA)


Disk /dev/loop0: 541.5 MiB, 567787520 bytes, 1108960 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Offline

#11 2020-01-10 22:09:20

frostschutz
Member
Registered: 2013-11-15
Posts: 978

Re: Raid 0 begins booting for split second then fails

here's an example (with parted)

# parted /dev/loop0
(parted) unit mib                                                         
(parted) print                                                            
Model: Loopback device (loopback)
Disk /dev/loop0: 100MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start    End      Size     File system  Name       Flags
 1      1.00MiB  2.00MiB  1.00MiB               bios_grub  bios_grub
 2      2.00MiB  99.0MiB  97.0MiB               root

(parted) disk_set pmbr_boot on                                            
(parted) print                                                            
Model: Loopback device (loopback)
Disk /dev/loop0: 100MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot <<<--- here

Number  Start    End      Size     File system  Name       Flags
 1      1.00MiB  2.00MiB  1.00MiB               bios_grub  bios_grub
 2      2.00MiB  99.0MiB  97.0MiB               root

how to do the same with fdisk:

# fdisk -t dos -l /dev/loop0
Device       Boot Start    End Sectors  Size Id Type
/dev/loop0p1          1 204799  204799  100M ee GPT

# fdisk -t dos /dev/loop0
Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.
Command (m for help): w

# fdisk -t dos -l /dev/loop0
Device       Boot Start    End Sectors  Size Id Type
/dev/loop0p1 *        1 204799  204799  100M ee GPT

GPT has a fallback/compatibility msdos partition header, and some machines requires the boot flag to be set on that

that may or may not be your issue

if the device boots loads at all, as long as it has grub installed, even if there was a problem with grub+raid, it should still give you a "grub rescue" prompt.

if that's not it check your boot order in bios or see if it can be selected from quick boot menu (using the non-uefi, legacy boot style. if your platform supports uefi & you want to use that instead, you have to set up a fat32 boot partition for it)

Last edited by frostschutz (2020-01-10 22:41:57)

Offline

#12 2020-01-10 22:41:08

loqs
Member
Registered: 2014-03-06
Posts: 11,668

Re: Raid 0 begins booting for split second then fails

frostschutz are there any issue other than performance with mixing different drives in RAID 0?

Offline

#13 2020-01-10 23:59:09

likemike
Member
Registered: 2019-12-29
Posts: 54

Re: Raid 0 begins booting for split second then fails

frostschutz wrote:

here's an example (with parted)

# parted /dev/loop0
(parted) unit mib                                                         
(parted) print                                                            
Model: Loopback device (loopback)
Disk /dev/loop0: 100MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start    End      Size     File system  Name       Flags
 1      1.00MiB  2.00MiB  1.00MiB               bios_grub  bios_grub
 2      2.00MiB  99.0MiB  97.0MiB               root

(parted) disk_set pmbr_boot on                                            
(parted) print                                                            
Model: Loopback device (loopback)
Disk /dev/loop0: 100MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot <<<--- here

Number  Start    End      Size     File system  Name       Flags
 1      1.00MiB  2.00MiB  1.00MiB               bios_grub  bios_grub
 2      2.00MiB  99.0MiB  97.0MiB               root

how to do the same with fdisk:

# fdisk -t dos -l /dev/loop0
Device       Boot Start    End Sectors  Size Id Type
/dev/loop0p1          1 204799  204799  100M ee GPT

# fdisk -t dos /dev/loop0
Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.
Command (m for help): w

# fdisk -t dos -l /dev/loop0
Device       Boot Start    End Sectors  Size Id Type
/dev/loop0p1 *        1 204799  204799  100M ee GPT

GPT has a fallback/compatibility msdos partition header, and some machines requires the boot flag to be set on that

that may or may not be your issue

if the device boots loads at all, as long as it has grub installed, even if there was a problem with grub+raid, it should still give you a "grub rescue" prompt.

if that's not it check your boot order in bios or see if it can be selected from quick boot menu (using the non-uefi, legacy boot style. if your platform supports uefi & you want to use that instead, you have to set up a fat32 boot partition for it)

I entered fdisk -t dos /dev/sda and fdisk -t dos /dev/sdb and set the boot flags and it still failed and it doesn't look like there is an option for my array in the boot sequence in BIOS. Although I haven't yet tried redoing the whole process and making the /dev/sda3 and /dev/sdb3 partitions the same exact size so I'll try that and get back to you.

Last edited by likemike (2020-01-11 00:05:08)

Offline

#14 2020-01-11 01:53:13

merlock
Member
Registered: 2018-10-30
Posts: 113

Re: Raid 0 begins booting for split second then fails

Try partitioning *1* of your drives (eg:  /dev/sda), then copy the partition table from /dev/sda over to /dev/sdb.

You might have to change UUID's for the partitions on /dev/sdb.

If it was me, I'd only use one swap partition (I've never seen 2 setup/activated at one time).  Same thing for GRUB...pick one and install it there.

ETA...

My old Manjaro install was on RAID-1.  I think that I had it set up like this (was nuked from orbit a long time ago):

GRUB was installed to /dev/sda.

/dev/sda1:  1GB.  This was my $esp.

/dev/sd[a,b]2:  RAID-1 (/dev/md0).  This was my root partition.

/dev/sd[a,b]3:  RAID-1 (/dev/md1):  this was my $HOME.

Note that I did the table copying, and occasionally ran rsync to keep sdb1 synced with sda1.

Last edited by merlock (2020-01-11 02:06:38)


It's a big club...and you ain't in it -- George Carlin
Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#15 2020-01-11 05:31:52

likemike
Member
Registered: 2019-12-29
Posts: 54

Re: Raid 0 begins booting for split second then fails

merlock wrote:

Try partitioning *1* of your drives (eg:  /dev/sda), then copy the partition table from /dev/sda over to /dev/sdb.

You might have to change UUID's for the partitions on /dev/sdb.

If it was me, I'd only use one swap partition (I've never seen 2 setup/activated at one time).  Same thing for GRUB...pick one and install it there.

ETA...

My old Manjaro install was on RAID-1.  I think that I had it set up like this (was nuked from orbit a long time ago):

GRUB was installed to /dev/sda.

/dev/sda1:  1GB.  This was my $esp.

/dev/sd[a,b]2:  RAID-1 (/dev/md0).  This was my root partition.

/dev/sd[a,b]3:  RAID-1 (/dev/md1):  this was my $HOME.

Note that I did the table copying, and occasionally ran rsync to keep sdb1 synced with sda1.

I tried again with the partition table copying and using grub install on one disk and the problem persists, thanks for clearing that up though.

Offline

#16 2020-01-11 10:47:25

frostschutz
Member
Registered: 2013-11-15
Posts: 978

Re: Raid 0 begins booting for split second then fails

The bios doesn't know about the software raid but it should show the individual drives as boot devices. That's if they are connected to the mainboard; if you use an addon controller card or something other, it may be different, not all of them support booting

Offline

#17 2020-01-11 18:01:39

merlock
Member
Registered: 2018-10-30
Posts: 113

Re: Raid 0 begins booting for split second then fails

frostschutz wrote:

The bios doesn't know about the software raid but it should show the individual drives as boot devices. That's if they are connected to the mainboard; if you use an addon controller card or something other, it may be different, not all of them support booting

This is a good point.  @likemike:  are your drives in AHCI mode in your bios?


It's a big club...and you ain't in it -- George Carlin
Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#18 2020-01-12 02:13:06

likemike
Member
Registered: 2019-12-29
Posts: 54

Re: Raid 0 begins booting for split second then fails

merlock wrote:
frostschutz wrote:

The bios doesn't know about the software raid but it should show the individual drives as boot devices. That's if they are connected to the mainboard; if you use an addon controller card or something other, it may be different, not all of them support booting

This is a good point.  @likemike:  are your drives in AHCI mode in your bios?

Yes they are in AHCI mode

Offline

#19 2020-01-14 03:38:42

loqs
Member
Registered: 2014-03-06
Posts: 11,668

Re: Raid 0 begins booting for split second then fails

When you boot the live media is that in BIOS or EFI mode?

Offline

Board footer

Powered by FluxBB