Quantcast
Channel: GoLinuxHub
Viewing all articles
Browse latest Browse all 392

How to delete an iscsi-target from openfiler and Linux

$
0
0
In my last article I had shown you steps to create iscsi-target using openfiler. So in this article I will be showing you step by step method to delete an iscsi-target from openfiler.

This is my GUI console of openfiler where I want to delete the target marked in  red .

Now you won't be able to delete the target from the GUI, so login to the CLI of the server using putty or directly via the console of the server.

Login using the root account and follow the below steps
# cd /opt/openfiler/etc/iscsi

# ls -l
total 28
-rw-r--r-- 1 openfiler openfiler 2000 Jul 28 19:52 ietd.conf.tmp
drwxr-xr-x 2 root      root      4096 Jul 28 19:41 iqn.2006-01.com.openfiler:ctdb
drwxr-xr-x 2 root      root      4096 Jul 28 19:41 iqn.2006-01.com.openfiler:qdisk
drwxr-xr-x 2 root      root      4096 Jul 28 19:40 iqn.2006-01.com.openfiler:san
drwxr-xr-x 2 root      root      4096 Jul 28 19:52 iqn.2006-01.com.openfiler:tsn.dc0b0f3d8f75
drwxr-xr-x 2 root      root      4096 Jul 28 19:43 targets
drwxr-xr-x 2 root      root      4096 Apr 12  2011 transforms

As you can see all the iscsi-targets created are visible. Go ahead and remove the target which you do not require any more
# rm -rf "iqn.2006-01.com.openfiler:tsn.dc0b0f3d8f75"
Now change directory into targets
# cd targets/

# pwd
/opt/openfiler/etc/iscsi/targets

Open the iscsi_settings.xml file and remove the iscsi-target entry as shown below in  red 
# vi iscsi_settings.xml
<?xml version="1.0"?>
<iet>
  <globalsettings>
    <isns/>
  </globalsettings>
  <targets>
    <target Name="iqn.2006-01.com.openfiler:san">
      <HeaderDigest value="None"/>
      <DataDigest value="None"/>
      <MaxConnections value="1"/>
      <InitialR2T value="Yes"/>
      <ImmediateData value="No"/>
      <MaxRecvDataSegmentLength value="131072"/>
      <MaxXmitDataSegmentLength value="131072"/>
      <MaxBurstLength value="262144"/>
      <FirstBurstLength value="262144"/>
      <DefaultTime2Wait value="2"/>
      <DefaultTime2Retain value="20"/>
      <MaxOutstandingR2T value="8"/>
      <DataPDUInOrder value="Yes"/>
      <DataSequenceInOrder value="Yes"/>
      <ErrorRecoveryLevel value="0"/>
      <Wthreads value="16"/>
      <QueuedCommands value="32"/>
      <lun Id="0" Path="/dev/san/work" Type="blockio" ScsiId="hgrEcw-zeTg-cXpE" ScsiSN="hgrEcw-zeTg-cXpE" IOMode="t"/>
    </target>
    <target Name="iqn.2006-01.com.openfiler:ctdb">
      <HeaderDigest value="None"/>
      <DataDigest value="None"/>
      <MaxConnections value="1"/>
      <InitialR2T value="Yes"/>
      <ImmediateData value="No"/>
      <MaxRecvDataSegmentLength value="131072"/>
      <MaxXmitDataSegmentLength value="131072"/>
      <MaxBurstLength value="262144"/>
      <FirstBurstLength value="262144"/>
      <DefaultTime2Wait value="2"/>
      <DefaultTime2Retain value="20"/>
      <MaxOutstandingR2T value="8"/>
      <DataPDUInOrder value="Yes"/>
      <DataSequenceInOrder value="Yes"/>
      <ErrorRecoveryLevel value="0"/>
      <Wthreads value="16"/>
      <QueuedCommands value="32"/>
      <lun Id="0" Path="/dev/san/ctdb" Type="blockio" ScsiId="zegB7p-3BHl-ySne" ScsiSN="zegB7p-3BHl-ySne" IOMode="t"/>
    </target>
    <target Name="iqn.2006-01.com.openfiler:qdisk">
      <HeaderDigest value="None"/>
      <DataDigest value="None"/>
      <MaxConnections value="1"/>
      <InitialR2T value="Yes"/>
      <ImmediateData value="No"/>
      <MaxRecvDataSegmentLength value="131072"/>
      <MaxXmitDataSegmentLength value="131072"/>
      <MaxBurstLength value="262144"/>
      <FirstBurstLength value="262144"/>
      <DefaultTime2Wait value="2"/>
      <DefaultTime2Retain value="20"/>
      <MaxOutstandingR2T value="8"/>
      <DataPDUInOrder value="Yes"/>
      <DataSequenceInOrder value="Yes"/>
      <ErrorRecoveryLevel value="0"/>
      <Wthreads value="16"/>
      <QueuedCommands value="32"/>
      <lun Id="0" Path="/dev/san/qdisk" Type="blockio" ScsiId="VWq9z7-aa2l-6RMj" ScsiSN="VWq9z7-aa2l-6RMj" IOMode="wt"/>
    </target>
   <target Name="iqn.2006-01.com.openfiler:tsn.dc0b0f3d8f75">
      <HeaderDigest value="None"/>
      <DataDigest value="None"/>
      <MaxConnections value="1"/>
      <InitialR2T value="Yes"/>
      <ImmediateData value="No"/>
      <MaxRecvDataSegmentLength value="131072"/>
      <MaxXmitDataSegmentLength value="131072"/>
      <MaxBurstLength value="262144"/>
      <FirstBurstLength value="262144"/>
      <DefaultTime2Wait value="2"/>
      <DefaultTime2Retain value="20"/>
      <MaxOutstandingR2T value="8"/>
      <DataPDUInOrder value="Yes"/>
      <DataSequenceInOrder value="Yes"/>
      <ErrorRecoveryLevel value="0"/>
      <Wthreads value="16"/>
      <QueuedCommands value="32"/>
      <lun Id="0" Path="/dev/san/ctdb" Type="blockio" ScsiId="zegB7p-3BHl-ySne" ScsiSN="zegB7p-3BHl-ySne" IOMode="wt"/>
    </target>

  </targets>
