Replies: 5 comments
-
|
We will want some way to reopen the vdevs using |
Beta Was this translation helpful? Give feedback.
-
|
@behlendorf why this was closed? |
Beta Was this translation helpful? Give feedback.
-
|
This hasn't yet been implemented. Though I agree it's an interesting idea. I've migrated it to the new GtiHub Discussions "Ideas" section. I'd like to try and start tracking feature requests there keep them separate from the other bugs. |
Beta Was this translation helpful? Give feedback.
-
|
any progress on this? do we still need an initrd to boot from a zfs pool? |
Beta Was this translation helpful? Give feedback.
-
|
That would be awesome! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I used to think an initramfs environment with special logic for ZFS was necessary for system boot because we could not scan
/devfor devices otherwise. After answering this question again for djs in IRC on freenode, I have come to realize that is wrong.During very early boot before the rootfs mount, we should have something like this:
That
kthread_runcallsdevtmpfsdwhiledevtmpfs_initwaits fordevtmpfsdto signal completion before proceeding:https://github.com/torvalds/linux/blob/v4.1/drivers/base/devtmpfs.c#L376
That shows that we do have a
/devfilesystem on which we can use kernel functions such asvfs_openanditerate_dirduring early boot to scan the devices from inside the kernel's mount routine.When booting ext4, we would have a stack trace like this, with ext4 using a filesystem path passed to
ext4_mountto find its root device. That is the path to/dev/root, which is unfortunately hard coded in the kernel. When ext4 gets it, it is just "root" because the first 5 characters in the string are skipped:In the case of booting Linux in QEMU with an
9p-virtiorootfs without an initramfs,root=/dev/root rootfstype=9p rootflags=trans=virtio,version=9p2000.Lis passed on the kernel commandline and from a cursory reading of the Linux kernel 4.1.0 source, the following stack should occur:We then see
VFS: Mounted root (9p filesystem) readonly on device 0:17.printed to dmesg and the system boots. This only works if the 9p-virtio server in QEMU is passedid=rootthrough an appropriate-fsdevparameter on QEMU's commandline because the first 5 characters of/dev/rootare skipped.I wrote a small patch a couple years ago that allowed an initramfs to boot the system with a similar kernel commandline and both the modules (when not kernel builtin) and zpool.cache file in the initramfs. If I recall correctly, it worked by hooking
zpl_fill_super. At the time,/devneeded to be mounted and the SPL needed/sys, although /sys should no longer be a necessity. That patch was lost at some point, but it showed that we could simplify the boot process in such a way that we would not require any special treatment by the initramfs if we could scan /dev during early boot. It had been abandoned because we needed to do in-kernel device scanning and I did not think that was possible at the time.I am filing this as a reminder for myself of these things and also to offer anyone able to implement this before I find time the opportunity. Whoever implements this will need to either handle the situation where
/proc/self/mountsand also if it is not a symlink,/etc/mtabshow/dev/root(or is itroot?) instead of the dataset name or find a way to override it during the mount process.I have revised this following some comments by @floppym on an earlier version of this issue.
Beta Was this translation helpful? Give feedback.
All reactions