{"id":2569,"date":"2024-06-15T20:17:47","date_gmt":"2024-06-04T04:11:48","guid":{"rendered":""},"modified":"2025-02-02T00:46:18","modified_gmt":"2025-02-01T23:46:18","slug":"how-to-setup-an-iscsi-storage-server-on-ubuntu-20-04-lts","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-setup-an-iscsi-storage-server-on-ubuntu-20-04-lts\/","title":{"rendered":"How to Setup an iSCSI Storage Server on Ubuntu 20.04 LTS"},"content":{"rendered":"<p>\u00a0<\/p>\n<\/p>\n<h1>\u00a0<\/h1>\n<p>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  or other VPS solutions.<\/p>\n<h2>Prerequisites<\/h2>\n<p>Before starting, ensure you have the following:<\/p>\n<ul>\n<li>An Ubuntu 20.04 LTS server, which could be hosted on a <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">UK Windows VPS<\/a>, <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Server Hosting<\/a>, or another <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS Hosting UK<\/a> environment.<\/li>\n<li>Root or sudo privileges on your server.<\/li>\n<\/ul>\n<h2>Step 1: Update Your System<\/h2>\n<p>Before installing any new packages, make sure your server is up to date by running the following commands:<\/p>\n<pre><code>sudo apt update &amp;&amp; sudo apt upgrade<\/code><\/pre>\n<h2>Step 2: Install iSCSI Target Software<\/h2>\n<p>Next, install the iSCSI target software. This software will allow your server to act as a storage target for iSCSI initiators:<\/p>\n<pre><code>sudo apt install tgt<\/code><\/pre>\n<p>After installation, ensure that the <code>tgt<\/code> service is running:<\/p>\n<pre><code>sudo systemctl status tgt<\/code><\/pre>\n<p>If it is not running, you can start the service with the following command:<\/p>\n<pre><code>sudo systemctl start tgt<\/code><\/pre>\n<h2>Step 3: Create and Configure iSCSI Target<\/h2>\n<p>Now, create a storage device for your iSCSI target. This could be a logical volume, a partition, or a file. For this example, we\u2019ll create a 10GB file that will serve as our storage:<\/p>\n<pre><code>sudo dd if=\/dev\/zero of=\/srv\/iscsi_disk.img bs=1M count=10240<\/code><\/pre>\n<p>Next, configure the iSCSI target by editing the target configuration file:<\/p>\n<pre><code>sudo nano \/etc\/tgt\/conf.d\/iscsi-target.conf<\/code><\/pre>\n<p>Add the following configuration to create a target:<\/p>\n<pre><code>&lt;target iqn.2023-10.com.example:storage.target1&gt;\r\n    backing-store \/srv\/iscsi_disk.img\r\n    initiator-address 192.168.1.100\r\n&lt;\/target&gt;<\/code><\/pre>\n<p>Replace <code>192.168.1.100<\/code> 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 <code>initiator-address<\/code> entries or using <code>initiator-name<\/code> for specific clients.<\/p>\n<h2>Step 4: Restart the iSCSI Service<\/h2>\n<p>After configuring the target, restart the <code>tgt<\/code> service to apply the changes:<\/p>\n<pre><code>sudo systemctl restart tgt<\/code><\/pre>\n<p>Your iSCSI target is now ready for initiators to connect.<\/p>\n<h2>Step 5: Connect from an iSCSI Initiator<\/h2>\n<p>To connect to the iSCSI storage from an initiator, you will need to install the iSCSI initiator software. If you&#8217;re connecting from another Ubuntu machine, you can install the initiator with:<\/p>\n<pre><code>sudo apt install open-iscsi<\/code><\/pre>\n<p>Once installed, discover the available iSCSI targets on the storage server by running:<\/p>\n<pre><code>sudo iscsiadm -m discovery -t st -p your-server-ip<\/code><\/pre>\n<p>Replace <code>your-server-ip<\/code> with the IP address of your iSCSI storage server. After discovering the targets, log in to the desired target:<\/p>\n<pre><code>sudo iscsiadm -m node --targetname \"iqn.2023-10.com.example:storage.target1\" --login<\/code><\/pre>\n<p>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.<\/p>\n<h2>Step 6: Verify Connection<\/h2>\n<p>To ensure that the connection was successful, you can check the available disks on the initiator machine using:<\/p>\n<pre><code>lsblk<\/code><\/pre>\n<p>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 <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Microsoft SQL VPS Windows<\/a>, <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Virtueller Server<\/a>, or <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS<\/a> solutions.<\/p>\n<h2>Conclusion<\/h2>\n<p>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&#8217;re using a <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">UK Windows VPS<\/a> or another VPS platform, iSCSI provides a robust way to manage shared storage for multiple clients.<\/p>\n<footer>\n<p>For more VPS hosting options, visit . They offer a variety of <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Servers<\/a> and <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS Hosting UK<\/a> solutions to suit your needs.<\/p>\n<\/footer>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 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\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-2569","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2569"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2569\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}