Skip to contentSkip to conversation

add --device option

PATCH Superseded [email protected] 2 participants 12 messages Aug 17, 2012 – Aug 21, 2012 8 messages not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover add --device option

This is the update patch series for --device option. 1/3: wait host devs in base module
2/3: Add for_each_host_dev for device only checking
3/3: Add a dracut option --device to bring up a device in initramfs

---
 dracut-functions.sh                     |   15 +++++++++++++++
 dracut.8.asc                            |    3 +++
 dracut.sh                               |   22 ++++++++++++++++++++++
 modules.d/90lvm/module-setup.sh         |    2 +-
 modules.d/90multipath/module-setup.sh   |    2 +-
 modules.d/95fstab-sys/module-setup.sh   |    1 -
 modules.d/95fstab-sys/wait-mount-dev.sh |   22 ----------------------
 modules.d/95iscsi/module-setup.sh       |    2 +-
 modules.d/99base/module-setup.sh        |    1 +
 modules.d/99base/wait-host-devs.sh      |   20 ++++++++++++++++++++
 10 files changed, 64 insertions(+), 26 deletions(-)
#1 lore raw

PATCH 1/3 wait host devs in base module

each dev in host_devs[] should be waited in initqueue to make sure they are oneline before initqueue finish.

Add a new wait_host_devs.sh in base module to make this a generic thing. Because all the devs in fstab lines are also added to host_devs, so no need do same wait in fstab-sys module anymore.

Chaowang: add slave devices to host_devs as well.

---
 dracut.sh                               |   19 +++++++++++++++++++
 modules.d/95fstab-sys/module-setup.sh   |    1 -
 modules.d/95fstab-sys/wait-mount-dev.sh |   22 ----------------------
 modules.d/99base/module-setup.sh        |    1 +
 modules.d/99base/wait-host-devs.sh      |   20 ++++++++++++++++++++
 5 files changed, 40 insertions(+), 23 deletions(-)
dracut.sh +19 -0
@@ -769,6 +769,20 @@ for dev in "${host_devs[@]}"; do
     done
 done
 
+_get_block_dev() {
+    echo `readlink -f /dev/block/$1`; return 1;
+}
+
+for dev in "${host_devs[@]}"; do
+    unset _dev
+    for _dev in $(check_block_and_slaves _get_block_dev $(get_maj_min $dev)); do
+       [ -b "$_dev" ] || continue
+        if ! strstr " ${host_devs[*]} " " $_dev ";then
+            push host_devs "$_dev"
+        fi
+    done
+done
+
 [[ -d $udevdir ]] \
     || udevdir=$(pkg-config udev --variable=udevdir 2>/dev/null)
 if ! [[ -d "$udevdir" ]]; then
@@ -903,6 +917,11 @@ done
 
 dinfo "*** Including modules done ***"
 
+## save host_devs which we need bring up
+for _dev in ${host_devs[@]}; do
+    echo $_dev >> $initdir/etc/host_devs
+done
+
 ## final stuff that has to happen
 if [[ $no_kernel != yes ]]; then
 
