Mount iscsi Network Devices using /etc/fstab

Shahriar Shovon

Supported OS

  • All

Categories

Share this post with your friends

If you're trying to mount network devices automatically at boot on Linux and your system is not booting correctly. This post is for you. Today I was working with iscsi. I created portals, acls, luns, targets with targetcli. But when I tried to mount it automatically through fstab file on boot, my system wasn't booting. I looked online and I found that I had to change the mount option. I did and it worked. I am going to write what mount option I used in this post. When my system wasn't booting, my /etc/fstab configuration file looked like this, # # /etc/fstab # Created by anaconda on Thu Nov 24 03:07:55 2016 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=0d83fc00-ee94-4741-8163-717418187f59 /boot xfs defaults 0 0 /dev/mapper/centos-swap swap swap defaults 0 0 UUID=f246ba49-5772-4efc-bec2-28ff76f46f79 /root/mounts/sdb xfs defaults 0 0 Here UUID=f246ba49-5772-4efc-bec2-28ff76f46f79, this is the iscsi drive I was trying to mount. The mount option was defaults. But to get it to work, I had to change the mount option to _netdev. What this option does is, it attempts to mount this device after all the network connection is initialized. So my working configuration looked like this, # # /etc/fstab # Created by anaconda on Thu Nov 24 03:07:55 2016 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=0d83fc00-ee94-4741-8163-717418187f59 /boot xfs defaults 0 0 /dev/mapper/centos-swap swap swap defaults 0 0 UUID=f246ba49-5772-4efc-bec2-28ff76f46f79 /root/mounts/sdb xfs _netdev 0 0