Export an Iscsi Target With Linux
Export an iSCSI Target with linux
As some already know I work voluntarily at the realcomputer e.V. We have got a Bladecenter, unfortunately without hard drives so I try with another linux machine to export a few iSCSI targets to provide the blades with some storage.
Because there are no exact specifications I use as usual debian.
install the necesary packages..
apt-get install iscsitarget
set „ISCSITARGET_ENABLE“ to true in the file /etc/default/iscsitarget.
Create some LUN
I think that the term “LUN” is widely used and can be seen as standard for Virtual disks for an operating system.
in my case i have a disk mounted as /backup wich still has some space so i create /backup/lun
mkdir /luns cd /luns
there we create our lun’s
dd if=/dev/zero of=storagelun0 count=0 obs=1 seek=10G dd if=/dev/zero of=storagelun1 count=0 obs=1 seek=10G dd if=/dev/zero of=storagelun2 count=0 obs=1 seek=10G
We have created tree Images wich contain 10G each.
Name of the target
The name of the respective target must be unique in your environment and you should at least half-way to the convention. In this case, “iqn” stands for “iSCSI Qualified Name” and should be used as well. The second block consists of year and month (YYYY-MM), in which the domain is valid and can be omitted. In the third place is the converted domain name (instead of example.at> at.example) and behind it a name is freely selectable.
then edit the file /etc/iet/ietd.conf
Target iqn.local.example:storage.sys1 IncomingUser BENUTZERNAME PASSWORT Lun 0 Path=/luns/storagelun0,Type=fileio,ScsiId=lun0,ScsiSN=lun0 Lun 1 Path=/luns/storagelun1,Type=fileio,ScsiID=lun1,ScsiSN=lun1 Lun 2 Path=/luns/storagelun2,Type=fileio,ScsiID=lun2,ScsiSN=lun2
Please note that the Password has to be at least of 9 chars leanght.
service iscsitarget stop && service iscsitarget start
thats it. if theres no errors everything is fine. we continue with part 2 how to use them on debian
Tags: cli, linux, storage