====== SAN CUSTOM - MDL-NAS - FEDORA ======
* au préalable
* Fedora 43 avec cockpit, TGTD installés
[root@mdl-nas ~]# dnf install cockpit targetcli nmap
[root@mdl-nas ~]# systemctl enable --now tgtd
[root@mdl-nas ~]# systemctl enable --now cockpit
* ouverture des ports sur le firewall
[root@mdl-nas ~]# firewall-cmd --add-service=cockpit --permanent
[root@mdl-nas ~]# firewall-cmd --add-port=3260/tcp --permanent
success
[root@mdl-nas ~]# firewall-cmd --reload
success
[root@mdl-nas ~]# firewall-cmd --list-all
public (default, active)
target: default
ingress-priority: 0
egress-priority: 0
icmp-block-inversion: no
interfaces: enp3s0f0 enp5s0
sources:
services: cockpit dhcpv6-client mdns ssh
ports: 3260/tcp
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
* raid 5 sur 8 ssd de 500GB (créé avec le cockpit)
* on y a créé un Volume-group et 2 logical-volume pour nos 2 hyperviseurs
[root@mdl-nas ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md127 vgroup0 lvm2 a-- 3,18t <1,24t
/dev/sda3 fedora lvm2 a-- <109,20g <94,20g
[root@mdl-nas ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root fedora -wi-ao---- 15,00g
lv_hyper-v1 vgroup0 -wi-ao---- 558,79g
lv_hyper-v2 vgroup0 -wi-ao---- <1,40t
* Creation ISCI portal et LUN (bridage de la publication des LUN sur les IP des interfaces des initiateurs)
# avec TGTADM (plus d'options)
[root@mdl-nas ~]# tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.fr.delag.labo.mdl-nas:hyper-v1.VM1
[root@mdl-nas ~]# tgtadm --lld iscsi --op bind --mode target --tid 1 -I 10.6.0.5
[root@mdl-nas ~]# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 0 -b /dev/vgroup0/lv_hyper-v1
[root@mdl-nas ~]# tgtadm --lld iscsi --op new --mode target --tid 2 -T iqn.fr.delag.labo.mdl-nas:hyper-v2.VM1
[root@mdl-nas ~]# tgtadm --lld iscsi --op bind --mode target --tid 2 -I 10.6.0.6
[root@mdl-nas ~]# tgtadm --lld iscsi --op new --mode logicalunit --tid 2 --lun 1 -b /dev/vgroup0/lv_hyper-v2
# avec un script fournis par le package
[root@mdl-nas ~]# tgt-setup-lun -n iqn.fr.delag.labo.mdl-nas:hyper-v1.VM1 -d /dev/vgroup0/lv_hyper-v1 10.6.0.5
[root@mdl-nas ~]# tgt-setup-lun -n iqn.fr.delag.labo.mdl-nas:hyper-v2.VM1 -d /dev/vgroup0/lv_hyper-v2 10.6.0.6
* affichage LUN et portail
[root@mdl-nas ~]# tgtadm --lld iscsi --op show --mode portal
Portal: [::]:3260,1
Portal: 0.0.0.0:3260,1
[root@mdl-nas ~]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.fr.delag.labo.mdl-nas:hyper-v1
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 1
Initiator: iqn.fr.delag.labo.hyper-v1 alias: none
Connection: 1
IP Address: 10.6.0.5
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 599999 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: rdwr
Backing store path: /dev/vgroup0/lv_hyper-v1
Backing store flags:
Account information:
ACL information:
10.6.0.5
Target 2: iqn.fr.delag.labo.mdl-nas:hyper-v2.VM1
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 2
Initiator: iqn.fr.delag.labo.hyper-v2 alias: hyper-v2
Connection: 0
IP Address: 10.6.0.6
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00020000
SCSI SN: beaf20
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: 360000000000000000e00000000020001
SCSI SN: beaf20
Size: 1538672 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: rdwr
Backing store path: /dev/vgroup0/lv_hyper-v2
Backing store flags:
Account information:
ACL information:
10.6.0.6
**Les LUN et portail actifs ne sont pas persistants et sont perdus au reboot ou au redémarrage de tgtd.service**
== Rendre persistant les target ==
* Cela est possible en créant le fichier ///etc/tgt/targets.conf//
* backing-store: mode de publication simple
* direct-store: permet de publier plus de paramétrage et de d'informations tels que VENDOR IDENTIFICATION, PRODUCT IDENTIFICATION,Unit serial number etc...
[root@mdl-nas ~]# vi /etc/tgt/targets.conf
# simple en backing-store
backing-store /dev/vgroup0/lv_hyper-v1
initiator-address 10.6.0.5
# plus complet en direct-store
# must be unique
controller_tid 2 # must be unique
initiator-address 10.6.0.6 # restrict allowed client
vendor_id MDL-NAS
#removable 1
#device-type cd
scsi_id 360000000000000000e00000000020001 # must be unique
scsi_sn beaf20 # must be unique
bs-type rdwr
lun 1
* on recharge la conf
[root@mdl-nas ~]# systemctl reload tgtd.service
[root@mdl-nas ~]#
[root@mdl-nas ~]#
[root@mdl-nas ~]#
[root@mdl-nas ~]# systemctl status tgtd.service
● tgtd.service - tgtd iSCSI target daemon
Loaded: loaded (/usr/lib/systemd/system/tgtd.service; enabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: active (running) since Thu 2026-01-08 21:16:36 CET; 10h ago
Invocation: d40992843bac469aac109b6fb1d798d4
Process: 13169 ExecReload=/usr/sbin/tgt-admin --update ALL -c $TGTD_CONFIG (code=exited, status=0/SUCCESS)
Main PID: 1054 (tgtd)
Tasks: 1 (limit: 9368)
Memory: 6.1M (peak: 12.6M)
CPU: 1.344s
CGroup: /system.slice/tgtd.service
└─1054 /usr/sbin/tgtd -f
janv. 08 21:16:30 mdl-nas.delag.labo.fr systemd[1]: Starting tgtd.service - tgtd iSCSI target daemon...
janv. 08 21:16:31 mdl-nas.delag.labo.fr tgtd[1054]: tgtd: iser_ib_init(3431) Failed to initialize RDMA; load kernel modules?
janv. 08 21:16:31 mdl-nas.delag.labo.fr tgtd[1054]: tgtd: work_timer_start(146) use timer_fd based scheduler
janv. 08 21:16:31 mdl-nas.delag.labo.fr tgtd[1054]: tgtd: bs_init(387) use signalfd notification
janv. 08 21:16:36 mdl-nas.delag.labo.fr systemd[1]: Started tgtd.service - tgtd iSCSI target daemon.
janv. 09 07:43:55 mdl-nas.delag.labo.fr systemd[1]: Reloading tgtd.service - tgtd iSCSI target daemon...
janv. 09 07:43:55 mdl-nas.delag.labo.fr systemd[1]: Reloaded tgtd.service - tgtd iSCSI target daemon.
* on affiche la conf
[root@mdl-nas ~]# tgtadm --mode target --op show
Target 1: iqn.fr.delag.labo.mdl-nas:hyper-v1
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 1
Initiator: iqn.fr.delag.labo.hyper-v1 alias: none
Connection: 1
IP Address: 10.6.0.5
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 599999 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: rdwr
Backing store path: /dev/vgroup0/lv_hyper-v1
Backing store flags:
Account information:
ACL information:
10.6.0.5
Target 2: iqn.fr.delag.labo.mdl-nas:hyper-v2.VM1
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 2
Initiator: iqn.fr.delag.labo.hyper-v2 alias: hyper-v2
Connection: 0
IP Address: 10.6.0.6
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00020000
SCSI SN: beaf20
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: 360000000000000000e00000000020001
SCSI SN: beaf20
Size: 1538672 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: rdwr
Backing store path: /dev/vgroup0/lv_hyper-v2
Backing store flags:
Account information:
ACL information:
10.6.0.6