Skip to main content

IT - iSCSI: installing target server Fedora 36 / 37 / 38 / 39

Fedora Installation and iSCSI Target Setup

1. Install Fedora from DVD DL

  • Download latest version from Fedora Server Download
  • Burn DVD DL using the Windows workstation
  • (Apple mac-mini) Plug external DVD DL reader. Mac-mini 015 has a faulty USB port.
  • Plug wired network cable
  • Load Fedora disc, boot
  • Enable root account and SSH for root
  • Add user afberendsen
  • Disk layout with fedora_fedora-root using all space available

2. Initial Setup

  • Set up hostname:
    • sudo hostnamectl set-hostname <host-name>
    • sudo reboot
    • Check prompt
  • Update ~/.bashrc:
export HISTCONTROL=ignoredups:erasedups   # no duplicate entries
export HISTSIZE=100000                    # big big history
export HISTFILESIZE=100000                # big big history
export HISTTIMEFORMAT="[%F %H:%M:%S %a] "
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
export QUOTING_STYLE=literal
shopt -s histappend
  • Update SSH: sudo vi ./ssh/sshd_config
    • Change Banner /etc/ssh/motd
    • Create /etc/ssh/motd
  • Update NetworkManager config:
[ipv4]
method=manual
address1=192.168.0.15/24,192.168.0.1
dns=1.1.1.1;1.0.0.1;8.8.8.8;8.8.4.4;
  • Update DNF config: sudo vi /etc/dnf/automatic.conf
[commands]
upgrade_type = default
random_sleep = 0
network_online_timeout = 60
download_updates = yes
apply_updates = yes
reboot = never
reboot_command = "shutdown -r +5 'Rebooting after applying package updates'"

[emitters]
emit_via = stdio

[email]
email_from = root@<this-server-ip-address>
email_to = afberendsen@gmail.com
email_host = localhost

[command]
[command_email]
email_from = root@<this-server-ip-address>
email_to = afberendsen@gmail.com

[base]
debuglevel = 1

3. Extensions

  • Install packages: targetcli wget cpufetch glances
  • systemctl enable target
  • sudo firewall-cmd --add-service=iscsi-target
  • sudo firewall-cmd --runtime-to-permanent
  • sudo shutdown -r now
  • systemctl | grep "target.service\|iscsi"

4. iSCSI Target CLI Script

#!/bin/bash

echo "===> Deleting"

for a1 in $(targetcli ls /iscsi | grep TPGs | awk '{print $2}'); do
    for a2 in $(targetcli ls "/iscsi/${a1}" | grep tpg | awk '{print $2}'); do
        for a3 in $(targetcli ls "/iscsi/${a1}/${a2}/acls/" | grep Mapped | awk '{print $2}'); do
            targetcli "/iscsi/${a1}/${a2}/acls/" delete "${a3}"
        done
        for a3 in $(targetcli ls "/iscsi/${a1}/${a2}/luns/" | grep default_tg_pt_gp | awk '{print $2}'); do
            targetcli "/iscsi/${a1}/${a2}/luns/" delete "${a3}"
        done
    done
    targetcli "/iscsi" delete "${a1}"
done

echo "===> Creating"

for a1 in $(targetcli ls /backstores/block | grep /dev | awk '{print $2}'); do
    targetcli /backstores/block/ delete ${a1}
done

sThis=iqn.1994-05.com.redhat:4aa4ea84d4aa
sClient=iqn.1994-05.com.redhat:ecdd17858d7