modules.d/95fstab-sys/module-setup.sh +0 -1
@@ -13,5 +13,4 @@ depends() {
 install() {
     [ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys
     inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
-    inst_hook cmdline 00 "$moddir/wait-mount-dev.sh"
 }
modules.d/95fstab-sys/wait-mount-dev.sh deleted +0 -22
@@ -1,22 +0,0 @@
-#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
-
-fstab_wait_dev() {
-    local _dev _mp _fs _opts _dump _pass _rest
-    test -e "$1" || return 1
-    while read _dev _mp _fs _opts _dump _pass _rest; do
-        [ -z "${_dev%%#*}" ] && continue # Skip comment lines
-        case "$_dev" in
-        /dev/?*)
-            wait_for_dev $_dev;;
-        *) ;;
-        esac
-    done < $1
-    return 0
-}
-
-[ -f /etc/fstab ] && fstab_wait_dev /etc/fstab
modules.d/99base/module-setup.sh +1 -0
@@ -41,6 +41,7 @@ install() {
     dracut_install switch_root || dfatal "Failed to install switch_root"
 
     inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
+    inst_hook cmdline 00 "$moddir/wait-host-devs.sh"
     inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
     mkdir -p "${initdir}/var"
     [ -x /lib/systemd/systemd-timestamp ] && inst /lib/systemd/systemd-timestamp
modules.d/99base/wait-host-devs.sh new file +20 -0
@@ -0,0 +1,20 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+wait_host_devs() {
+    local _dev
+
+    while read _dev; do
+        case "$_dev" in
+        /dev/?*)
+            wait_for_dev $_dev
+            ;;
+        *) ;;
+        esac
+    done < $1
+}
+
+[ -f /etc/host_devs ] && wait_host_devs /etc/host_devs

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Re: [patch 1/3] wait host devs in base module

Quoted 8 lines · On Fri, Aug 17, 2012 at 08:35:20PM +0800…

each dev in host_devs[] should be waited in initqueue to make sure they are oneline before initqueue finish.

Add a new wait_host_devs.sh in base module to make this a generic thing. Because all the devs in fstab lines are also added to host_devs, so no need do same wait in fstab-sys module anymore.

Chaowang: add slave devices to host_devs as well.

Why should we wait for slave devices? If slave device does not come up, top level device will not come up anyway. So I don't think we should wait for slave devices.

Secondly, trying to list slave devices is dangerous as the names you seem to be stroing are not persistent and device renaming will hang the system.

So whereever you are waiting for a device to come up, make sure you are using persistent device name as generated by udev.

Thanks
Vivek

Quoted 111 lines
---
 dracut.sh                               |   19 +++++++++++++++++++
 modules.d/95fstab-sys/module-setup.sh   |    1 -
 modules.d/95fstab-sys/wait-mount-dev.sh |   22 ----------------------
 modules.d/99base/module-setup.sh        |    1 +
 modules.d/99base/wait-host-devs.sh      |   20 ++++++++++++++++++++
 5 files changed, 40 insertions(+), 23 deletions(-)
dracut.sh +19 -0
@@ -769,6 +769,20 @@ for dev in "${host_devs[@]}"; do
     done
 done
 
+_get_block_dev() {
+    echo `readlink -f /dev/block/$1`; return 1;
+}
+
+for dev in "${host_devs[@]}"; do
+    unset _dev
+    for _dev in $(check_block_and_slaves _get_block_dev $(get_maj_min $dev)); do
+       [ -b "$_dev" ] || continue
+        if ! strstr " ${host_devs[*]} " " $_dev ";then
+            push host_devs "$_dev"
+        fi
+    done
+done
+
 [[ -d $udevdir ]] \
     || udevdir=$(pkg-config udev --variable=udevdir 2>/dev/null)
 if ! [[ -d "$udevdir" ]]; then
@@ -903,6 +917,11 @@ done
 
 dinfo "*** Including modules done ***"
 
+## save host_devs which we need bring up
+for _dev in ${host_devs[@]}; do
+    echo $_dev >> $initdir/etc/host_devs
+done
+
 ## final stuff that has to happen
 if [[ $no_kernel != yes ]]; then
 
