This commit is contained in:
63
content/snippets/0100-iscsi-on-linux.md
Normal file
63
content/snippets/0100-iscsi-on-linux.md
Normal file
@ -0,0 +1,63 @@
|
||||
<!--
|
||||
title: iSCSI on Linux
|
||||
-->
|
||||
|
||||
## Preparation
|
||||
Install `open-iscsi`, at least on Debian systems.
|
||||
|
||||
|
||||
## Use an iSCSI target from Linux
|
||||
|
||||
In our setup a Synology NAS at 172.16.200.19 provides the targets.
|
||||
|
||||
First, run
|
||||
```
|
||||
iscsiadm -m discovery -t sendtargets -p 172.16.200.19
|
||||
```
|
||||
to discover all provided targets.
|
||||
|
||||
You get something like this
|
||||
```
|
||||
172.16.200.19:3260,1 iqn.2000-01.com.synology:nas.Target-GitLab.db1c0541e7
|
||||
[fe80::211:32ff:febe:da31]:3260,1 iqn.2000-01.com.synology:nas.Target-GitLab.db1c0541e7
|
||||
172.16.200.19:3260,1 iqn.2000-01.com.synology:nas.Target-Bitwarden.db1c0541e7
|
||||
[fe80::211:32ff:febe:da31]:3260,1 iqn.2000-01.com.synology:nas.Target-Bitwarden.db1c0541e7
|
||||
172.16.200.19:3260,1 iqn.2000-01.com.synology:nas.Target-Nextcloud.db1c0541e7
|
||||
[fe80::211:32ff:febe:da31]:3260,1 iqn.2000-01.com.synology:nas.Target-Nextcloud.db1c0541e7
|
||||
172.16.200.19:3260,1 iqn.2000-01.com.synology:nas.Target-MariaDB.db1c0541e7
|
||||
[fe80::211:32ff:febe:da31]:3260,1 iqn.2000-01.com.synology:nas.Target-MariaDB.db1c0541e7
|
||||
172.16.200.19:3260,1 iqn.2000-01.com.synology:nas.Target-Backup.db1c0541e7
|
||||
[fe80::211:32ff:febe:da31]:3260,1 iqn.2000-01.com.synology:nas.Target-Backup.db1c0541e7
|
||||
```
|
||||
|
||||
Now, connect to the target using
|
||||
```
|
||||
iscsiadm -m node --targetname "iqn.2000-01.com.synology:nas.Target-Backup.db1c0541e7" \
|
||||
--portal 172.16.200.19 --login
|
||||
```
|
||||
|
||||
A new SCSI device will be created. Check the name of the device using ''dmesg''. You see something like this
|
||||
```
|
||||
[16924536.979916] scsi host13: iSCSI Initiator over TCP/IP
|
||||
[16924537.010635] scsi 13:0:0:1: Direct-Access SYNOLOGY iSCSI Storage 4.0 PQ: 0 ANSI: 5
|
||||
[16924537.011449] sd 13:0:0:1: Attached scsi generic sg10 type 0
|
||||
[16924537.012597] sd 13:0:0:1: [sdj] 209715200 512-byte logical blocks: (107 GB/100 GiB)
|
||||
[16924537.012827] sd 13:0:0:1: [sdj] Write Protect is off
|
||||
[16924537.012828] sd 13:0:0:1: [sdj] Mode Sense: 43 00 10 08
|
||||
[16924537.013111] sd 13:0:0:1: [sdj] Write cache: enabled, read cache: enabled, supports DPO and FUA
|
||||
[16924537.013361] sd 13:0:0:1: [sdj] Optimal transfer size 16384 logical blocks > dev_max (8192 logical blocks)
|
||||
[16924537.018630] sd 13:0:0:1: [sdj] Attached SCSI disk
|
||||
```
|
||||
|
||||
Now use `fdisk`, `mkfs` and if you like `blkid` on the new device and put it into the `/etc/fstab`.
|
||||
|
||||
|
||||
===== Authenticated target =====
|
||||
|
||||
```
|
||||
iscsiadm --mode node --targetname "iqn.2007-01.org.debian.foobar:CDs" -p 192.168.0.1:3260 --op=update --name node.session.auth.authmethod --value=CHAP
|
||||
iscsiadm --mode node --targetname "iqn.2007-01.org.debian.foobar:CDs" -p 192.168.0.1:3260 --op=update --name node.session.auth.username --value=$Id
|
||||
iscsiadm --mode node --targetname "iqn.2007-01.org.debian.foobar:CDs" -p 192.168.0.1:3260 --op=update --name node.session.auth.password --value=$MDP
|
||||
iscsiadm --mode node --targetname "iqn.2007-01.org.debian.foobar:CDs" -p 192.168.0.1:3260 --login
|
||||
```
|
||||
|
Reference in New Issue
Block a user