# initial ramdisk with mdadm_udev hook ala mkinitcpio ?

## svenc

Hi.  I've just installed Gentoo on RAID1 fakeraid (Intel imsm) with LVM2 on top of raid.  I'm booting directly from UEFI partition on same raid and using latest genkernel for an initramfs.  My goal  is Gnome-3.8 so I've currently enabled systemd.  Everything works fine except shutdowns leave raid dirty which forces a sync.  

From https://forums.gentoo.org/viewtopic-t-888520.html it would seem that OpenRC init system doesn't include the following needed command:

```
  mdadm --wait-clean --scan
```

 which marks raid as clean and prevents subsequent syncs.

Solutions to this problem?:

1-create an init ramdisk which has support for mdadm_udev hook that supposedly will cure this.  I learned about this hook here:https://wiki.archlinux.org/index.php/Mkinitcpio.  mkinitcpio has been removed from Gentoo, genkernel does not seem to provide needed hook, I've never used dracut and I'm unable to find if it supports such a hook ?

2-create custom systemd service file to run the needed mdadm command.  Can anybody offer good resource for doing this in Gentoo ?

3-run an OpenRC script from systemd which I believe is possible, but can't figure out how to do ?

Any insights into these questions or how best to solve this problem appreciated, my hard drives have been going non-stop (resyncing) as I install and test installation.

Sven

----------

## eyoung100

Try Rolling your own by using sys-apps/mkinitrd after reading my Old Archived Post on RAM Disks, and then point Grub to that new initrd.

Installing Custom .service files; Writing Service Files.  That isn't my blog.

OpenRC's approach is to use #2 above, and then have the ebuild install the service file. Search for the  openrc USE Flag.  

----------

## svenc

Thanks for reply eyoung100.  I was unable to get this work after spending what time I could.  I first tried installing mkinitcpio from source, but was unable to reconcile path differences when trying to make my own initramfs.  Then tried learning more about systemd and creating my own service files, but could not get it to work. Lastly, although I understand that systemd should be able to start and stop existing openrc services, this never worked for my custom mdadm-shutdown openrc service.  I then tried Archlinux unsuccessfully and finally Fedora successfully.  Although Fedora installed easily and keeps the imsm volumes synced, I find package management very restricted and plan on moving back to Gentoo when possible.  There was a bug reporthttps://bugs.gentoo.org/show_bug.cgi?id=395203 about imsm not working with openrc.  Should this bug report be voted up or another created as Fedora is shows me this is not some buggy imsm implementation ?

Sven

----------

## eyoung100

I would add yourself to the bug and watch it until it is CLOSED.  Gentoo is the only system that still relies natively on openrc.  Most if not all of the other linux's now use systemd as the default.  As users we are slowly being forced in the same direction as everyone else as in GNOME 3.8 systemd is required.  I've fiddled with it, and cant get my Wireless card to work, so I'll stick with OpenRC until systemd is forced upon me.

----------