# Add backstores
targetcli /backstores/block create t16-A-disk0 /dev/disk/by-id/wwn-0x5000c500db7ea494
targetcli /backstores/block create t16-A-disk1 /dev/disk/by-id/wwn-0x5000c500c523375a
targetcli /backstores/block create t16-A-disk2 /dev/disk/by-id/wwn-0x5000039c08d83244
targetcli /backstores/block create t16-A-disk3 /dev/disk/by-id/wwn-0x5000039b48d84d70
targetcli /backstores/block create t16-A-disk4 /dev/disk/by-id/wwn-0x5000c500d5698091
targetcli /backstores/block create t16-B-disk0 /dev/disk/by-id/wwn-0x5000c500b5154088
targetcli /backstores/block create t16-B-disk1 /dev/disk/by-id/wwn-0x5000039968cb6ac5
targetcli /backstores/block create t16-B-disk2 /dev/disk/by-id/wwn-0x5000c500db76e926
targetcli /backstores/block create t16-B-disk3 /dev/disk/by-id/wwn-0x50000399b8cba421
targetcli /backstores/block create t16-B-disk4 /dev/disk/by-id/wwn-0x5000c500b27fe42e

# Add server node
targetcli /iscsi create ${sThis}

# Add LUNs
for disk in t16-A-disk{0..4} t16-B-disk{0..4}; do
    targetcli /iscsi/${sThis}/tpg1/luns create /backstores/block/${disk}
done

# Add client ACL
targetcli /iscsi/${sThis}/tpg1/acls create ${sClient}

# Save and verify
targetcli saveconfig
targetcli ls

Comments

Popular posts from this blog

IT - Which Is Faster: find | cpio -pdvm OR rsync?

To determine which is faster between find | cpio -pdvm and rsync for copying a large directory tree locally, we need to consider several factors: the nature of the operation, the tools' design, the system environment, and the specific use case. Let’s break this down based on the information provided in the web results and general knowledge about these tools. Overview of the Tools find | cpio -pdvm : find : Recursively lists all files and directories in a given path. cpio : A tool for copying files into or out of a cpio or tar archive. In this case, with the -pdvm options: -p : Pass-through mode (copy files from one directory tree to another). -d : Create directories as needed. -v : Verbose mod...

IT - Troubleshooting Kodi DLNA Visibility Issues After Windows Updates: A Deep Dive Into Conflicts, Fixes, and Lessons Learned

Title: Troubleshooting Kodi DLNA Visibility Issues After Windows Updates: A Deep Dive Into Conflicts, Fixes, and Lessons Learned Subtitle: How I Diagnosed and Solved Intermittent Kodi Visibility Problems on a Samsung Smart TV After Windows OS Updates and Media Server Conflicts Introduction Home media streaming should be seamless, but anyone who has integrated Kodi into a smart home setup knows that stability isn't always guaranteed. Recently, I encountered a frustrating issue: Kodi, running perfectly on my Windows 10 Pro desktop, suddenly became invisible to my Samsung Smart TV via DLNA. The journey to resolve this seemingly simple visibility issue turned into a deep technical rabbit hole involving Windows Media Server, Universal Media Server, Jellyfin, NordVPN, and the very internals o... The System Setup Before diving into the problem, it's essential to understand my hardware and software setup: Operating System: Windows 10 Pro (build 2009) Media Server: Kodi (...

Movie - The Wizard of Oz (1939)

  My views Plot In rural  Kansas ,  Dorothy Gale  lives on a farm owned by her Uncle Henry and Aunt Em, and wishes she could be somewhere else. Dorothy's neighbor, Almira Gulch, who had been bitten by Dorothy's dog, Toto, obtains a sheriff's order authorizing her to seize Toto. Toto escapes and returns to Dorothy, who runs away to protect him. Professor Marvel, a charlatan fortune-teller, convinces Dorothy that Em is heartbroken, which prompts Dorothy to return home. She returns just as a  tornado  approaches the farm. Unable to get into the locked storm cellar, Dorothy takes cover in the farmhouse and is knocked unconscious. She seemingly awakens to find the house moving through the air, with her and Toto still inside it. The house comes down in an unknown land, and Dorothy is greeted by a good witch named  Glinda , who floats down in a bubble and explains that Dorothy has landed in Munchkinland in the  Land of Oz , and that the Munchkins are cel...