iSCSI (Internet Small Computer Systems Interface) is a protocol that allows data storage facilities to be shared over IP networks. It is widely used to create network-attached storage (NAS) environments. This guide will show you how to set up an iSCSI Storage Server on Ubuntu 20.04 LTS, which can be a great solution for managing storage in environments such as Windows VPS UK or other VPS solutions.

Prerequisites

Before starting, ensure you have the following:

Step 1: Update Your System

Before installing any new packages, make sure your server is up to date by running the following commands:

sudo apt update && sudo apt upgrade

Step 2: Install iSCSI Target Software

Next, install the iSCSI target software. This software will allow your server to act as a storage target for iSCSI initiators:

sudo apt install tgt

After installation, ensure that the tgt service is running:

sudo systemctl status tgt

If it is not running, you can start the service with the following command:

sudo systemctl start tgt

Step 3: Create and Configure iSCSI Target

Now, create a storage device for your iSCSI target. This could be a logical volume, a partition, or a file. For this example, we’ll create a 10GB file that will serve as our storage:

sudo dd if=/dev/zero of=/srv/iscsi_disk.img bs=1M count=10240

Next, configure the iSCSI target by editing the target configuration file:

sudo nano /etc/tgt/conf.d/iscsi-target.conf

Add the following configuration to create a target:

<target iqn.2023-10.com.example:storage.target1>
    backing-store /srv/iscsi_disk.img
    initiator-address 192.168.1.100
</target>

Replace 192.168.1.100 with the IP address of the initiator (the machine that will connect to this storage). You can configure it for multiple initiators by adding more initiator-address entries or using initiator-name for specific clients.

Step 4: Restart the iSCSI Service

After configuring the target, restart the tgt service to apply the changes:

sudo systemctl restart tgt

Your iSCSI target is now ready for initiators to connect.

Step 5: Connect from an iSCSI Initiator

To connect to the iSCSI storage from an initiator, you will need to install the iSCSI initiator software. If you're connecting from another Ubuntu machine, you can install the initiator with:

sudo apt install open-iscsi

Once installed, discover the available iSCSI targets on the storage server by running:

sudo iscsiadm -m discovery -t st -p your-server-ip

Replace your-server-ip with the IP address of your iSCSI storage server. After discovering the targets, log in to the desired target:

sudo iscsiadm -m node --targetname "iqn.2023-10.com.example:storage.target1" --login

This will connect the initiator to the iSCSI target, allowing it to use the shared storage. You can now format and mount the iSCSI disk as needed.

Step 6: Verify Connection

To ensure that the connection was successful, you can check the available disks on the initiator machine using:

lsblk

The iSCSI disk should appear as a new block device, ready to be used as storage. This setup is useful for sharing storage across multiple servers, whether they are hosted on Windows VPS Italy, Virtueller Server, or Windows Virtual Dedicated Server Hosting solutions.

Conclusion

By following these steps, you have successfully set up an iSCSI storage server on Ubuntu 20.04 LTS. This allows you to share storage over a network, enabling flexible and scalable storage solutions. Whether you're using a UK Windows VPS or another VPS platform, iSCSI provides a robust way to manage shared storage for multiple clients.

War diese Antwort hilfreich? 0 Benutzer fanden dies hilfreich (0 Stimmen)