Um iSCSI-Volumes auf einem Debian-System automatisch zu mounten und Multipath I/O (MPIO) zu nutzen, können Sie die folgenden Schritte ausführen:
Installieren der erforderlichen Pakete
Zuerst müssen Sie die erforderlichen Pakete installieren:
apt update
apt -y install open-iscsi multipath-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
kpartx libisns0 libopeniscsiusr libsgutils2-1.46-2 liburcu8 sg3-utils sg3-utils-udev
Suggested packages:
multipath-tools-boot
Recommended packages:
finalrd
The following NEW packages will be installed:
kpartx libisns0 libopeniscsiusr libsgutils2-1.46-2 liburcu8 multipath-tools open-iscsi sg3-utils
sg3-utils-udev
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 1886 kB of archives.
After this operation, 7097 kB of additional disk space will be used.
Get:1 http://ftp.debian.org/debian bookworm/main amd64 kpartx amd64 0.9.4-3+deb12u1 [27.0 kB]
Get:2 http://ftp.debian.org/debian bookworm/main amd64 libsgutils2-1.46-2 amd64 1.46-3 [117 kB]
Get:3 http://ftp.debian.org/debian bookworm/main amd64 sg3-utils amd64 1.46-3 [845 kB]
Get:4 http://ftp.debian.org/debian bookworm/main amd64 sg3-utils-udev all 1.46-3 [37.0 kB]
Get:5 http://ftp.debian.org/debian bookworm/main amd64 liburcu8 amd64 0.13.2-1 [70.8 kB]
Get:6 http://ftp.debian.org/debian bookworm/main amd64 multipath-tools amd64 0.9.4-3+deb12u1 [325 kB]
Get:7 http://ftp.debian.org/debian bookworm/main amd64 libisns0 amd64 0.101-0.2+b1 [92.0 kB]
Get:8 http://ftp.debian.org/debian bookworm/main amd64 libopeniscsiusr amd64 2.1.8-1 [59.7 kB]
Get:9 http://ftp.debian.org/debian bookworm/main amd64 open-iscsi amd64 2.1.8-1 [312 kB]
Fetched 1886 kB in 18s (102 kB/s)
Preconfiguring packages ...
Selecting previously unselected package kpartx.
(Reading database ... 25648 files and directories currently installed.)
Preparing to unpack .../0-kpartx_0.9.4-3+deb12u1_amd64.deb ...
Unpacking kpartx (0.9.4-3+deb12u1) ...
Selecting previously unselected package libsgutils2-1.46-2:amd64.
Preparing to unpack .../1-libsgutils2-1.46-2_1.46-3_amd64.deb ...
Unpacking libsgutils2-1.46-2:amd64 (1.46-3) ...
Selecting previously unselected package sg3-utils.
Preparing to unpack .../2-sg3-utils_1.46-3_amd64.deb ...
Unpacking sg3-utils (1.46-3) ...
Selecting previously unselected package sg3-utils-udev.
Preparing to unpack .../3-sg3-utils-udev_1.46-3_all.deb ...
Unpacking sg3-utils-udev (1.46-3) ...
Selecting previously unselected package liburcu8:amd64.
Preparing to unpack .../4-liburcu8_0.13.2-1_amd64.deb ...
Unpacking liburcu8:amd64 (0.13.2-1) ...
Selecting previously unselected package multipath-tools.
Preparing to unpack .../5-multipath-tools_0.9.4-3+deb12u1_amd64.deb ...
Unpacking multipath-tools (0.9.4-3+deb12u1) ...
Selecting previously unselected package libisns0:amd64.
Preparing to unpack .../6-libisns0_0.101-0.2+b1_amd64.deb ...
Unpacking libisns0:amd64 (0.101-0.2+b1) ...
Selecting previously unselected package libopeniscsiusr.
Preparing to unpack .../7-libopeniscsiusr_2.1.8-1_amd64.deb ...
Unpacking libopeniscsiusr (2.1.8-1) ...
Selecting previously unselected package open-iscsi.
Preparing to unpack .../8-open-iscsi_2.1.8-1_amd64.deb ...
Unpacking open-iscsi (2.1.8-1) ...
Setting up libsgutils2-1.46-2:amd64 (1.46-3) ...
Setting up libopeniscsiusr (2.1.8-1) ...
Setting up liburcu8:amd64 (0.13.2-1) ...
Setting up libisns0:amd64 (0.101-0.2+b1) ...
Setting up kpartx (0.9.4-3+deb12u1) ...
Setting up sg3-utils (1.46-3) ...
Setting up open-iscsi (2.1.8-1) ...
Created symlink /etc/systemd/system/sockets.target.wants/iscsid.socket → /lib/systemd/system/iscsid.socket.
Created symlink /etc/systemd/system/iscsi.service → /lib/systemd/system/open-iscsi.service.
Created symlink /etc/systemd/system/sysinit.target.wants/open-iscsi.service → /lib/systemd/system/open-iscsi.service.
Setting up sg3-utils-udev (1.46-3) ...
update-initramfs: deferring update (trigger activated)
Setting up multipath-tools (0.9.4-3+deb12u1) ...
Created symlink /etc/systemd/system/multipath-tools.service → /lib/systemd/system/multipathd.service.
Created symlink /etc/systemd/system/sysinit.target.wants/multipathd.service → /lib/systemd/system/multipathd.service.
Created symlink /etc/systemd/system/sockets.target.wants/multipathd.socket → /lib/systemd/system/multipathd.socket.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 145.
Processing triggers for libc-bin (2.36-9+deb12u7) ...
Processing triggers for initramfs-tools (0.142) ...
update-initramfs: Generating /boot/initrd.img-6.1.0-21-amd64
I: The initramfs will attempt to resume from /dev/dm-0
I: (/dev/mapper/lvm-swap)
I: Set the RESUME variable to override this.
iSCSI einrichten
Bearbeiten Sie die Datei /etc/iscsi/iscsid.conf, um die iSCSI-Parameter zu konfigurieren:
sed -i 's/node.startup = manual/node.startup = automatic/' /etc/iscsi/iscsid.conf
Stellen Sie sicher, dass node.startup auf automatic gesetzt ist:
node.startup = automatic
iSCSI-Target entdecken und verbinden
Führen Sie den folgenden Befehl aus, um die iSCSI-Targets zu entdecken:
iscsiadm -m discovery -t sendtargets -p 10.66.3.221:3260
10.66.3.221:3260,2 iqn.1986-03.com.hp:storage.p2000g3.112312d652
10.66.3.211:3260,1 iqn.1986-03.com.hp:storage.p2000g3.112312d652
10.66.3.222:3260,4 iqn.1986-03.com.hp:storage.p2000g3.112312d652
10.66.3.212:3260,3 iqn.1986-03.com.hp:storage.p2000g3.112312d652
10.66.3.223:3260,6 iqn.1986-03.com.hp:storage.p2000g3.112312d652
10.66.3.213:3260,5 iqn.1986-03.com.hp:storage.p2000g3.112312d652
10.66.3.224:3260,8 iqn.1986-03.com.hp:storage.p2000g3.112312d652
10.66.3.214:3260,7 iqn.1986-03.com.hp:storage.p2000g3.112312d652
Ersetzen Sie die IP-Adresse des iSCSI-Servers durch die IP-Adresse Ihres iSCSI-Servers.
Um sich mit den gefundenen Targets zu verbinden, führen Sie aus:
iscsiadm -m node --login
Überprüfen Sie den Verbindungsstatus:
iscsiadm -m session -o show
WWID ermitteln
# ls -l /dev/disk/by-path/
total 0
lrwxrwxrwx 1 root root 9 May 23 18:35 ip-10.66.3.221:3260-iscsi-iqn.1986-03.com.hp:storage.p2000g3.112312d652-lun-0 -> ../../sdb
lrwxrwxrwx 1 root root 9 May 23 18:35 ip-10.66.3.221:3260-iscsi-iqn.1986-03.com.hp:storage.p2000g3.112312d652-lun-2 -> ../../sdc
lrwxrwxrwx 1 root root 9 May 23 18:25 pci-0000:03:00.0-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 May 22 20:29 pci-0000:03:00.0-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 May 22 20:29 pci-0000:03:00.0-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 May 22 20:29 pci-0000:03:00.0-scsi-0:0:0:0-part3 -> ../../sda3
Sie können die WWIDs Ihrer iSCSI-Devices mit dem folgenden Befehl ermitteln:
/lib/udev/scsi_id --whitelisted --device=/dev/sdc
3600c0ff00012c204a86e4f6601000000
udevadm info -q property /dev/sdc|grep ID_VENDOR=
ID_VENDOR=HP
Um diesen Eintrag vollständig sehen zu können, müssen Sie ein Kunde der Securebit AG sein. Dazu können Sie ein belibites Produkt aus unserem Sortiment bestellen.
Sollten Sie bereits Kunde sein, können Sie sich
hier anmelden.