1 From: Darik Horn <dajhorn@vanadac.com>
2 Date: Tue, 17 Jan 2012 20:27:32 -0600
3 Subject: Remove the upstream dracut component.
5 The dracut/ component broke deb systems when it first added to the
6 upstream ZoL repository, had a near-zero download count when it was
7 fixed, seems to be unmaintained, and is incompatible with the
8 dracut-005 package that is currently published in Debian and Ubuntu.
12 dracut/90zfs/.gitignore | 3 -
13 dracut/90zfs/Makefile.am | 21 -----
14 dracut/90zfs/module-setup.sh.in | 55 -------------
15 dracut/90zfs/mount-zfs.sh.in | 71 -----------------
16 dracut/90zfs/parse-zfs.sh.in | 58 --------------
17 dracut/Makefile.am | 3 -
18 dracut/README.dracut.markdown | 166 ---------------------------------------
19 9 files changed, 1 insertion(+), 380 deletions(-)
20 delete mode 100644 dracut/90zfs/.gitignore
21 delete mode 100644 dracut/90zfs/Makefile.am
22 delete mode 100755 dracut/90zfs/module-setup.sh.in
23 delete mode 100755 dracut/90zfs/mount-zfs.sh.in
24 delete mode 100755 dracut/90zfs/parse-zfs.sh.in
25 delete mode 100644 dracut/Makefile.am
26 delete mode 100644 dracut/README.dracut.markdown
28 diff --git a/Makefile.am b/Makefile.am
29 index 833bee6..fac18fd 100644
32 @@ -5,7 +5,7 @@ include $(top_srcdir)/config/arch.am
36 -SUBDIRS += dracut udev etc man scripts lib cmd
37 +SUBDIRS += udev etc man scripts lib cmd
41 diff --git a/configure.ac b/configure.ac
42 index da40356..2e136d3 100644
45 @@ -56,8 +56,6 @@ ZFS_AC_DEBUG_DMU_TX
50 - dracut/90zfs/Makefile
54 diff --git a/dracut/90zfs/.gitignore b/dracut/90zfs/.gitignore
55 deleted file mode 100644
56 index 6f4a5ae..0000000
57 --- a/dracut/90zfs/.gitignore
63 diff --git a/dracut/90zfs/Makefile.am b/dracut/90zfs/Makefile.am
64 deleted file mode 100644
65 index 4112061..0000000
66 --- a/dracut/90zfs/Makefile.am
69 -pkgdracutdir = $(datadir)/dracut/modules.d/90zfs
70 -pkgdracut_SCRIPTS = \
71 - $(top_srcdir)/dracut/90zfs/module-setup.sh \
72 - $(top_srcdir)/dracut/90zfs/mount-zfs.sh \
73 - $(top_srcdir)/dracut/90zfs/parse-zfs.sh
76 - $(top_srcdir)/dracut/90zfs/module-setup.sh.in \
77 - $(top_srcdir)/dracut/90zfs/mount-zfs.sh.in \
78 - $(top_srcdir)/dracut/90zfs/parse-zfs.sh.in
80 -$(pkgdracut_SCRIPTS):
81 - -$(SED) -e 's,@bindir\@,$(bindir),g' \
82 - -e 's,@sbindir\@,$(sbindir),g' \
83 - -e 's,@udevdir\@,$(udevdir),g' \
84 - -e 's,@udevruledir\@,$(udevruledir),g' \
85 - -e 's,@sysconfdir\@,$(sysconfdir),g' \
89 - -$(RM) $(pkgdracut_SCRIPTS)
90 diff --git a/dracut/90zfs/module-setup.sh.in b/dracut/90zfs/module-setup.sh.in
91 deleted file mode 100755
92 index c01915e..0000000
93 --- a/dracut/90zfs/module-setup.sh.in
99 - # We depend on udev-rules being loaded
100 - [ "$1" = "-d" ] && return 0
102 - # Verify the zfs tool chain
103 - which zpool >/dev/null 2>&1 || return 1
104 - which zfs >/dev/null 2>&1 || return 1
121 - instmods zlib_deflate
122 - instmods zlib_inflate
126 - inst_rules @udevruledir@/90-zfs.rules
127 - inst_rules @udevruledir@/60-zpool.rules
128 - inst_rules @udevruledir@/60-zvol.rules
129 - inst @sysconfdir@/zfs/zdev.conf
130 - inst @sysconfdir@/zfs/zpool.cache
131 - dracut_install @sbindir@/zfs
132 - dracut_install @sbindir@/zpool
133 - dracut_install @bindir@/zpool_layout
134 - dracut_install @udevdir@/zpool_id
135 - dracut_install @udevdir@/zvol_id
136 - dracut_install mount.zfs
137 - dracut_install hostid
138 - inst_hook cmdline 95 "$moddir/parse-zfs.sh"
139 - inst_hook mount 98 "$moddir/mount-zfs.sh"
141 - # Synchronize initramfs and system hostid
143 - AA=`hostid | cut -b 1,2`
144 - BB=`hostid | cut -b 3,4`
145 - CC=`hostid | cut -b 5,6`
146 - DD=`hostid | cut -b 7,8`
147 - printf "\x$DD\x$CC\x$BB\x$AA" >$TMP
148 - inst_simple "$TMP" /etc/hostid
151 diff --git a/dracut/90zfs/mount-zfs.sh.in b/dracut/90zfs/mount-zfs.sh.in
152 deleted file mode 100755
153 index 2d2afd8..0000000
154 --- a/dracut/90zfs/mount-zfs.sh.in
159 -. /lib/dracut-lib.sh
163 -if getargbool 0 zfs_force -y zfs.force -y zfsforce ; then
164 - warn "ZFS: Will force-import pools if necessary."
170 - # We have ZFS modules loaded, so we're able to import pools now.
171 - if [ "$root" = "zfs:AUTO" ] ; then
172 - # Need to parse bootfs attribute
173 - info "ZFS: Attempting to detect root from imported ZFS pools."
175 - # Might be imported by the kernel module, so try searching before
176 - # we import anything.
177 - zfsbootfs=`zpool list -H -o bootfs | sed -n '/-/ !p' | sed 'q'`
178 - if [ "$?" != "0" ] || [ "$zfsbootfs" = "" ] || \
179 - [ "$zfsbootfs" = "no pools available" ] ; then
180 - # Not there, so we need to import everything.
181 - info "ZFS: Attempting to import additional pools."
182 - zpool import -N -a ${ZPOOL_FORCE}
183 - zfsbootfs=`zpool list -H -o bootfs | sed -n '/-/ !p' | sed 'q'`
184 - if [ "$?" != "0" ] || [ "$zfsbootfs" = "" ] || \
185 - [ "$zfsbootfs" = "no pools available" ] ; then
189 - warn "ZFS: No bootfs attribute found in importable pools."
191 - # Re-export everything since we're not prepared to take
192 - # responsibility for them.
193 - zpool list -H | while read fs rest ; do
200 - info "ZFS: Using ${zfsbootfs} as root."
202 - # Should have an explicit pool set, so just import it and we're done.
203 - zfsbootfs="${root#zfs:}"
204 - pool="${zfsbootfs%%/*}"
205 - if ! zpool list -H $pool > /dev/null ; then
206 - # pool wasn't imported automatically by the kernel module, so
208 - info "ZFS: Importing pool ${pool}..."
209 - if ! zpool import -N ${ZPOOL_FORCE} $pool ; then
210 - warn "ZFS: Unable to import pool ${pool}."
218 - # Above should have left our rpool imported and pool/dataset in $root.
219 - # We need zfsutil for non-legacy mounts and not for legacy mounts.
220 - mountpoint=`zfs get -H -o value mountpoint $zfsbootfs`
221 - if [ "$mountpoint" = "legacy" ] ; then
222 - mount -t zfs "$zfsbootfs" "$NEWROOT" && ROOTFS_MOUNTED=yes
224 - mount -o zfsutil -t zfs "$zfsbootfs" "$NEWROOT" && ROOTFS_MOUNTED=yes
228 diff --git a/dracut/90zfs/parse-zfs.sh.in b/dracut/90zfs/parse-zfs.sh.in
229 deleted file mode 100755
230 index 571d263..0000000
231 --- a/dracut/90zfs/parse-zfs.sh.in
236 -. /lib/dracut-lib.sh
238 -# Let the command line override our host id.
239 -spl_hostid=`getarg spl_hostid=`
240 -if [ "${spl_hostid}" != "" ] ; then
241 - info "ZFS: Using hostid from command line: ${spl_hostid}"
242 - AA=`echo ${spl_hostid} | cut -b 1,2`
243 - BB=`echo ${spl_hostid} | cut -b 3,4`
244 - CC=`echo ${spl_hostid} | cut -b 5,6`
245 - DD=`echo ${spl_hostid} | cut -b 7,8`
246 - printf "\x$DD\x$CC\x$BB\x$AA" >/etc/hostid
247 -elif [ -f /etc/hostid ] ; then
248 - info "ZFS: Using hostid from /etc/hostid: `hostid`"
250 - warn "ZFS: No hostid found on kernel command line or /etc/hostid. "
251 - warn "ZFS: Pools may not import correctly."
256 - # We'll take root unset, root=zfs, or root=zfs:
257 - # No root set, so we want to read the bootfs attribute. We
258 - # can't do that until udev settles so we'll set dummy values
259 - # and hope for the best later on.
264 - info "ZFS: Enabling autodetection of bootfs after udev settles."
267 - ZFS\=*|zfs:*|zfs:FILESYSTEM\=*|FILESYSTEM\=*)
268 - # root is explicit ZFS root. Parse it now. We can handle
269 - # a root=... param in any of the following formats:
270 - # root=ZFS=rpool/ROOT
271 - # root=zfs:rpool/ROOT
272 - # root=zfs:FILESYSTEM=rpool/ROOT
273 - # root=FILESYSTEM=rpool/ROOT
275 - # Strip down to just the pool/fs
276 - root="${root#zfs:}"
277 - root="${root#FILESYSTEM=}"
278 - root="zfs:${root#ZFS=}"
282 - info "ZFS: Set ${root} as bootfs."
286 -# Make sure Dracut is happy that we have a root and will wait for ZFS
287 -# modules to settle before mounting.
288 -if [ "${wait_for_zfs}" = "1" ]; then
289 - ln -s /dev/null /dev/root 2>/dev/null
290 - echo '[ -e /dev/zfs ]' > $hookdir/initqueue/finished/zfs.sh
292 diff --git a/dracut/Makefile.am b/dracut/Makefile.am
293 deleted file mode 100644
294 index 35b88c3..0000000
295 --- a/dracut/Makefile.am
300 -EXTRA_DIST = README.dracut.markdown
301 diff --git a/dracut/README.dracut.markdown b/dracut/README.dracut.markdown
302 deleted file mode 100644
303 index 909273a..0000000
304 --- a/dracut/README.dracut.markdown
307 -How to setup a zfs root filesystem using dracut
308 ------------------------------------------------
310 -1) Install the zfs-dracut package. This package adds a zfs dracut module
311 -to the /usr/share/dracut/modules.d/ directory which allows dracut to
312 -create an initramfs which is zfs aware.
314 -2) Set the bootfs property for the bootable dataset in the pool. Then set
315 -the dataset mountpoint property to '/'.
317 - $ zpool set bootfs=pool/dataset pool
318 - $ zfs set mountpoint=/ pool/dataset
320 -Alternately, legacy mountpoints can be used by setting the 'root=' option
321 -on the kernel line of your grub.conf/menu.lst configuration file. Then
322 -set the dataset mountpoint property to 'legacy'.
324 - $ grub.conf/menu.lst: kernel ... root=ZFS=pool/dataset
325 - $ zfs set mountpoint=legacy pool/dataset
327 -3) To set zfs module options put them in /etc/modprobe.d/zfs.conf file.
328 -The complete list of zfs module options is available by running the
329 -_modinfo zfs_ command. Commonly set options include: zfs_arc_min,
330 -zfs_arc_max, zfs_prefetch_disable, and zfs_vdev_max_pending.
332 -4) Finally, create your new initramfs by running dracut.
334 - $ dracut --force /path/to/initramfs kernel_version
339 -The initramfs' behavior is influenced by the following kernel command line
340 -parameters passed in from the boot loader:
342 -* `root=...`: If not set, importable pools are searched for a bootfs
343 -attribute. If an explicitly set root is desired, you may use
344 -`root=ZFS:pool/dataset`
346 -* `zfs_force=0`: If set to 1, the initramfs will run `zpool import -f` when
347 -attempting to import pools if the required pool isn't automatically imported
348 -by the zfs module. This can save you a trip to a bootcd if hostid has
349 -changed, but is dangerous and can lead to zpool corruption, particularly in
350 -cases where storage is on a shared fabric such as iSCSI where multiple hosts
351 -can access storage devices concurrently. _Please understand the implications
352 -of force-importing a pool before enabling this option!_
354 -* `spl_hostid`: By default, the hostid used by the SPL module is read from
355 -/etc/hostid inside the initramfs. This file is placed there from the host
356 -system when the initramfs is built which effectively ties the ramdisk to the
357 -host which builds it. If a different hostid is desired, one may be set in
358 -this attribute and will override any file present in the ramdisk. The
359 -format should be hex exactly as found in the `/etc/hostid` file, IE
360 -`spl_hostid=0x00bab10c`.
362 -Note that changing the hostid between boots will most likely lead to an
363 -un-importable pool since the last importing hostid won't match. In order
364 -to recover from this, you may use the `zfs_force` option or boot from a
365 -different filesystem and `zpool import -f` then `zpool export` the pool
366 -before rebooting with the new hostid.
371 -The Dracut module consists of the following files (less Makefile's):
373 -* `module-setup.sh`: Script run by the initramfs builder to create the
374 -ramdisk. Contains instructions on which files are required by the modules
375 -and z* programs. Also triggers inclusion of `/etc/hostid` and the zpool
376 -cache. This file is not included in the initramfs.
378 -* `90-zfs.rules`: udev rules which trigger loading of the ZFS modules at boot.
380 -* `parse-zfs.sh`: Run early in the initramfs boot process to parse kernel
381 -command line and determine if ZFS is the active root filesystem.
383 -* `mount-zfs.sh`: Run later in initramfs boot process after udev has settled
384 -to mount the root dataset.
389 -This file is run by the Dracut script within the live system, not at boot
390 -time. It's not included in the final initramfs. Functions in this script
391 -describe which files are needed by ZFS at boot time.
393 -Currently all the various z* and spl modules are included, a dependency is
394 -asserted on udev-rules, and the various zfs, zpool, etc. helpers are included.
395 -Dracut provides library functions which automatically gather the shared libs
396 -necessary to run each of these binaries, so statically built binaries are
399 -The zpool and zvol udev rules files are copied from where they are
400 -installed by the ZFS build. __PACKAGERS TAKE NOTE__: If you move
401 -`/etc/udev/rules/60-z*.rules`, you'll need to update this file to match.
403 -Currently this file also includes `/etc/hostid` and `/etc/zfs/zpool.cache`
404 -which means the generated ramdisk is specific to the host system which built
405 -it. If a generic initramfs is required, it may be preferable to omit these
406 -files and specify the `spl_hostid` from the boot loader instead.
411 -Run during the cmdline phase of the initramfs boot process, this script
412 -performs some basic sanity checks on kernel command line parameters to
413 -determine if booting from ZFS is likely to be what is desired. Dracut
414 -requires this script to adjust the `root` variable if required and to set
415 -`rootok=1` if a mountable root filesystem is available. Unfortunately this
416 -script must run before udev is settled and kernel modules are known to be
417 -loaded, so accessing the zpool and zfs commands is unsafe.
419 -If the root=ZFS... parameter is set on the command line, then it's at least
420 -certain that ZFS is what is desired, though this script is unable to
421 -determine if ZFS is in fact available. This script will alter the `root`
422 -parameter to replace several historical forms of specifying the pool and
423 -dataset name with the canonical form of `zfs:pool/dataset`.
425 -If no root= parameter is set, the best this script can do is guess that
426 -ZFS is desired. At present, no other known filesystems will work with no
427 -root= parameter, though this might possibly interfere with using the
428 -compiled-in default root in the kernel image. It's considered unlikely
429 -that would ever be the case when an initramfs is in use, so this script
430 -sets `root=zfs:AUTO` and hopes for the best.
432 -Once the root=... (or lack thereof) parameter is parsed, a dummy symlink
433 -is created from `/dev/root` -> `/dev/null` to satisfy parts of the Dracut
434 -process which check for presence of a single root device node.
436 -Finally, an initqueue/finished hook is registered which causes the initqueue
437 -phase of Dracut to wait for `/dev/zfs` to become available before attempting
443 -This script is run after udev has settled and all tasks in the initqueue
444 -have succeeded. This ensures that `/dev/zfs` is available and that the
445 -various ZFS modules are successfully loaded. As it is now safe to call
446 -zpool and friends, we can proceed to find the bootfs attribute if necessary.
448 -If the root parameter was explicitly set on the command line, no parsing is
449 -necessary. The list of imported pools is checked to see if the desired pool
450 -is already imported. If it's not, and attempt is made to import the pool
451 -explicitly, though no force is attempted. Finally the specified dataset
452 -is mounted on `$NEWROOT`, first using the `-o zfsutil` option to handle
453 -non-legacy mounts, then if that fails, without zfsutil to handle legacy
456 -If no root parameter was specified, this script attempts to find a pool with
457 -its bootfs attribute set. First, already-imported pools are scanned and if
458 -an appropriate pool is found, no additional pools are imported. If no pool
459 -with bootfs is found, any additional pools in the system are imported with
460 -`zpool import -N -a`, and the scan for bootfs is tried again. If no bootfs
461 -is found with all pools imported, all pools are re-exported, and boot fails.
462 -Assuming a bootfs is found, an attempt is made to mount it to `$NEWROOT`,
463 -first with, then without the zfsutil option as above.
465 -Ordinarily pools are imported _without_ the force option which may cause
466 -boot to fail if the hostid has changed or a pool has been physically moved
467 -between servers. The `zfs_force` kernel parameter is provided which when
468 -set to `1` causes `zpool import` to be run with the `-f` flag. Forcing pool
469 -import can lead to serious data corruption and loss of pools, so this option
470 -should be used with extreme caution. Note that even with this flag set, if
471 -the required zpool was auto-imported by the kernel module, no additional
472 -`zpool import` commands are run, so nothing is forced.