modules.d/95fstab-sys/module-setup.sh +0 -1
@@ -13,5 +13,4 @@ depends() {
 install() {
     [ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys
     inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
-    inst_hook cmdline 00 "$moddir/wait-mount-dev.sh"
 }
modules.d/95fstab-sys/wait-mount-dev.sh deleted +0 -22
@@ -1,22 +0,0 @@
-#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
-
-fstab_wait_dev() {
-    local _dev _mp _fs _opts _dump _pass _rest
-    test -e "$1" || return 1
-    while read _dev _mp _fs _opts _dump _pass _rest; do
-        [ -z "${_dev%%#*}" ] && continue # Skip comment lines
-        case "$_dev" in
-        /dev/?*)
-            wait_for_dev $_dev;;
-        *) ;;
-        esac
-    done < $1
-    return 0
-}
-
-[ -f /etc/fstab ] && fstab_wait_dev /etc/fstab
modules.d/99base/module-setup.sh +1 -0
@@ -41,6 +41,7 @@ install() {
     dracut_install switch_root || dfatal "Failed to install switch_root"
 
     inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
+    inst_hook cmdline 00 "$moddir/wait-host-devs.sh"
     inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
     mkdir -p "${initdir}/var"
     [ -x /lib/systemd/systemd-timestamp ] && inst /lib/systemd/systemd-timestamp
modules.d/99base/wait-host-devs.sh new file +20 -0
@@ -0,0 +1,20 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+wait_host_devs() {
+    local _dev
+
+    while read _dev; do
+        case "$_dev" in
+        /dev/?*)
+            wait_for_dev $_dev
+            ;;
+        *) ;;
+        esac
+    done < $1
+}
+
+[ -f /etc/host_devs ] && wait_host_devs /etc/host_devs

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#5 lore raw

Re: [patch 1/3] wait host devs in base module

Quoted 8 lines · Vivek Goyal
Quoted 7 lines · On Fri, Aug 17, 2012 at 08:35:20PM +0800…

each dev in host_devs[] should be waited in initqueue to make sure they are oneline before initqueue finish.

Add a new wait_host_devs.sh in base module to make this a generic thing. Because all the devs in fstab lines are also added to host_devs, so no need do same wait in fstab-sys module anymore.

Quoted 5 lines
Quoted 1 line

Chaowang: add slave devices to host_devs as well.

Why should we wait for slave devices? If slave device does not come up, top level device will not come up anyway. So I don't think we should wait for slave devices.

Yes, agree. Adding the slaves is only for patch 2/3, ie. is_scsi with for_each_host_dev. I think I do not fully understand the relations beteen the master and slave devices of iscsi/multipath/etc.

Quoted 7 lines

Secondly, trying to list slave devices is dangerous as the names you seem to be stroing are not persistent and device renaming will hang the system.

So whereever you are waiting for a device to come up, make sure you are using persistent device name as generated by udev.

Agree too, this is a problem. Looking at the fstab-sys wait_mount_dev.sh, there's same issue if the dev name in fstab is not the "persistent device name"

Quoted 4 lines

Thanks
Vivek

Signature · 2 lines
Thanks
Dave

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

Re: [patch 1/3] wait host devs in base module

Quoted 27 lines · Dave Young
Quoted 8 lines · Vivek Goyal
Quoted 7 lines · On Fri, Aug 17, 2012 at 08:35:20PM +0800…

each dev in host_devs[] should be waited in initqueue to make sure they are oneline before initqueue finish.

Add a new wait_host_devs.sh in base module to make this a generic thing. Because all the devs in fstab lines are also added to host_devs, so no need do same wait in fstab-sys module anymore.

Quoted 5 lines
Quoted 1 line

Chaowang: add slave devices to host_devs as well.

Why should we wait for slave devices? If slave device does not come up, top level device will not come up anyway. So I don't think we should wait for slave devices.

Yes, agree. Adding the slaves is only for patch 2/3, ie. is_scsi with for_each_host_dev. I think I do not fully understand the relations beteen the master and slave devices of iscsi/multipath/etc.

Quoted 5 lines

Secondly, trying to list slave devices is dangerous as the names you seem to be stroing are not persistent and device renaming will hang the system.

Quoted 7 lines
Quoted 2 lines

So whereever you are waiting for a device to come up, make sure you are using persistent device name as generated by udev.

Agree too, this is a problem. Looking at the fstab-sys wait_mount_dev.sh, there's same issue if the dev name in fstab is not the "persistent device name"

