-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initramfs scripts for ZoL. #2087
Conversation
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
@FransUrbo Can you force update this branch so it gets tested by the buildbot. Then we can look in to merging it, from your description it appears these scripts have already seen significant use. |
Yes. The Ubuntu packages is using a somewhat older version of these, but the core is still the same. They could need some testing/verification on other platforms, but as I said, I have tested them successfully on Fedora 20... |
Seems to have worked now. 2 failures - could only find one, the Ubuntu 10.04.3-amd64 but that seems to be offline... |
@FransUrbo Thanks, the failures are a little surprising but clearly unrelated to this patch. |
It would be good if we could get someone else familiar with how initramfs works to review these patches. |
b2d0c29
to
3bc2a06
Compare
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
Initramfs scripts for ZoL. * Put in /usr/share/initramfs-tools/ or /etc/initramfs-tools/. * With pull request openzfs#1476 (not yet merged) comes a verbose warning if /usr/bin/net doesn't exist or isn't executable. Just create a dummy... * If user haven't specified pool, but bootfs then use the first part of the bootfs path as pool name. * Add support for booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this the resulting dataset already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Add support for more kernel command line arguments (ideas taken from the Fedora/Redhat dracut script): + (zfs_force|zfs.force|zfsforce)=(on|yes|1) (ignore case). + root=zfs:AUTO => try to find rootfs automatically. + root=zfs:<dataset> + root=ZFS=<dataset> * Remove the existing '-f' option to 'zpool import', instead let this be controlled on the kernel command line. * Do not force-set mountpoint=/ - should (??) not be nessesary. * Support mounting a rootfs with mountpoint=legacy * Support both RPM based and DEB based system by removing the logic from the dracut script and instead use the logic in scripts/zfs-initramfs/scripts/zfs for both Debian GNU/Linux (etc) and RedHat/Fedora (etc). * Only run the local-* script(s) if/when it/they exists. * Don't auto import pools when loading module - keep better control of the imports. * If called with only 'rpool' (or only 'zfs-bootfs'), then fake it by setting 'root=zfs:AUTO' (to avoid duplication of code etc) so that it will be auto detected later. + If pool is specified and we're auto discovering, don't go through ALL pools, only the one we specified. * Rewrite the auto detection of bootfs in the auto detector. * Only try to import pool if it haven't already been imported (in the auto detector). * Add support for only having 'root=pool/dataset' option. * Remove the use of setting 'ZFS_RPOOL=rpool'. No longer nessesary. * Check if /scripts/local-* is either file or directory - should be dir, but just to be safe check both. * Make wait_for_udev wait for 10 seconds. * Add a configurable ZFS_INITRD_POST_MODPROBE_SLEEP (set in /etc/default/zfs) after the modprobe. * Merge openzfs#2196. Remove lines that contain only a hyphen (match '^-$' instead of '-'). * Add a 'default' file to go in '/etc/default/zfs'. * Support mounting additional filesystems (such as /var and /usr etc) in the initrd using ZFS_INITRD_ADDITIONAL_DATASETS set in /etc/defaults/zfs. * Add exceptions to pool imports. + Both for init and initrd script. * Make sure that the zpool.cache file is actually copied onto the initrd!! * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Export all pools found after the modprobe - zfs_autoimport_disable=1' don't seem to be working in >= 0.6.3. + This snippet will go away as soon as I can figure out why it doesn't, it's ugly!! * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Try this first, then fallback to using the cache file if that exist.
@FransUrbo, I looked at this branch per your request, but I can't test or review it because it touches the ZFS crypto parts. |
As in "if command 'zfs get encryption' works, then load the key using 'zfs key'". These are already well known … command line options...= |
@dajhorn, @ryao, @behlendorf It would be nice if you guys could test and implement this in your distro packages so we could have this tested! We really need some consensus on the boot procedure and the functionality. It's just not ok to have to boot every single distribution differently. |
e244a08
to
e9e3663
Compare
def7f99
to
96681c2
Compare
These are taken from the Debian GNU/Linux packages distributed by ZoL, but have been merged with the dracut scripts - one code base for basically the same thing. * Supports booting of a ZFS snapshot. Do this by cloning the snapshot into a dataset. If this, the resulting dataset, already exists, destroy it. Then set mountpoint=/ on that dataset and mount it on root. + If snapshot does not exist, use base dataset (the part before '@') as boot filesystem instead. * Support all currently used kernel command line arguments All the different distributions have their own standard on what to specify on the kernel command line to boot of a ZFS filesystem. * Allows mounting a rootfs with mountpoint=legacy set * Don't auto import pools when loading module - keep better control of the imports. * Only try to import pool if it haven't already been imported + This will negate the need to force import a pool that have not been exported cleanly. + Support exclusion of pools to import by setting ZFS_POOL_EXCEPTIONS in /etc/default/zfs. * Support mounting additional filesystems (such as /var and /usr etc) by the space separated setting ZFS_INITRD_ADDITIONAL_DATASETS in /etc/default/zfs. * Include /etc/modprobe.d/{zfs,spl}.conf in the initrd if they exist. * Include the udev rule to use by-vdev for pool imports. * Include the /etc/default/zfs file to the initrd. * Only try /dev/disk/by-* in the initrd if USE_DISK_BY_ID is set. + Use /dev/disk/by-vdev before anything. + Add /dev as a last ditch attempt. + Fallback to using the cache file if that exist if nothing else worked. * Use /sbin/modprobe instead of built-in (BusyBox) modprobe. This gets rid of the message "modprobe: can't load module zcommon". Thanx to pcoultha for finding this.
Since the Debian GNU/Linux based distributions provide a package that contain these, and they're actually needed to improve (and/or create an initrd with) ZoL, including these in the main ZoL repository makes sense.
These come directly from the https://github.com/zfsonlinux/pkg-zfs/tree/master/debian/wheezy/0.6.2-8_wheezy tag but have been improved upon.
Most notably is:
bootfs=POOL/DATASET@SNAPSHOT
to boot from a snapshotCurrently no logic to put them in place is added. Manually put them in /usr/share/initramfs-tools/ or /etc/initramfs-tools/.
These have been running for quite a number of versions (including the released 0.6.3) of Debian GNU/Linux Wheezy packages (including all the dailes) now and people previously having problems is now reporting success.
It have also successfully been tested on Fedora 20.
If the snapshot doesn't exist (because of a typo on the grub/kernel command line for example) then it (the boot script) will use the base dataset (part before '@') as root filesystem and boot from that - don't attempt to clone or anything.
Even though I'm no longer going to use the native ZFS crypto that's already exists (to unstable and dangerous as well as of questionable licensing), leaving the crypto supports in the script makes sense - it will be available sooner or later and it's not in the way of the functionality.
Closes: #2116, #2114