iSCSI Storage

Introduction to iSCSI
--------------------------------
iSCSI is a protocol that allows disks to be accessed at the block level over the network. An iSCSI target or server system can share regular files, LVM logical volumes, or disk partitions to multiple clients (also called initiators) on the same network.

iSCSI differs from protocols like NFS and CIFS in that it works at the block level, rather than with files and directories. This means it is more efficient when using for virtual system hosting, as the filesystem overhead is removed.

Almost all Linux systems include software required to act as an iSCSI client or server, although this may be in packages that need to be installed separately. Ideally the client and server should be on the same LAN with a high-speed (gigabit or better) connection between them.

iSCSI and Virtual Systems
--------------------------------------
Cloudmin 6.6 and later supports the creation of KVM and Xen virtual systems whose disks are stored on a remote iSCSI server. When the system is created, Cloudmin will create a file or logical volume on the iSCSI server, export it, and then configure the host system to connect to the exported disks. From then on the virtual system behaves exactly like one whose disks are stored in local files, but with the advantage that very little disk space is required on the host system. The VM can also be moved to another host that uses the same iSCSI server without needing to copy and data.

Cloudmin supports multiple iSCSI servers, which can be any physical system that is already under its management. Each host system can select an iSCSI server to use for new virtual systems - typically all hosts
would share a single server, but in a large deployment you may choose to have multiple iSCSI servers in different locations.

Client Software Installation
----------------------------------------
Before a host system can be used as an iSCSI client (or initiator), you must install the Linux initiator package. The command to do this on a Debian or Ubuntu system is:


apt-get install open-iscsi

Or on a Redhat, Fedora or CentOS system :


yum install iscsi-initiator-utils

The host system must also be running Webmin version 1.610 or later, which includes the **iSCSI Client** module required by Cloudmin.

Server Software Installation
-----------------------------------------
Any physical system managed by Cloudmin (including the master) can be used as an iSCSI server, although we recommend a system with large fast disks and good network connectivity due to the IO load involved. Unfortunately there is no single iSCSI server (target) implementation that is used by all Linux distributions. However, Webmin 1.610 and above supports the two most common variants via the **iSCSI Target** and **iSCSI Server** modules.

To setup a Debian or Ubuntu system as an iSCSI server, run the command :


apt-get install iscsitarget

After installation, visit the **iSCSI Target** module in Webmin under the **Hardware** category to ensure that the server software is detected, and that it is enabled to start at boot time.

For a CentOS or Redhat Enterprise system with Webmin 1.700 or older, run :


yum install netbsd-iscsi

After installation, visit the **iSCSI Server** module in Webmin under the **Hardware** category to ensure that the server software is detected, and that it is enabled to start at boot time.

However, if you are using CentOS 6+ or equivalent and Webmin 1.710 or newer, you can instead run :


yum install scsi-target-utils

On CentOS 7+, this package is part of the EPEL repository that needs to be enabled before packages can be installed.

And after installation, visit the **iSCSI TGTd** module in Webmin to check if the server software is detected, and that it is enabled to start at boot time. This newer iSCSI server is better maintained and more reliable than the `netbsd-iscsi` package.

Server Configuration in Cloudmin
--------------------------------------------------
Once the required server software is installed, you can register a system as an iSCSI server in Cloudmin as follows :

1. Login to Cloudmin, and go to **System Storage** -> **iSCSI Servers**.
2. Select the server system from the menu and click the **Start Adding** button. If for some reason the system cannot be used as an iSCSI server, Cloudmin will tell you why.
3. Select whether iSCSI disks will be stored in regular files, or in LVM logical volumes. The latter option is strongly recommended, as it avoids the overhead of filesystem access.
4. Click the **Save** button.

Host System Configuration
----------------------------------------
Once at last one iSCSI server has been registered, you can configure a host system to use it as follows :

1. Make sure the host has the iSCSI client software installed, as documented above.
2. Login to Cloudmin, and go to **Xen Host Systems** (or **KVM Host Systems**) and click on the host.
3. In the **Create disk images in** section, select **Devices on iSCSI server** and chose a server from the menu.
4. Click the **Save** button. If the host system cannot be used as an iSCSI client, Cloudmin will display an error explaining why.

Virtual System Creation
-----------------------------------
Once a host has been configured as an iSCSI client, any virtual systems created on it from then on will have their disks created on the iSCSI server and exported to the host. The behavior of the system should be identical to one with local disks, assuming that your LAN is fast enough. The only noticeable difference in the Cloudmin UI is the option to connect or disconnect a disk from the iSCSI server, on the **Manage Disks** page.

Moving or cloning a virtual system to another host is only supported if the new host uses the same iSCSI server as the original. However, moving should take only seconds, especially if Xen live migration is configured.

Managing iSCSI Disks
------------------
Any virtual system running on a host that supports iSCSI can have additional iSCSI disks added to it, at **Resources** -> **Manage Disks** . This is possible even for systems whose first disk is on LVM or in a regular file. Cloudmin also supports moving an existing disk to iSCSI, using the **Move disk** form on the **Edit Disk** page.

To detach an iSCSI disk from a virtual system while still keeping its data intact, follow these steps :

1. Select the system from the left menu, then go to **Resources** -> **Manage Disks** and click on the disk.
2. Click the **Disconnect iSCSI** button. This will remove the connection to the iSCSI server from the host system.
3. Click on the disk again, and then on the **Detach From System** button. You may also need to reboot the virtual system to complete the process.

To attach an iSCSI disk that is already being exported by a managed iSCSI server, the steps to follow are :

1. Select the system from the left menu, then go to **Resources** -> **Manage Disks**.
2. Click on **Add existing disk from an iSCSI server**
3. Select the iSCSI server and enter the target name the disk is being exported as.
4. If this system has not connected to an iSCSI server before, enter the username and password required by the iSCSI server for this disk. Otherwise, Cloudmin will use the system's existing login.
5. Click the **Create** button.