Diskless computer using ReadyNAS and Gargoyle using PXE and iSCSI
Test iSCSI
The LUN is created on ReadyNAS (192.168.1.28) in group CentOS-PXE, target iqn.1994-11.com.netgear:nas:08303042:centos-pxe.
All commands are run from my laptop (T530), but it can be any Linux:
[root@T530 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.1.28 192.168.1.28:3260,1 iqn.1994-11.com.netgear:nas:051ada19:group1 192.168.1.28:3260,1 iqn.1994-11.com.netgear:nas:08303042:centos-pxe
We are interested in the second one:
[root@T530 ~]# iscsiadm -m node -T 'iqn.1994-11.com.netgear:nas:08303042:centos-pxe' -p 192.168.1.28 -l Logging in to [iface: default, target: iqn.1994-11.com.netgear:nas:08303042:centos-pxe, portal: 192.168.1.28,3260] (multiple) Login to [iface: default, target: iqn.1994-11.com.netgear:nas:08303042:centos-pxe, portal: 192.168.1.28,3260] successful.
Now we can list disks:
[root@T530 ~]# ls -l /dev/disk/by-path razem 0 lrwxrwxrwx. 1 root root 9 10-22 17:25 fc---lun-0 -> ../../sdd iqn.1994-11.com.netgear:nas:08303042:centos-pxe-lun-0 -> ../../sdd lrwxrwxrwx. 1 root root 9 10-22 16:29 pci-0000:00:0d.0-ata-1.0 -> ../../sda lrwxrwxrwx. 1 root root 10 10-22 16:29 pci-0000:00:0d.0-ata-1.0-part1 -> ../../sda1 lrwxrwxrwx. 1 root root 10 10-22 16:29 pci-0000:00:0d.0-ata-1.0-part2 -> ../../sda2 lrwxrwxrwx. 1 root root 9 10-22 16:29 pci-0000:00:0d.0-ata-2.0 -> ../../sr0
as you can see, the new volume is linked as /dev/sdd usualy it will be sda or sdb.
Now we can "unmount" as it won't be needed.
iscsiadm -m node -T 'iqn.1994-11.com.netgear:nas:08303042:centos-pxe' -p 192.168.1.28 -u
Configure network install
You will need: tftp, dhcp and ftp server and CentOS installation ISO file. Unpack ISO content to ftp server to some (CentOS7-1908-minimal in my case) directory.
Add entry in /data/tftpboot/pxelinux.cfg/default file:
LABEL InstallCentOS7 MENU LABEL Install CentOS 7 1908 KERNEL /networkboot/CentOS7-1908/vmlinuz APPEND initrd=/networkboot/CentOS7-1908/initrd.img inst.repo=ftp://192.168.1.28/CentOS7-1908-minimal
You have to create networkboot/CentOS7-1908 directory in your tftp root directory. In my (ReadtNAS) case /data/tftpboot/, so full path is /data/tftpboot/networkboot/CentOS7-1908.
Files vmlinux and initrd.img are from ISO from isolinux directory. Because my ftp root is /data/pub/ I typed:
cp /data/pub/CentOS-7-x86_64-Minimal-1908/isolinux/{vmlinuz,initrd.img} /data/tftpboot/networkboot/CentOS7-1908
Now you should be able to run CentOS installation from network.
Installation
Boot computer from network (PXE BOOT) choose Install CentOS 7 1908 from pxe menu.
Run standard installator. As Installation destination add disk in Specialized & Network Disks. In Add iSCSI Target... enter 192.168.1.28 as Target IP Address and click Start discovery. Choose desired node (if you have more than one you should know what do do) and click Log in and (after a while) OK.
Now you should have some drive (sda, sdb or similar) - select it and click Done. Probably there will be Error checking storage configuration message - click Full disk summary and boot loader ... and unselect your disk as a boot device by clicking Do not install boot loader. Click Done.
Now be sure the name of your network card. In my case it is enp0s3.
You can add more installation repositories, but it is not necessary now.
Click Begin installation. It will take a while - in the meantime you can set root password.
When installation is complete switch to console (Ctrl-Alt-F2) and copy vmlinuz and initramfs files to your tftp server:
scp /mnt/sysimage/boot/vmlinuz-3.10.0-1062.el7.x86_64 /mnt/sysimage/boot/initramfs-3.10.0-1062.el7.x86_64.img user@192.168.1.28:
and place this two files in tftp directory:
mv /home/user/vmlinuz-3.10.0-1062.el7.x86_64 /home/user/initramfs-3.10.0-1062.el7.x86_64.img /data/tftpboot/networkboot/CentOS7-1908
as you can see I use the same directory as in network install, but it is no necessary.
Now it is time to final PXE configuration on tftp server prepare entry similar to:
LABEL Centos7 MENU DEFAULT MENU LABEL Cent OS 7 kernel /networkboot/CentOS7-1908/vmlinuz-3.10.0-1062.el7.x86_64 root=/dev/mapper/centos-root ro netroot=iscsi:@192.168.1.28::::iqn.1994-11.com.netgear:nas:08303042:centos-pxe rd.iscsi.initiator=iqn.1994-05.com.redhat:2f3474eec735 vconsole.keymap=pl LANG=en_GB.UTF-8 console=tty0 ip=enp3s0:dhcp rhgb quiet append initrd=/networkboot/CentOS7-1908/initramfs-3.10.0-1062.el7.x86_64.img
You can check "magic numbers" on freshly installed system by:
[anaconda root@localhost /]# cat /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.1994-05.com.redhat:2f3474eec735 [anaconda root@localhost /]# iscsiadm -m session tcp: [1] 192.168.1.28:3260,1 iqn.1994-11.com.netgear:nas:08303042:centos-pxe [anaconda root@localhost /]# grep root /mnt/sysimage/etc/fstab /dev/mapper/centos-root / xfs defaults,_netdev,_netdev 0 0
Now you can click Reboot.
After some time you have network booted system.
Configure iPXE
Instead of PXE I should be possible to use iPXE. For now I can only boot iPXE - then I return to PXE because it works.
Download binary (on ReadyNAS - TFTP server) and move to tftp directory:
cd /tmp/ wget http://boot.ipxe.org/undionly.kpxe mv /tmp/undionly.kpxe /data/tftpboot/
Not to have to flash network card ROM I use PXE chainloading. Change (on Gargoyle - DHCP server):
dhcp-match=set:ipxe,175 dhcp-boot=tag:!ipxe,undionly.kpxe,,192.168.1.28 dhcp-boot=menu.ipxe,,192.168.1.28
It should be more convenient way to upgrade kernel in future.
For now, in menu.ipxe I've entry:
:pxelinux set 210:string tftp://192.168.1.28/ chain ${210:string}pxelinux.0 || goto failed goto start
Sources:
Diskless iSCSI boot with PXE HOWTO
How to chainload ipxe using dnsmasq?
Centos 7 Diskless Environment – PXE booting OpenStack compute nodes from iSCSI SAN
Kommentare
Bitte melden Sie sich Logan oder registrieren Sie sich um kommentieren zu können.