Mount an iSCSI Target with Linux (Debian)

now part two. we have to mount the LUN’s on a other computer to test it.

apt-get install open-iscsi

edit the file /etc/iscsi/iscsid.conf, set node.startup = automatic

then we restart the whole thing

service open-iscsi restart

we look if we can see something..

iscsiadm -m discovery -t sendtargets -p SERVERIP

we note the ip and the targetname… then we try to login.

iscsiadm –mode node –targetname TARGETNAME –portal SERVERIP:3260 –login

it fails.. of course we didnt authenticated ourselfe.

update –name node.session.auth.authmethod –value=CHAP

iscsiadm -m node –targetname “TARGETNAME” –portal “SERVERIP:3260” –op=update –name node.session.auth.username –value=USERNAME

iscsiadm -m node –targetname “TARGETNAME” –portal “SERVERIP:3260” –op=update –name node.session.auth.password –value=PASSWORD

now a restart of the serive to make sure everthing runs fine after a reboot.

we can now see the 3 disks by typing fdisk -l

root@kvm02:/home/kvm# fdisk -l

Disk /dev/vda: 8 GiB, 8589934592 bytes, 16777216 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos

Disk identifier: 0x566539ac Device Boot Start End Sectors Size Id Type/dev/vda1 * 2048 499711 497664 243M 83 Linux /dev/vda2 501758 16775167 16273410 7,8G 5 Extended /dev/vda5 501760 16775167 16273408 7,8G 8e Linux LVM

Disk /dev/mapper/kvm01–vg-root: 7,4 GiB, 7935623168 bytes, 15499264 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/kvm01–vg-swap_1: 376 MiB, 394264576 bytes, 770048 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

thats it.. have fun!

Tags: cli, linux, storage