Creating a Ubuntu iSCSI SAN Storage Server for VMware vSphere ESXi
Disclosure. This page contains links to products that may earn us a small commission at no extra cost to you, should you click on them and make a purchase. Read full disclosure.
This guide shows you how to configure Ubuntu as an iSCSI SAN that you can use with VMware and its advanced features like VMotion and Storage VMotion.
Introduction
I’ve been testing VMware vSphere 6.7 and the vCenter appliance on my MacBook using VMware Fusion to test VMotion and Storage VMotion.
Since I’ve only got 16 GB of RAM, running FreeNAS wasn’t really an option so I created a Ubuntu 18.04 VM with 1 GB of RAM and turned it into an iSCSI SAN.
In this guide I’ll show you how to configure Ubuntu to serve a 1 TB thin provisioned disk via iSCSI and how to connect it to vSphere ESXi 6.7.
The steps below have been tested on a Ubuntu 18.04 virtual machine running on VMware Fusion 11.5*.
Ubuntu iSCSI Target Software
In order to turn Ubuntu into a storage server that can be accessed by multiple ESXi hosts via iSCSI, we need to choose an iSCSI target software package.
There are multiple iSCSI target options (here is a link to a comparison) we can use with Linux but the one we’re going to use in this guide is SCST.
SCST is well tested, high performance, and has useful features like thin provisioning which work well with VMware. SCST has also been used in some enterprise storage solutions that have passed the VMware certification.
Installing SCST on Ubuntu 18.04
SCST is not in the official Ubuntu repositories so we’ll need to compile it from source and install it.
Run the following commands to install SCST.
mkdir ~/scst-build
cd ~/scst-build
sudo apt install git devscripts equivs dkms
git clone -b ubuntu-3.4.x https://github.com/ubuntu-pkg/scst.git
cd scst
sudo mk-build-deps -i -r
dpkg-buildpackage -b -uc
sudo mkdir -p /var/lib/scst/pr
sudo mkdir -p /var/lib/scst/vdev_mode_pages
sudo dpkg -i ../scst-dkms_*deb
sudo dpkg -i ../iscsi-scst_*.deb
sudo dpkg -i ../scstadmin_*deb
sudo /etc/init.d/scst start
Create a folder to store the disk images
Let’s create a folder to store disk images.
sudo mkdir /srv/vmware
Create a 1 TB thin provisioned image
Run the following command to create a 1TB thin provisioned disk inside the vmware folder called disk1.
sudo dd if=/dev/zero of=/srv/vmware/disk1 bs=1 count=0 seek=1T
Note: the max size of this image is 1TB but after running the command above it will only be using 0 bytes on disk. You can check this by running:
ls -lh /srv/vmware
total 0
-rw-r--r-- 1 root root 1.0T Oct 23 12:15 disk1
Export the disk image as a iSCSI LUN
Now we need to export the disk image as a thin provisioned iSCSI target using SCST.
Create scst.conf file.
sudo vim /etc/scst.conf
Add the following contents to the file.
HANDLER vdisk_fileio {
DEVICE disk1 {
filename /srv/vmware/disk1
nv_cache 0
thin_provisioned 1
}
}
TARGET_DRIVER iscsi {
enabled 1
TARGET iqn.2019-10.graspingtech.com:disk1 {
enabled 1
rel_tgt_id 1
LUN 0 disk1
}
}
Apply the changes.
sudo scstadmin -config /etc/scst.conf
We’re now ready to connect to the iSCSI target with VMware ESXi.
Adding the iSCSI LUN to VMware vSphere ESXi 6.7
Login to the HTML client of vCenter 6.7 and then perform the following steps to add the iSCSI server to the ESXi hosts.
- Click on Hosts and Clusters
- Click on the host we want add the iSCSI LUN to.
- Click on Configure.
- Click on Storage Adapters.
- Click on Add Software Adapter.

Select Add software iSCSI adapter then click OK.

The software iSCSI adapter should now be in the list of storage adapters.
- Click on the software iSCSI adapter.
- Click on the Dynamic Discovery tab.
- Click Add.

Enter the IP address of the Ubuntu iSCSI server and then click OK.

Once the server is added you will need to click Rescan Adapter for the software adapter to detect any devices on the target.

Now click on the Devices tab and you should see the thin provisioned disk we created when configuring the iSCSI target.

Repeat these steps for any more ESXi hosts you have in your cluster and then we’ll create a new VMFS volume in the next step.
Create new VMFS volume on the iSCSI LUN
Click Actions, Storage and then New Datastore.

Select VMFS then click NEXT.

Give the new datastore a name, select the 1 TB iSCSI LUN we created on the Ubuntu storage server and then click NEXT.

Select VMFS 6 then click NEXT.

Select the size of the partition you want to create, the block size and reclamation granularity and then click NEXT.

Click FINISH to create the datastore.

You should now see the datastore in the Datastores tab of each host in your cluster.

Final thoughts
The steps in this post showed you how to turn a Ubuntu 18.04 machine into an iSCSI storage server that’s good enough to test VMotion and Storage VMotion.
Since we aren’t using FreeNAS, it’s possible to host the Ubuntu SAN, two ESXi hosts, the vCenter appliance and a nested VM on a MacBook Pro with 16 GB of RAM.
The iSCSI target LUN was configured to use thin provisioning, which means even though the Ubuntu VM only has a 20 GB hard drive, we were able to make ESXi think there is 1 TB.
And since we used a VMFS 6 volume, the size of the image can grow/shrink when VMs are migrated to and from the datastore.