# ZFS root problems with initramfs

## WxY

Hi all,

I've been trying to use ZFS as my rootfs with 12 disks attached to a M1015 controller plus expander. Obvious problem is the asynchronous attachment reorders the disks, making zfs crap its pants unless I create the zpools with disk ids.

anyways I've been having trouble figuring out how to get /dev/disks/by-id symblinks before rootfs is mounted. I've tried genkernel and Dracut generated initramfs but had no luck. I'm about to start making my own initramfs to try and solve this problem, but I'd prefer an existing solution.

anyone have an idea what I'm doing wrong?

----------

## ryao

You are not doing anything wrong. The problem is that by-id is not implemented in genkernel. It was considered a low priority because no one requested it.

I am working on a patch that could help, but it is in an early stage of development. I suggest filing bug reports on the Gentoo bug tracker and ZFSOnLinux github issue tracker.

----------

## WxY

Thanks for the fast response. I'll get on that as soon as I restore connectivity. I'm typing this on my phone cause the affected machine is the ISCSI target serving the gateway VM disk LUNs.

so anyways, I was thinking of copying over the udev rules and trying to get mdev to run them. This should be possible right?

----------

## ryao

 *WxY wrote:*   

> Thanks for the fast response. I'll get on that as soon as I restore connectivity. I'm typing this on my phone cause the affected machine is the ISCSI target serving the gateway VM disk LUNs.
> 
> so anyways, I was thinking of copying over the udev rules and trying to get mdev to run them. This should be possible right?

 

I am afraid that it is not possible. mdev does not understand udev rules. Custom rules need to be written just for mdev. There is the possibility of bringing udev into genkernel's initramfs, which would solve this issue. Sabayon's genkernel already has this functionality. It could be ported, but one of us will need to make time to do it. I think Sabayon's genkernel is already in the tree as sys-kernel/genkernel-next. In theory, you should be able to use that to get this functionality, but I have not tested it and my plan is to merge the Sabayon changes back into genkernel.

----------

## WxY

Alright! Genkernel-next produced a good initramfs. it seems to incorrectly report a pool import error though. But it boots and the pool survives order changes just fine. So it seems like a good interim solution.

And now begins the long restoration from tape >_>

I'll remember to file that issue. And thanks for the support, you just saved me from having to obtain a license from horacle.

----------

