For Debian
apt install open-iscsi
For Arch
pacman -S open-scsi
This will require elevated rights.
sudo iscsiadm -m discovery -t sendtargets -p <ip>:3260
sudo iscsiadm -m node -T iqn<etc> -p <ip>:3260 --login
The first command sets iscsiadm to run in discovery mode and will probe the server at the IP address provided on the default iSCSI port (3260).
The second command will then try to login to the server at the given IP address and port.
The following instructions will mount the filesystem temporarily. It will not be mounted on next boot
First we need to determine the which device the target is identified as. We can do this by running the following:
lsblk -p -o NAME,MODEL,SIZE,TYPE,SERIAL
which will show something like
NAME MODEL SIZE TYPE SERIAL
/dev/sda Samsung SSD 840 Series 232.9G disk S15GNEACB81497L
└─/dev/sda1 232.9G part
/dev/sdb ST2000DM006-2DM164 1.8T disk Z5Z7C322
├─/dev/sdb1 931.5G part
└─/dev/sdb2 931.5G part
/dev/sdc iSCSI Storage 1T disk 95329c64-8807-467c-b0a8-5e7eb66e7a25
└─/dev/sdc1 1024G part
/dev/nvme0n1 CT1000P1SSD8 931.5G disk 20222875F369
├─/dev/nvme0n1p1 100M part
├─/dev/nvme0n1p2 16M part
├─/dev/nvme0n1p3 244.2G part
├─/dev/nvme0n1p4 513M part
├─/dev/nvme0n1p5 512M part
├─/dev/nvme0n1p6 8G part
├─/dev/nvme0n1p7 23.9G part
└─/dev/nvme0n1p8 654.3G part
This will list out all the storage available on the local system. From this list we can see that /dev/sdc
is listed as being "iSCSI Storage".
In the the case above, we can see that there is already a partition table and so we can attempt to mount the partition thusly:
sudo mount /dev/sdc1 /mnt/point
If there are no partitions created and this is a raw drive, then you will need to format the storage.
To survive a reboot, the system will need to mount the target at boot. This can be achived by adding an entry to /etc/fstab
. Before we do that, however, there are a few steps which will need to be covered.
lsblk -o NAME,MOUNTPOINT,FSTYPE,UUID
.iscsiadm -m node -T <iqn_target> -p <target_host_name> --op update -n node.startup -v automatic
/etc/fstab
. I will give a basic set up here, you may want to change options depending on exact use case. Using your text editor of choice, add the following line to the fstab
file:UUID=<file_system_UUID_from_earlier> /desired/mountpoint ext4 _netdev 0 0
The
_netdev
option here stops the system from trying to mount the device before the networking stack is ready