0

I have an AWS Storage gateway that exposes two iscsi targets. I am attaching them to an EC2 instance running Amazon Linux:

iscsiadm --mode node --targetname gateway.com.amazon:volume1 --portal  <ip>,3260 --login
iscsiadm --mode node --targetname gateway.com.amazon:volume2 --portal  <ip>,3260 --login

However, this attaches the volumes to /dev/sda and /dev/sdb. The boot volume is at /dev/xvda, and during the boot process the mount of /dev/sda fails and instead mounts the boot volume. If I manually unmount and remount /dev/sda after boot, things are fine:

$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda       8:0    0   8T  0 disk 
└─sda1    8:1    0   8T  0 part /share/volume-a
sdb       8:16   0   8T  0 disk 
└─sdb1    8:17   0   8T  0 part /share/volume-b
xvda    202:0    0   8G  0 disk 
└─xvda1 202:1    0   8G  0 part /

I've tried labeling the volumes with e2label, and using the labels in /etc/fstab, but that made no difference:

LABEL=volumeA /share/volume-a ext4 defaults,nofail 0 2
LABEL=volumeB /share/volume-b ext4 defaults,nofail 0 2

Is there a way to force the iscsiadm --login to start with a different device, say /dev/sdc?

3
  • I wonder if the trouble you are running into might be solved with "mkinitrd"? I've never used Amazon Linux, but I have done a lot with CentOS and RedHat. Especially when using LVM to define new disk volumes, if the drivers aren't loaded at boot time, then mounting LVM volumes fail until after the system boots and the modules are installed. Using mkinitrd will re-create your initial ramdisk image which should then include the drivers necessary for your iSCSI targets.
    – Eirik Toft
    Aug 7, 2015 at 4:58
  • @EirikToft: The Amazon Linux is based on CentOS. We're not using LVM.
    – chris
    Aug 7, 2015 at 12:14
  • I used LVM as an example as when I've had to rebuild the initrd image. I do have several systems that do mount iSCSI volumes, but since I have multiple paths to the storage array, I run them through multipath. This way I can choose the device using the multipath configuration and provide fault tolerance. Multipath uses aliases that then pick the device names (rather than sda, sdb) - I can share some configuration examples if this sounds good to you.
    – Eirik Toft
    Aug 7, 2015 at 14:50

0

You must log in to answer this question.

Browse other questions tagged .