Non persistent names in /etc/fstab will not make sense as system will be broken across reboots. So it is a requirement to put persistent names only in /etc/fstab.

I think last time I did partial patch to wait for device nodes. But we still need mechanism to convert UUID= and LABEL= into respective persistent device names. Can you please take care of that too while you are at it.

Thanks
Vivek

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#9 lore raw

Re: [patch 1/3] wait host devs in base module

On 08/20/2012 10:59 PM, Vivek Goyal wrote:

[snip]

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

So whereever you are waiting for a device to come up, make sure you are using persistent device name as generated by udev.

Agree too, this is a problem. Looking at the fstab-sys wait_mount_dev.sh, there's same issue if the dev name in fstab is not the "persistent device name"

Quoted 8 lines

Non persistent names in /etc/fstab will not make sense as system will be broken across reboots. So it is a requirement to put persistent names only in /etc/fstab.

I think last time I did partial patch to wait for device nodes. But we still need mechanism to convert UUID= and LABEL= into respective persistent device names. Can you please take care of that too while you are at it.

will fix this in the update patch set.

Quoted 3 lines

Thanks
Vivek

Signature · 2 lines
Thanks
Dave
#10 lore raw

PATCH 2/3 Add for_each_host_dev for device only checking

In reply to [email protected]

For lvm, multipath, iscsi modules they do not care about the filesystem, Also there could be devcie in host_devs but it does not get formated.

For these kind of modules, use for_each_host_dev will be better than use for_each_host_dev_fs, here add a new function to iterate the host_devs.

---
 dracut-functions.sh                   |   15 +++++++++++++++
 modules.d/90lvm/module-setup.sh       |    2 +-
 modules.d/90multipath/module-setup.sh |    2 +-
 modules.d/95iscsi/module-setup.sh     |    2 +-
 4 files changed, 18 insertions(+), 3 deletions(-)
dracut-functions.sh +15 -0
@@ -387,6 +387,21 @@ find_mp_fstype() {
 # finds the major:minor of the block device backing the root filesystem.
 find_root_block_device() { find_block_device /; }
 
+# for_each_host_dev <func>
+# Execute "<func> <dev>" for every "<dev>" found
+# in ${host_devs[@]}
+for_each_host_dev()
+{
+    local _func="$1"
+    local _dev
+    local _ret=1
+    for _dev in ${host_devs[@]}; do
+        [[ -b "$_dev" ]] || continue
+        $_func $_dev && _ret=0
+    done
+    return $_ret
+}
+
 # for_each_host_dev_fs <func>
 # Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found
 # in ${host_fs_types[@]}
modules.d/90lvm/module-setup.sh +1 -1
@@ -22,7 +22,7 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs check_lvm || return 1
+        for_each_host_dev check_lvm || return 1
     }
 
     return 0
modules.d/90multipath/module-setup.sh +1 -1
@@ -16,7 +16,7 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs is_mpath || return 1
+        for_each_host_dev is_mpath || return 1
     }
 
     return 0
modules.d/95iscsi/module-setup.sh +1 -1
@@ -23,7 +23,7 @@ check() {
     )
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs is_iscsi || return 1
+        for_each_host_dev is_iscsi || return 1
     }
     return 0
 }

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [patch 2/3] Add for_each_host_dev for device only checking

Quoted 6 lines · On Fri, Aug 17, 2012 at 08:35:21PM +0800…

For lvm, multipath, iscsi modules they do not care about the filesystem, Also there could be devcie in host_devs but it does not get formated.

For these kind of modules, use for_each_host_dev will be better than use for_each_host_dev_fs, here add a new function to iterate the host_devs.

If we decide not to add slave devices in host_devs, then this will not work.

Vivek

Quoted 65 lines
---
 dracut-functions.sh                   |   15 +++++++++++++++
 modules.d/90lvm/module-setup.sh       |    2 +-
 modules.d/90multipath/module-setup.sh |    2 +-
 modules.d/95iscsi/module-setup.sh     |    2 +-
 4 files changed, 18 insertions(+), 3 deletions(-)
