Software >> OS >> Unix >> Linux >> Storage >> iSCSI >> How to connect to iSCSI target and create a filesystem and mount

1. vi /etc/iscsi/iscsid.conf
- uncomment authentication using CHAP
- ensure username & password set correctly

2. discover by

# iscsiadm --mode discovery --type sendtargets --portal a.b.c.d

note the iqn of available sendtargets e.g. iqn.2015-06.com.example:target1

3. connect by

# iscsiadm --mode node --targetname iqn.2015-06.com.example:target1 --portal a.b.c.d --login

4. verify by

# iscsiadm -m session -o show

# lsblk --scsi

it may show as device name sdd

5. create new partition

# fdisk /dev/sdd

select n, p, .... & then w to write the partition

6. make the filesystem

# mkfs -t ext4 /dev/sdd1

7. mount

# mount /dev/sdd1 /mnt

8. set automount on boot

# blkid

note the UUID

# vi /etc/fstab

add new line

UUID=uuidvalue        /mnt    ext4    defaults 0 0