So lets begin with my trash English. Funny thing is that CentOS 6.9 has no problem mounting iSCSI disk and installing on it and then later boot from it only thing you need to add into kernel parameters is

linux16 /vmlinuz-3.10.0-693.21.1.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto ip=dhcp netroot=iscsi:

initrd16 /initramfs-3.10.0-693.21.1.el7.x86_64.img

Setting up TFTP server

  1. Setting up dhcp TODO::
  2. Setting up tftp server TODO::

Creating CentOS disk image

Create raw disk image for iscsi target by creating virtual machine or

# dd if=/dev/zero of=gameserver.img bs=1M count=50000

Contents of my targets.conf

# cat /etc/tgt/targets.conf

default-driver iscsi

<target centos>
        backing-store /Storage/iscsi/centos.img

One method is to create virtual machine with raw disk, and then install CentOS 7 normally, second method is that you create empty image, and boot centos installer and mount iscsi disk and install CentOS without boot loader. First method is simpler if your disk is small like 50Gb, i guess super big disks are not that fun to copy over network. Second method requires much more fiddling, you need to chroot disk after installation and grub2-install and grub2-mkconfig -o /boot/grub2/grub.cfg becouse CentOS 7 installer fails creating boot data and this means you need to restore it.

Method #1 Adding iscsi module and network drivers

Boot up your VM. First in CentOS 7 you need to install iscsi-initator tools, and you may need to add network card driver into initramfs, if you do first boot from network and you get stuck "Loading basic system" then there is chance that kernel does not have your driver in initramfs, why are drivers missing, because normaly centos attaches volumes and then kernel has access to modules but you cant load modules if you dont have any drives volumes yet.

# yum install iscsi-initiator-utils

# dracut /boot/initramfs-$(uname -r).img --add "iscsi" --add-drivers "r8169" --no-early-microcode --force

# vi /etc/default/grub then add: GRUB_CMDLINE_LINUX="ip=dhcp netroot=iscsi:<iscsi server/target ip>::::<Target name iqn.2018-03.....>" if you dont have this, kernel can't mount drive

Method #2 Adding iscsi module and network drivers +more pain


Category: Information technology
Hits: 2312