Proxmox: iSCSI LUN as Shared Storage

AI generated image of a HDD connected to a weird Y cable & a computer tower with LED lights on the front.
Not representative of iSCSI at all, I just like the AI-generated USB(?) Y-cable.

While checking out an ASUSTOR NAS (the Lockerstor 6 Gen2), I tested various configurations of storage and storage types. As part of that, I set up iSCSI targets for a Proxmox cluster, to enable the use of High Availability.

The previous post covered the creation of the iSCSI Target and LUN on an ASUSTOR NAS, but the concepts are generally transferrable no matter your NAS platform, so pop over there to set your LUNs up before coming back.

This article will show the process of mounting iSCSI storage and creating a LVM (Logical Volume Manager) which is sharable across nodes on Proxmox VE 7.3 through Proxmox VE 8.1, however, the underlying components are stable and these instructions are likely to work on older/newer versions, too.

Open a Shell

Either SSH to your Proxmox node, or log in to the web interface, choose the node, and select Shell.

We're going to edit the file /etc/iscsi/iscsid.conf, so using your favourite text editor, open the file.

nano /etc/iscsi/iscsid.conf

n-comment the following lines (or just paste them again, at the end of the file) and edit to add the username and password you set when creating the iSCSI target.

node.session.auth.authmethod = CHAP
node.session.auth.username = testtesttest
node.session.auth.password = your_password
🤔
If you're using more than one Proxmox node (i.e. setting up iSCSI for High Availability storage), make sure you apply the CHAP authentication changes to the other required nodes, too.

Save the file, and head to the Proxmox web interface.

Add iSCSI

From the web interface, choose Datacenter -> Storage -> Add -> iSCSI.

Screenshot showing the Proxmox VE interface. Shows the Datacenter view.

You'll be prompted to add an ID (so you can identify the created iSCSI object). The Portal is the IP of the NAS/storage location, and the Target is, unsurprisingly, the iSCSI Target on that device.

You can confirm your CHAP settings are correct if you click the dropdown arrow and the IQN populates in the list.

Screenshot showing iSCSI addition modal window. The configured iSCSI target & portal is being added.

If you want the target to be available to all nodes in the Datacenter, leave Nodes as 'All', otherwise choose the nodes you want from the drop-down. Leave Enable...enabled.

Use LUNs directly is checked by default, but you'll most likely want to uncheck this. When enabled, a created VM will use the entire LUN as its storage drive, where we want to create an LVM on the large LUN.

💡
If you only want one VM to run on this LUN, leave 'Use LUNs directly' enabled and skip creating the LVM in the next step!

Click Add to confirm, and your iSCSI device will now be available.

Add LVM

From the same Datacenter -> Storage page, again click Add, and this time choose LVM.

Screenshot of the Proxmox VE web interface, show the Datacenter view, and the dropdown of the 'Add' button.
🤔
You could choose LVM-Thin if you want to be able to create snapshots, but this will prevent using the LVM for high available/VM failovers. If you only have one node, LVM-Thin could be a good option, however.

Enter an ID, and then for Base storage, click the dropdown and choose the iSCSI Target we just configured. Now under Base volume, you'll see the list of LUNs available to us. In this case, there's only one... select it.

Screenshot of the Proxmox VE 'Add: LVM' modal window. Shows the LVM ID being set, the storage location being chosen, and the base volume LUN being set.

Next, name the Volume group. As we're creating one logical volume on the LUN, I've just given this the same name as the ID but appended with -VG.

For content, you can specify whether you want to allow only containers or VMs, but leave as default if you want both. Like with the previous 'Add iSCSI' pane, we select what nodes should have access to this LVM. Select what you previously chose, but leaving as All is most likely what you want. Leave Enable checked, and then check Shared if you want to allow the LVM to be treated as shared storage (i.e. used for High Availability failover).

Screenshot of the 'Add: LVM' modal window showing the completed form, as per previous screenshot, plus the Enable and Shared checkboxes being set.

Once you're happy, click Add. Now under storage, you should see the new LVM, and if you go through to create a VM, when you get to Disks, you should see the new LVM show up!

Screenshot of the Proxmox web interface, showing the 'Create: Virtual Machine' windows as a demonstration of the newly added lvm option being available for VM storage.

Potential Issues

If you're adding your LUN to a cluster, you'll most likely need to reboot all but the primary node, otherwise you might see a question mark icon over the iSCSI and LVM options in the Server View, and find that these nodes are unable to connect to the target at all.

Screenshot of the iSCSI LUN and LVM not being available on a Proxmox node. A question mark is shown in front of the icon for both lines.

Summary

That's it! You've created an iSCSI target and LUN on your Asustor NAS, and you've configured one or more Proxmox nodes to use it as storage (or maybe shared storage) for VMs and containers!

Although this post is specific to Proxmox VE and written from the point of view of using an Asustor NAS, but Synology/QNAP systems are equally viable, or any other storage system that supports iSCSI.

If there's anything I've missed, please leave a comment or let me know at @techbits@fosstodon.org.



Great! Next, complete checkout for full access to techbits.io
Welcome back! You've successfully signed in
You've successfully subscribed to techbits.io
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated