Get iSCSI devices to mount at persistent mountpoints on Linux

(Last modified: 23Sep2005)

This document (10097545) is provided subject to the disclaimer at the end of this document.

goal

Get iSCSI devices to mount at persistent mountpoints on Linux

symptom

Server hangs when stopping iSCSI

iSCSI devices change each time iscsi reconnects

fact

iSCSI

Linux

Open Enterprise Server (OES) - Linux

SLES 9

Novell Linux Desktop 9

note

This information is pieced together from the following sources:
Man page for iscsi.bindings(5) on SLES9
Man page for iscsid(8) on SLES9
Man page for iscsi.conf(5) on SLES9

fix

1.  Manually dismount any mounted iscsi targets
2.  Unload iSCSI, if running (rciscsi stop).
3.  Add the target device to /etc/iscsi.conf.  The defaults should be good for most, if not you can edit them according to your environment.
    Add a line at the bottom with your iSCSI Target device's IP Address.  For example, if my iSCSI target had an address of 192.168.10.10, I would add the following:
   DiscoveryAddress=192.168.10.10
4.  We need the target name(s) for the next part.  An easy way to get them is to start iscsi (rciscsi start), then look at the contents of the directory /dev/disk/by-id/.  There should be files beginning with iscsi-iqn for each iscsi device / partition we are connected to,  Partitions are denoted by the device with px appended, where x is the partition on the disk.
5.  If the disk is not yet partitioned / formatted, you will need to do that.  YaST should detect the iSCSI disks and be able to partition them.  Note that if you use YaST to partition the disks, don't assign mountpoints.  This will make entries in /etc/fstab, which you do NOT want.  You will be able to see the target name associated with the device in the "type" column.  Alternatively, you can use fdisk on the /dev/disk/by-id/iscsi-iqn* links to know which device you are partitioning.  After the disk is partitioned, you should see partitions as described in the previous step.  They can be formatted using YaST or command line tools.
6.  Create the perpetual mountpoints you want to use.
7.  Use the partition names in /dev/disk/by-id/ to edit /etc/fstab.iscsi.  A sample /etc/fstab.iscsi with two iscsi targets partitioned differently is shown here:

# /etc/fstab.iscsi file for filesystems built on iscsi devices.
#
# A typical entry here would look like:
# /dev/disk/by-id/iscsi-iqn.2001-04.example.com:storage:disk2.sys1 /mnt ext2 defaults 0 0
#
# Where /dev/disk/by-id/iscsi-iqn.2001-04.com.example:storage:disk2.sys1 is an iscsi device
#
# See fstab(5) for further details on configuring devices.
#
/dev/disk/by-id/iscsi-iqn.1984-08.com.novell:00611233-48b3-d911-9511-00c04f2e8a98-0p1 /mnt/iscsi/perpetual1 reiserfs defaults 0 0
/dev/disk/by-id/iscsi-iqn.1984-08.com.novell:00611233-48b3-d911-9511-00c04f2e8a98-0p2 /mnt/iscsi/perpetual2 reiserfs defaults 0 0
/dev/disk/by-id/iscsi-iqn.1984-08.com.novell:00611233-48b3-d911-9511-00c04f2e8a98-0p3 /mnt/iscsi/perpetual3 reiserfs defaults 0 0
/dev/disk/by-id/iscsi-iqn.1984-08.com.novell:00c234cb-238f-d911-9510-00c04f2e8a98-0p1 /mnt/iscsi/perpetual4 reiserfs defaults 0 0

8.  You are now ready to mount the disks.  Use iscsi-mountall to mount the devices in /etc/fstab.iscsi.  "rciscsi start" or "rciscsi restart" will also try to mount these.  Also, don't forget to add it to the services started on boot with insserv iscsi.

document

Document Title: Get iSCSI devices to mount at persistent mountpoints on Linux
Document ID: 10097545
Solution ID: NOVL101983
Creation Date: 28Apr2005
Modified Date: 23Sep2005
Novell Product Class:Linux

disclaimer

The Origin of this information may be internal or external to Novell. Novell makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Novell makes no explicit or implied claims to the validity of this information.
Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark information.