Skip to content

Instantly share code, notes, and snippets.

@vy-nguyen
Created November 28, 2017 00:01
Show Gist options
  • Save vy-nguyen/557edd7aa11c3d027314b6d8cc25b506 to your computer and use it in GitHub Desktop.
Save vy-nguyen/557edd7aa11c3d027314b6d8cc25b506 to your computer and use it in GitHub Desktop.
# create a disk-image
root@dlp:~# mkdir /var/lib/iscsi_disks
root@dlp:~# dd if=/dev/zero of=/var/lib/iscsi_disks/disk01.img count=0 bs=1 seek=10G
root@dlp:~# vi /etc/tgt/conf.d/target01.conf
# add to the end
# naming rule : [ iqn.yaer-month.domain:any name ]
<target iqn.2017-04.world.srv:target01>
# provided devicce as a iSCSI target
backing-store /var/lib/iscsi_disks/disk01.img
# iSCSI Initiator's IP address you allow to connect
initiator-address 10.0.0.31
# authentication info ( set anyone you like for "username", "password" )
incominguser username password
</target>
root@dlp:~# systemctl restart tgt
# show status
root@dlp:~# tgtadm --mode target --op show
Target 1: iqn.2017-04.world.srv:target01
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 10737 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: rdwr
Backing store path: /var/lib/iscsi_disks/disk01.img
Backing store flags:
Account information:
username
ACL information:
10.0.0.31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment