iSCSI is a mechanism to share out a block of data storage over a network. It is like SCSI which is a well-known mechanism for directly connecting a block of data storage (usually a hard drive) to a computer. N.B. This is not file-sharing, the initiator (iSCSI terminology for a client) sees the storage as a raw block of data and is responsible itself for formatting and file-structure. Multiple initiators can access the same storage, but they must all negotiate with each other so that they don't overwrite (and thus corrupt) each others data.
NetManager can act as an iSCSI server and supports multiple simultaneous access, multipathing and multiple targets/LUNs.
- Target - a named storage resources on an iSCSI server. May consist of multiple LUNs (see later)
- Initiator - the device accessing the target, i.e. the client
- Network range - range of IP addresses specified by IP address and netmask, e.g. 192.168.2.0/24
- IQN (iSCSI Qualified Name) - a unique name for a target or initiator
- LUN (Logical Unit Number) - a given piece of storage on a target; a target can export more than one chunk of data
- Backing file - Each LUN on an iSCSI target corresponds to a large sparse file on the NetManager's own storage
- Sparse file - A sparse file looks at first glance to be full-size, but actually only contains blocks that really contain data. Blocks which are empty don't take up space and thus as data is written to the file, the file itself starts small and will grow.
Configuration of the target is handled by the
/etc/netmanager/iscsi.conf configuration file. After editing this file, the
/usr/libexec/build/iscsi Build Script should be run to make the changes live. The format is a standard .ini style. Global parameters can be defined at the top and then individual named targets are defined. Each target can have parameters set that override the global settings. Each target can have multiple LUNs (which all share the same settings).
Configuration options (global only):
storage= path to directly that backing files are held in. By default this is
/usr/shares/iscsi, but on a custom-built server with extra-large storage such as a NetManager backup server this parameter may need to be altered. Will be created if doesn't already exist.
node= base IQN of the server. Name of target will be appended on the end. Default is
iqn.2002-08.info.netmanagerand will generally not have to be altered.
sessions= maximum number of iSCSI sessions supported (default 32)
connections= maximum number of iSCSI connections (default 8 - should be at least as high as the number of initiators simultaneously accessing the server)
Configuration options (per-target only):
size= size of LUN (only mandatory option). Can have MB, GB or TB suffix. If multiple sizes are given in a space-separated list, this will define multiple LUNs on the target.
file= File name of backing file (relative to storage value above unless a full path name is given). Defaults to name of the target.
comment= optional friendly name for target (defaults to name of target).
alias= another name that the target can be known by (rarely used)
readonly= (y/n) whether target can be written to. Defaults to yes.
Configuration options (per-target and global):
networks= space-separated list of networks (e.g. 192.168.100.0/24) to listen for iSCSI connections on. Alternatively, can be a list of IP addresses on the server (in which case the netmask will be automatically determined). If not set, will listen on all IP addresses. For security/performance reasons, you may have a separate storage network on a different IP address range and thus this can be used to restrict access to the target. Even if not, you should use this option to ensure that iSCSI is only used on local LANs, not on the Internet side of your NetManager.
initiators= space-separated list of initiator IQNs to grant access to this target. If you don't have a separate iSCSI network (as described above), it is strongly recommended that you lock down access to your target on the basis of IQN.
storage=/data/iscsi initiators=iqn.2011-07.com.example:89abcdef iqn.2011-07.com.example:01234567 [xenserver] size=750GB 500MB networks=192.168.100.0/24
This will define 1 target with IQN iqn.2002-08.info.netmanager:xenserver. The target has 2 LUNs (of 750GB and 100MB respectively). Access is only granted to 2 specific initiators and iSCSI traffic will be ignored on all networks except for the 192.168.100.0/24 range.
If more than one LUN is defined, then the first will have the filename defined by
file= or, failing that, the target name. Extra LUNs will have _1, _2, etc. at the end. So, for example, with the above configuration file, the following files will exist in
netmanager 1# ls -lsh total 750G 46G -rw-r--r-- 1 root wheel 750G Jul 11 20:21 xenserver 500M -rw-r--r-- 1 root wheel 500M Jul 11 16:14 xenserver_1
As an aside, the above example also shows the effect of sparse files. The file called
xenserver claims it is 750GB in size, but in actuality the size it takes on the disc is only 46GB.