WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: mdadm --assemble --scan before initrd  (Read 2841 times)

Offline LotusDew

  • Newbie
  • *
  • Posts: 11
mdadm --assemble --scan before initrd
« on: August 21, 2023, 02:17:34 PM »
Hi Experts,

I am figuring out how I can make TinyCore boot from a RAID0 that I have setup using Intel Rapid Store BIOS and is setup as a logical volume with 4 drives. As an experiment I have used 4x 128GB SSD to get 512GB Raid0 drive.

I initially remastered an iso so that scsi and raid extentions are in the initramfs so that raid devices can be accessed. I was booting off this but realized I need to run mdadm --assemble --scan and then do rebuild fstab to mount the raid drives.

I have create a EFI partition and made it bootable - but the RAID partition is not being recognized as a bootable partition by UEFI BIOS. I am pretty sure its something about the way I have created these partitions due to which its not being recognized as a boot partition. This is a partition on the 4xSSD RAID0 volume.

Then I added sudo mdadm --assemble --scan in bootlocal.sh which seemed to atleast get the drives mountable on boot from USB.

Now I want to boot from RAID0 and load the extentions from RAID0

I am pretty new to RAID as such.

Questions
1. How do I correctly setup bootable RAID0 partitions. I tried using tc-install on /dev/md0 - didnt work
2. How do I ensure that the raid is assembled before the extentions have to be loaded

Thanks in advance !!

Offline CardealRusso

  • Full Member
  • ***
  • Posts: 179
Re: mdadm --assemble --scan before initrd
« Reply #1 on: August 21, 2023, 03:43:36 PM »
Hi,
I don't know if we may have had the same problem, but my motherboard's UEFI refuses to boot anything other than FAT32.

Rather than appending a new .gz file to boot, I've opted for a different approach using "pretce" in my grub.cfg. Specifically, I use the boot code: "pretce=sdc1/pretce" (sdc1 is a 100mb fat32 usb partition (if a second usb is mounted to sdc1 during boot, it will not boot))

I have mdadm and raid-dm (for raid) and filesystems-kernel and mtd-kernel (for btrfs) on sdc1/pretce/optional, also the /sdc1/pretce/onboot.lst.

for btrfs, I employ the command "mount /mnt/sdc2 -o compress=zstd:15" in sdc1/pretce/onpre.sh. This is done to mount the partition that houses the /home and tce directory. (sdc2 is a 58gb btrfs usb partition)

/opt/bootlocal.sh:
Code: [Select]
..
/opt/md0.sh &
..
/opt/md0.sh:
Code: [Select]
mda -A --scan
sleep 1   # This pause is crucial as there are times when 'mda -a --scan' completes before the system is fully ready
mount /mnt/md0 -o compress=zstd:15
(md0 is a 2x256gb ssd software raid0 btrfs)
But you could try something like this (after -a scan)
Code: [Select]
until mdadm --detail /dev/md0 >/dev/null 2>&1; do
    sleep 0.1
done
I don't understand a solution to your problem, but I hope that my situation can help you with something.
« Last Edit: August 21, 2023, 03:52:50 PM by CardealRusso »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11624
Re: mdadm --assemble --scan before initrd
« Reply #2 on: August 21, 2023, 11:31:11 PM »
Hi LotusDew
I seem to recall reading something about software raid many years ago
where it was suggested to set up a small bootable partition containing
the raid software and scripts required to assemble the raid array.

Offline LotusDew

  • Newbie
  • *
  • Posts: 11
Re: mdadm --assemble --scan before initrd
« Reply #3 on: August 22, 2023, 12:20:59 AM »
Okay so I realized, that its not possible to boot from RAID0 as far as my research goes. The UEFI Bios of my Dell T40 dosent allow it as far as I can see. Does anyone know if its possible with other firmwares like coreboot ?

So the best bet is to keep one of the members out of RAID and make it the main bootable partition and use the other disks for RAID0 volume. So you will need atleast 3 drives. One for boot. 2 for RAID0. More if want to do RAID5 or more.

My primary aim is to use RAID in swap to increase system performance instead of simple swap. I think this can be achieved, but I will need to keep one disk out of the RAID configuration.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11624
Re: mdadm --assemble --scan before initrd
« Reply #4 on: August 22, 2023, 12:29:05 AM »
Hi LotusDew
... So the best bet is to keep one of the members out of RAID and make it the main bootable partition and use the other disks for RAID0 volume. ...
You should be able to set a small partition (20 Mbyte for example) aside just
for booting and use the rest of that disk in your raid configuration. Or you
could boot from a thumb drive or CD if you don't want to partition your
raid drive(s).

Offline LotusDew

  • Newbie
  • *
  • Posts: 11
Re: mdadm --assemble --scan before initrd
« Reply #5 on: August 22, 2023, 01:14:32 PM »
Yes but I am not sure how thats possible on T40 from Dell. I allows a whole disk to be included in RAID or not.

That said, I managed to boot ubuntu on full raid - but it stopped at loading initramfs - and gave me an initramfs prompt. Dont know what to do it with as I have never landed here.

But that also means its somehow possible to boot from a logial volume of a raid in T40 which I need to figure out. Keeping a disk out of raid is a bit like copping out I think but will see how far my patience runs ...

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11624
Re: mdadm --assemble --scan before initrd
« Reply #6 on: August 22, 2023, 03:15:38 PM »
Hi LotusDew
I just realized the machine you are doing this on has a builtin RAID option.
It is described as (emphasis mine):
Quote
The PowerEdge T40 system supports Intel Virtual RAID on CPU (Intel VROC) software RAID.
found here:
https://www.dell.com/support/manuals/en-us/poweredge-t40/pet40_ts_pub/storage-controller-specifications?guid=guid-b4fae371-c300-4d32-8abd-810940d7d861&lang=en-us

A quick search online suggests VROC only supports certain Linux distros.
It sounds like you might be better off disabling the builtin RAID and just
using the software RAID. I suspect setup will be simpler without VROC
getting in the way.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 713
Re: mdadm --assemble --scan before initrd
« Reply #7 on: August 22, 2023, 04:43:21 PM »
I have seen some HD/RAID drivers need some software firmware being loaded to work well.

Maybe you could see what drivers loaded with the another linux dist that worked, you could try to see what modules being loaded with
Code: (bash) [Select]
lsmod. And maybe see if there some firmware being loaded as well.