Unable to remove static iSCSI target
search cancel

Unable to remove static iSCSI target

book

Article ID: 370577

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi 7.0

Issue/Introduction

  • Unable to remove static iSCSI target via GUI or CLI using the command:

esxcli iscsi adapter discovery statictarget remove -A <vmhba> -a <address> -n <iqn>

  • Error message:

"An iSCSI session is active on this vmknic. Either remove this active session or use --force=true to force unbind"

Environment

ESXi 6.7

ESXi 7.0

Cause

The issue occurs because the boot device may have previously used the iSCSI target.

Resolution

  1. Reset the boot flag using the following command:
    vmkiscsid -x 'update nodes set "node.boot_target"="No" where "node.name"="<iqn>"'
  2. After resetting the boot flag, remove the target with:
    esxcli iscsi adapter discovery statictarget remove -A <vmhba> -a <address> -n <iqn>