Building clusters with UmVirt Linux From Scratch

Preparing ULFS RAW disk image to boot over iSCSI

Linux kernel

First of all iSCSI specific options have to be enabled in kernel:

    Device Drivers > 
      SCSI device support > 
         SCSI low-level drivers

    <M> iSCSI Initiator over TCP/IP [ISCSI_TCP]
    <M> iSCSI Boot Sysfs Interface  [ISCSI_BOOT_SYSFS]

    File systems >
      Pseudo filesystems

    <M>  Userspace-driven configuration filesystem  [CONFIGFS_FS]

    Device Drivers

    <M> Generic Target Core Mod (TCM) and ConfigFS Infrastructure ---> [TARGET_CORE]
       <M> TCM/IBLOCK Subsystem Plugin for Linux/BLOCK [TCM_IBLOCK]
       <M> TCM/FILEIO Subsystem Plugin for Linux/VFS [TCM_FILEIO]
       <M> TCM/pSCSI Subsystem Plugin for Linux/SCSI [TCM_PSCSI]
       <M> TCM/USER Subsystem Plugin for Linux [TCM_USER2]
       <M> TCM Virtual SAS target and Linux/SCSI LDD fabric loopback module [LOOPBACK_TARGET]
       <M> SCSI Target Mode Stack [ISCSI_TARGET]
       <M>    Chelsio iSCSI target offload driver [ISCSI_TARGET_CXGB4]
       <M> TCM Virtual Remote target [REMOTE_TARGET]

Linux kernel source tree is stored in "/usr/src/linux-*" directory.

To edit kerel options run

    make menuconfig

To build kernel run

    chimp kernel_build

To install kernel run

    chimp kernel_install

After kernel installation system should be rebooted.

Open-iSCSI

Also open-iscsi software package is needed to connect to iSCSI resources.

To use open-iscsi install package:

   chimp install open-iscsi

After installation enable and start iscsid service

   systemctl enable iscsid
   systemctl start iscsid

If service is can't start use command below to get error messages:

   journalctl -xeu iscsid.service

If service is started properly, get initiator (client) name and remember it:

   cat /etc/iscsi/initiatorname.iscsi

It will print something like:

   InitiatorName=iqn.2016-04.com.open-iscsi:67637ebdf4a9

A string like "iqn.2016-04.com.open-iscsi:67637ebdf4a9" is initiator name.

Dracut

To boot over iSCSI initramfs is needed.

There are many tools which can be used to build initramfs. Dracut-ng is most simple to use.

To use dracut-ng install package:

   chimp install dracut-ng

After installation check that dracut works:

   dracut

Dracut shold print sometning like:

   ...
   dracut[I]: *** Creating image file '/boot/initramfs-6.13.4.img' ***
   dracut[I]: *** Hardlinking files ***
   dracut[I]: *** Hardlinking files done ***
   dracut[I]: Using auto-determined compression method 'zstd'
   dracut[I]: *** Creating initramfs image file '/boot/initramfs-6.13.4.img' done ***

If file "/boot/initramfs-6.13.4.img" created that means than dracut works properly and initramfs images can be created.

Default dracut settings don't include iscsi module. Add it by command:

   dracut --add iscsi

Now initramfs can be rebuilt. Use command below to rewrite initramfs file which was created earlier:

   dracut --force

You have to see message that iSCSI module is enabled:

   dracut[I]: *** Including module: iscsi ***

GRUB

After initramfs image creation GRUB should be reconfigured.

Addtitional resources