// Module included in the following assemblies
//
// * installing/installing_bare_metal/upi/installing-bare-metal.adoc
// * installing/installing_bare_metal/upi/installing-restricted-networks-bare-metal.adoc
// * installing_bare_metal/upi/installing-bare-metal-network-customizations.adoc

:_mod-docs-content-type: PROCEDURE
[id="installation-user-infra-machines-advanced-customizing-live-{boot}-iscsi-ibft_{context}"]
= Customizing a live install {boot-media} for an iSCSI boot device with iBFT

[role="_abstract"]
You can set the iSCSI target and initiator values for automatic mounting, booting and configuration using a customized version of the live {op-system} image.

.Prerequisites
. You have an iSCSI target you want to install {op-system} on.
. Optional: You have multipathed your iSCSI target.

.Procedure

. Download the `coreos-installer` binary from the link:https://mirror.openshift.com/pub/openshift-v4/clients/coreos-installer/latest/[`coreos-installer` image mirror] page.

ifeval::["{boot-media}" == "ISO image"]
. Retrieve the {op-system} ISO image from the link:https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/latest/[{op-system} image mirror] page and run the following command to customize the ISO image with the following information:
+
[source,text]
----
$ coreos-installer iso customize \
    --pre-install mount-iscsi.sh \
    --post-install unmount-iscsi.sh \
    --dest-device /dev/mapper/mpatha \
    --dest-ignition config.ign \
    --dest-karg-append rd.iscsi.firmware=1 \
    --dest-karg-append rd.multipath=default \
    -o custom.iso rhcos-<version>-live.x86_64.iso
----
+
where:
+
`mount-iscsi.sh`:: Specifies the script that gets run before installation. It should contain the `iscsiadm` commands for mounting the iSCSI target and any commands enabling multipathing.
`unmount-iscsi.sh`:: Specifies the script that gets run after installation. It should contain the command `iscsiadm --mode node --logout=all`.
`/dev/mapper/mpatha`:: Specifies the path to the device. If you are using multipath, the multipath device, `/dev/mapper/mpatha`, If there are multiple multipath devices connected, or to be explicit, you can use the World Wide Name (WWN) symlink available in `/dev/disk/by-path`.
`config.ign`:: Specifies the Ignition configuration for the destination system.
`rd.iscsi.firmware=1`::Specifies the iSCSI parameter is read from the BIOS firmware.
`rd.multipath=default`:: Specifies if you want to enable multipathing. Optional parameter.
endif::[]

ifeval::["{boot-media}" == "PXE environment"]
. Retrieve the {op-system} `kernel`, `initramfs`, and `rootfs` files from the link:https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/latest/[{op-system} image mirror] page and run the following command to create a new customized `initramfs` file with the following information:
+
[source,text]
----
$ coreos-installer pxe customize \
    --pre-install mount-iscsi.sh \
    --post-install unmount-iscsi.sh \
    --dest-device /dev/mapper/mpatha \
    --dest-ignition config.ign \
    --dest-karg-append rd.iscsi.firmware=1 \
    --dest-karg-append rd.multipath=default \
    -o custom.img rhcos-<version>-live-initramfs.x86_64.img
----
+
where:
+
`mount-iscsi.sh`:: Specifies the script that gets run before installation. It should contain the `iscsiadm` commands for mounting the iSCSI target.
`unmount-iscsi.sh`:: Specifies the script that gets run after installation. It should contain the command `iscsiadm --mode node --logout=all`.
`/dev/mapper/mpatha`:: Specifies the path to the device. If you are using multipath, the multipath device, `/dev/mapper/mpatha`, If there are multiple multipath devices connected, or to be explicit, you can use the World Wide Name (WWN) symlink available in `/dev/disk/by-path`.
`config.ign`:: Specifies the Ignition configuration for the destination system.
`rd.iscsi.firmware=1`:: Specifies the iSCSI parameter is read from the BIOS firmware.
`rd.multipath=default`:: Specifies if you want to enable multipathing. Optional parameter.
endif::[]
+
For more information about see the `dracut.cmdline` manual page.