dracut-functions.sh +15 -0
@@ -387,6 +387,21 @@ find_mp_fstype() {
 # finds the major:minor of the block device backing the root filesystem.
 find_root_block_device() { find_block_device /; }
 
+# for_each_host_dev <func>
+# Execute "<func> <dev>" for every "<dev>" found
+# in ${host_devs[@]}
+for_each_host_dev()
+{
+    local _func="$1"
+    local _dev
+    local _ret=1
+    for _dev in ${host_devs[@]}; do
+        [[ -b "$_dev" ]] || continue
+        $_func $_dev && _ret=0
+    done
+    return $_ret
+}
+
 # for_each_host_dev_fs <func>
 # Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found
 # in ${host_fs_types[@]}
modules.d/90lvm/module-setup.sh +1 -1
@@ -22,7 +22,7 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs check_lvm || return 1
+        for_each_host_dev check_lvm || return 1
     }
 
     return 0
modules.d/90multipath/module-setup.sh +1 -1
@@ -16,7 +16,7 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs is_mpath || return 1
+        for_each_host_dev is_mpath || return 1
     }
 
     return 0
modules.d/95iscsi/module-setup.sh +1 -1
@@ -23,7 +23,7 @@ check() {
     )
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs is_iscsi || return 1
+        for_each_host_dev is_iscsi || return 1
     }
     return 0
 }

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#14 lore raw

Re: [patch 2/3] Add for_each_host_dev for device only checking

Quoted 10 lines · Vivek Goyal
Quoted 6 lines · On Fri, Aug 17, 2012 at 08:35:21PM +0800…

For lvm, multipath, iscsi modules they do not care about the filesystem, Also there could be devcie in host_devs but it does not get formated.

For these kind of modules, use for_each_host_dev will be better than use for_each_host_dev_fs, here add a new function to iterate the host_devs.

If we decide not to add slave devices in host_devs, then this will not work.

If we add a line in fstab, then the dev|fs are added to host_fs_types. What I'm confusing now is why the for_each_host_dev_fs works without the slave devices in host_fs_types.

Quoted 3 lines

Vivek

Signature · 2 lines
Thanks
Dave

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

Re: [patch 2/3] Add for_each_host_dev for device only checking

Quoted 10 lines · Dave Young
Quoted 8 lines · Vivek Goyal
Quoted 6 lines · On Fri, Aug 17, 2012 at 08:35:21PM +0800…

For lvm, multipath, iscsi modules they do not care about the filesystem, Also there could be devcie in host_devs but it does not get formated.

For these kind of modules, use for_each_host_dev will be better than use for_each_host_dev_fs, here add a new function to iterate the host_devs.

Quoted 7 lines
Quoted 2 lines

If we decide not to add slave devices in host_devs, then this will not work.

If we add a line in fstab, then the dev|fs are added to host_fs_types. What I'm confusing now is why the for_each_host_dev_fs works without the slave devices in host_fs_types.

Because if slave devices have not come up, top level devices in the stack will not come up. (I think multipath might be exception here).

So I think it should be sufficient to wait for top level block deivce to come up.

Thanks
Vivek

#17 lore raw

PATCH 3/3 Add a dracut option --device to bring up a device in initramfs

In reply to [email protected]

Kdump support dump to raw device which could be on top of complex storage such as multipath and iscsi which are standalone dracut modules.

Add a --device option to dracut which will add the device to host_devs so dracut can add the dependent modules automaticlly and enable them in initramfs.

--device will accept device node name as the param.

---
 dracut.8.asc |    3 +++
 dracut.sh    |    3 +++
 2 files changed, 6 insertions(+)
dracut.sh +3 -0
@@ -133,6 +133,7 @@ Creates initial ramdisk images for prelo
   --mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
                         Mount device [DEV] on mountpoint [MP] with filesystem
                         [FSTYPE] and options [FSOPTS] in the initramfs
