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

Movies - The Bubble (2022)

  Back to Evolution (2001) .

IT - Fixing Windows Error 1327: Account Restrictions Are Preventing This User from Signing In

Fixing Windows Error 1327: Account Restrictions Are Preventing This User from Signing In Introduction Error 1327, “Account restrictions are preventing this user from signing in,” is a perplexing and disruptive issue that occurs on some Windows 10 and Windows 11 machines. The message typically appears at login or while connecting to remote resources, like shared folders, network drives, or remote desktops. Table of Contents Symptoms of Error 1327 Common Causes Step-by-Step Troubleshooting Advanced Fixes Automation via PowerShell Prevention Tips Further Reading Symptoms of Error 1327 Users experiencing this error may encounter one or more of the following: Login screen fails after credentials are entered. Error message appears when accessing mapped drives or network resources. Remote Desktop Connection (RDP) is rejected with the 1327 message. Group Policy logon restrictions silently block access. Co...

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 (...