</iet>
Once done save and exit the file and restart the iscsi-target services
# /etc/init.d/iscsi-target restart
Stopping iSCSI target service: ......                      
[  OK  ]
Starting iSCSI target service:                             [  OK  ]

Verify the changes as you can see the target is successfully deleted.


Once the iscsi-target is removed from the openfiler you might get the below error on your client linux machine while attempting to restart the iscsi services
# service iscsi restart
Stopping iscsi:                                            [  OK  ]
Starting iscsi: iscsiadm: Could not login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.dc0b0f3d8f75, portal: 192.168.1.8,3260].
iscsiadm: initiator reported error (19 - encountered non-retryable iSCSI login failure)
iscsiadm: Could not log into all portals

To remove iscsi target from linux machine
# service iscsi stop
Stopping iscsi:                                            
[  OK  ]

Delete the selected target using the below command
# iscsiadm -m node -o delete -T "iqn.2006-01.com.openfiler:tsn.dc0b0f3d8f75" --portal 192.168.1.8,3260
Re-discover the iscsi target from the openfiler server and as you see below we only have the required targets
# iscsiadm -m discovery -t sendtargets -p 192.168.1.8
192.168.1.8:3260,1 iqn.2006-01.com.openfiler:qdisk
192.168.1.8:3260,1 iqn.2006-01.com.openfiler:ctdb
192.168.1.8:3260,1 iqn.2006-01.com.openfiler:san

Start the required iscsi services on the linux box
# service iscsi start
Starting iscsi:                                            
[  OK  ]


I hope I made my self clear.

Related Articles
Configuring iSCSI storage using openfiler
How to install openfiler
How to configure iscsi target using Red Hat Linux


Follow the below links for more tutorials

How to perform a local ssh port forwarding in Linux
What are the different types of Virtual Web Hosting in Apache
Comparison and Difference between VMFS 3 and VMFS 5
How to configure PXE boot server in Linux using Red Hat 6
How to secure Apache web server in Linux using password (.htaccess)
How to register Red Hat Linux with RHN (Red Hat Network )
How does a DNS query works when you type a URL on your browser?
How to create password less ssh connection for multiple non-root users
How to create user without useradd command in Linux
How to give normal user root privileges using sudo in Linux/Unix
How to do Ethernet/NIC bonding/teaming in Red Hat Linux
How to install/uninstall/upgrade rpm package with/without dependencies
Why is Linux more secure than windows and any other OS
What is the difference between "su" and "su -" in Linux?
What is the difference/comparison between Unix and Linux ?
RAID levels 0, 1, 2, 3, 4, 5, 6, 0+1, 1+0 features explained in detail


Viewing all articles
Browse latest Browse all 392

Latest Images

Trending Articles



Latest Images