+  --device "[DEV]"      Bring up [DEV] in initramfs
   -i, --include [SOURCE] [TARGET]
                         Include the files in the SOURCE directory into the
                          Target directory in the final initramfs.
@@ -261,6 +262,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
     --long fscks: \
     --long add-fstab: \
     --long mount: \
+    --long device: \
     --long nofscks: \
     --long ro-mnt \
     --long kmoddir: \
@@ -327,6 +329,7 @@ while :; do
         --fscks)       push fscks_l              "$2"; shift;;
         --add-fstab)   push add_fstab_l          "$2"; shift;;
         --mount)       push fstab_lines          "$2"; shift;;
+        --device)      push host_devs            "$2"; shift;;
         --nofscks)     nofscks_l="yes";;
         --ro-mnt)      ro_mnt_l="yes";;
         -k|--kmoddir)  drivers_dir_l="$2"; shift;;
dracut.8.asc +3 -0
@@ -321,6 +321,9 @@ provide a valid _/etc/fstab_.
     Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
     options>_ in the initramfs
 
+**--device** _<device>_ ::
+    Bring up _<device>_ in initramfs, _<device>_ should be the device name
+
 **-i, --include** _<SOURCE>_ _<TARGET>_::
     include the files in the SOURCE directory into the
     TARGET directory in the final initramfs. If SOURCE is a file, it will be

A message that is not in the archive (sent off-list or not yet received): [email protected]

#19 lore raw

Re: [patch 3/3] Add a dracut option --device to bring up a device in initramfs

Quoted 7 lines · On Fri, Aug 17, 2012 at 08:35:22PM +0800…

Kdump support dump to raw device which could be on top of complex storage such as multipath and iscsi which are standalone dracut modules.

Add a --device option to dracut which will add the device to host_devs so dracut can add the dependent modules automaticlly and enable them in initramfs.

--device will accept device node name as the param.

Last time you mentioned that device should be device node as /dev/sda. I think that can fail due to device renaming.

So make sure to specify here that device name here should be persistent device name as generated by udev. (/dev/disk/by-id/* or /dev/disk/by-uuid/*).

Thanks
Vivek

Quoted 46 lines
---
 dracut.8.asc |    3 +++
 dracut.sh    |    3 +++
 2 files changed, 6 insertions(+)
dracut.sh +3 -0
@@ -133,6 +133,7 @@ Creates initial ramdisk images for prelo
   --mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
                         Mount device [DEV] on mountpoint [MP] with filesystem
                         [FSTYPE] and options [FSOPTS] in the initramfs
+  --device "[DEV]"      Bring up [DEV] in initramfs
   -i, --include [SOURCE] [TARGET]
                         Include the files in the SOURCE directory into the
                          Target directory in the final initramfs.
@@ -261,6 +262,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
     --long fscks: \
     --long add-fstab: \
     --long mount: \
+    --long device: \
     --long nofscks: \
     --long ro-mnt \
     --long kmoddir: \
@@ -327,6 +329,7 @@ while :; do
         --fscks)       push fscks_l              "$2"; shift;;
         --add-fstab)   push add_fstab_l          "$2"; shift;;
         --mount)       push fstab_lines          "$2"; shift;;
+        --device)      push host_devs            "$2"; shift;;
         --nofscks)     nofscks_l="yes";;
         --ro-mnt)      ro_mnt_l="yes";;
         -k|--kmoddir)  drivers_dir_l="$2"; shift;;
dracut.8.asc +3 -0
@@ -321,6 +321,9 @@ provide a valid _/etc/fstab_.
     Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
     options>_ in the initramfs
 
+**--device** _<device>_ ::
+    Bring up _<device>_ in initramfs, _<device>_ should be the device name
+
 **-i, --include** _<SOURCE>_ _<TARGET>_::
     include the files in the SOURCE directory into the
     TARGET directory in the final initramfs. If SOURCE is a file, it will be