iSCSI: Setting up an iSCSI Server
Introduction
iSCSI (internet SCSI) is an application layer protocol that enables the transport of SCSI commands over a TCP/IP network.
This documentation was created on Red Hat 5 and is compatible with Red Hat 6.
Server
Installation
To install an iSCSI server:
|
|
Creating partitions
Create your partitions, then have them detected with a command like:
|
|
or
|
|
Preferably use partx.
Note: For the following steps, I strongly recommend using UUIDs instead of device paths (/dev/xxx). In this documentation, device paths are used for simplicity.
Configuration
Let’s edit the server configuration file and uncomment the “target” section:
|
|
- Here’s how to name the iSCSI target, which must be unique: ign.
.<reverse_dns>. [: ] - date: year + month (yyyy-mm)
- reverse_dns: reversed DNS (fr.deimos.www)
- strings: name to identify this device (myiscsi)
- :
: optional, allows adding a name
- backing-store: the disk device or disk image to use
- initiator-address: client addresses authorized to mount this device
Start the service and make it persistent:
|
|
Check the configuration like this:
|
|
Here’s how to get information about iSCSI devices:
/sys/class/scsi_host
: all detected iSCSI adapters/sys/block
: lists the peripherals
Client
Installation
Clients are called “Initiators” and the target is the recipient (disk array/server). To install the client:
|
|
Then we’ll start the service:
|
|
Usage
Mounting
First, let’s perform a “discovery” to see what devices are available to us:
|
|
<server>
: enter the IP address of the server (not DNS!!!)
Then we’ll log in to the device so that it will be mounted on each reboot:
|
|
- iqn.2012-02.fr.deimos.www:iscsi: the IQN of the server to use
<server>
: enter the IP address of the server (not DNS!!!)
Once logged in, you can retrieve device information from the logs:
|
|
If you need more information, use verbose mode:
|
|
Next, format the partition in the desired format. Add a line to fstab with the “_netdev” option, otherwise the machine won’t be able to reboot because of the rc.sysinit script. This specifies that the device doesn’t use networking:
|
|
Unmounting
To temporarily unmount an iSCSI device (until the next reboot):
|
|
And if you want to delete it permanently:
|
|
Resources
For additional resources on this topic, you might want to consult similar documentation on iSCSI setup for other Linux distributions.
Last updated 04 Jun 2013, 14:04 CEST.