All iSCSI is doing is presenting a block device, but it still needs to be formatted with a filesystem before it can be mounted. This has (2) parts:
a) Partitioning:
So in the output of fdisk -l find your new block device- in this example "sdd"- and partition it. Specify "n" for a new partition and you can (generally) just hit to accept the default values and finally specify "w" to write the changes and exit:
ubuntu@server:~$ sudo fdisk /dev/sdd
<snip>
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-2097151, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2097151, default 2097151):
Created a new partition 1 of type 'Linux' and of size 1023 MiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
b) Formatting with a Filesystem
Use mkfs to laydown a filesystem:
ubuntu@server:~$ sudo mkfs.ext4 /dev/sdd1
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done
Creating filesystem with 261888 4k blocks and 65536 inodes
Filesystem UUID: f09b7659-a60a-4963-a44f-d59c9dbbe671
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
So now you've got a filesystem on the iSCSI LUN which is capable of being mounted, preferably as a SystemD service. The process is a bit fiddily, so I scripted it so that it's fool-proof if you follow my instructions in the README.md file:
https://github.com/f1linux/iscsi-automount
This will automate setting up a SystemD automount that connects the iSCSI as a SystemD Service on boot.
I wrote the script to connect an iSCSI LUN to an Ubuntu host- my case a Raspberry Pi 4- and then specify the folder that it's mounted to on the host as a Docker Volume in my docker-compose.yml file to hold persistent data apart from the container. Will work for any other use-case though.
Hope this helps-