zfsonlinux / pkg-zfs

Native ZFS packaging for Debian and Ubuntu
https://launchpad.net/~zfs-native/+archive/daily
308 stars 55 forks source link

Consider allowing boot=zfs with non-zfs root #115

Closed yacoob closed 9 years ago

yacoob commented 10 years ago

System: Debian wheezy (7.5+backports), ZoL 0.6.3.

I'm running an "unusual" configuration - while my / is not on zfs, /var and /home are. I've had those two set up with mountpoint=legacy, zfs pool would get imported somewhere in rcS.d before mounting all filesystems from /etc/fstab and everything worked fine. Things still worked fine once I've upgraded to 0.6.3, but stopped working once I've upgraded the kernel to 3.14, which forced initramfs-tools upgrade to 0.115~bpo70+1. Past this update, zfs pool would no longer be imported early on, and it would only get pulled in in run level 2, past moment when /var and /home should have already been properly mounted.

After poking and prodding around I've ended up writing a minimal /etc/initramfs-tools/scripts/local-bottom/zfs-import that creates /etc/mtab and blindly imports my pool. It works, but it's rather dumb and not really reliable. I've considered using functions from zfs-initramfs, but I only have access to those when I set boot=zfs on kernel command line - and that makes the mountroot() function from zfs-initramfs import the pool (in a reliable way) AND try to work out what to mount as rootfs (which I do not want).

So, tl;dr: is there a chance to making zfs-initramfs more modular, and allow users to control import and actual root-mounting independently?

yacoob commented 10 years ago

Hello, anyone here? :)

FransUrbo commented 10 years ago

I have some time over (waiting for other things to finish) so I figure I take a look at this...

What exactly is it you want to accomplish? The whole point of the initrd is to find the root filesystem, NOTHING else! That is why the zfs initrd script is written the way it is - we want to make sure that we ONLY import the pool which have the dataset with the root filesystem on it! That's why it's so darn complex...

I do not see an easy way to accomplish what I think you're asking - importing a pool and mount selected filesystems. And even if I could, I'm not sure it would work. Because the initrd scripts remounts the root filesystem, which will clash with any /home or /var filesystems...

Consider this (this is basically how it works):

/ => RAM root filesystem /newroot /newroot/home /newroot/var

When it tries to remount /newroot as /, it will probably not work, because there is filesystems mounted below this...

So unless you have specific code, examples or specific ideas on how this can be done, I'm not going to do anything about this. Sorry, but I can't see what else I could do...

yacoob commented 9 years ago

I believe #101 references the same problem, and contains a viable solution.