Resizing ISCSI with Multipath on Proxmox with TrueNAS

proxmox-logo-png-2.png

DISCLAIMER

You are follow this guide at your own risk of losing data and without any guarantees that it works, please do a backup before applying any of the commands. My production environment does not have valuable customer or stuff like that - It’s only for my home lab and programming stuff to do and I can always do a restore if anything goes wrong.

How to resize multipath ISCSI devices on live production

I had a situation recently where the VM storage were low on disk space. I couldn’t shutdown the whole cluster with two compute hosts, two storage machines, dozen VMs, and dozen containers inside a Kubernetes cluster also.

So what to do then? I did some research on how to do a live-resize of multipath ISCSI devices. Couldn’t find anything complete but just some bits here and some bits there. I did some old fashioned trail-and-error to success. So I decided to write this blog post about my findings on my environment and also to have it as a reference material later on.

Summary steps:

  1. Edit Zvol in TrueNAS to enlarge the size

  2. Rescan ISCSI target on the PVE hosts (iscsiadm --mode session --rescan)

  3. Check that the target got enlarged (lsblk)

  4. Activate rescan on multipath device ( echo 1 > /sys/block/’path_device’/device/rescan - ‘path_device’ in my case sdb)

  5. Resize multipath device (multipathd resize map ‘multipath_device’ - ‘multipath_device’ in my case 36589cfc00…….)

  6. Resize the filesystem (resize2fs /dev/mapper/’multipath_device’ - multipath_device’ in my case 36589cfc00…….)

After these steps Proxmox GUI auto recognized the resize of the disk space.


  1. Edit Zvol in TrueNAS

    (Editors note: Using TrueNas 12.0-U4 when this is written)

    You need to login to your TrueNAS instance and go to Storage -> Pools and click on the three dots to the right of the Zvol and choose edit Zvol.

    In the new window appearing you need to choose a larger number of the size and press Save.

edit_zvol_truenas.png

You do the change of size in the field “Size for this zvol”

Remember that sizes uses the unit TiB, or GiB and not GB or TB. Google that is you don’t know what’s the difference.


2. Rescan ISCSI targets on PVE hosts

(Editors note: Using Proxmox 6.4-8 when this is written)

rescan_iscsi_targets_pve_host.png

Login to the ProxMox Virtual Environment (PVE) host and do a rescan of ISCSI target with the follow command

iscsiadm --mode session --rescan

 

3. Check target size

on the PVE host you need to check is the rescan did the work by issuing the command

lsblk

From this you see sdb is 3.5T, 2.5T before. Ignore the row under with mpath, we will get there soon.

From this you see sdb is 3.5T, 2.5T before. Ignore the row under with mpath, we will get there soon.

 

4. Activate rescan on multipath device

Before we can resize the the multipath device, we need to activate the rescan of multipath device by this command

echo 1 > /sys/block/sdb/device/rescan

 

5. Resize multipath device

To resize the multipath device you need to run the follow command

multipathd resize map 36589cfc………..

The number is what you get from lsblk on the row that says mpath for your device

 

6. Resize the filesystem

The only step left is to resize the filesystem for ProxMox to get the resize

resize2fs /dev/mapper/36589cfc……

The number is what you get from lsblk on the row that says mpath for your device

After this you are able to use the new space for what reason you have.

If you have any additions to this, please reach out to my by Twitter.

Nästa
Nästa

Welcome to my blog!