For connecting NAS to CentOS via ISCSi you need to setup file-based LUNs on NAS

Connect CentOS server to the internet (in case of no internet, you will have download the rpms and upload them on CentOS manually)

  • Install Epel repository:
# yum install epel-release
  • Install ISCSi-initiator utils:
# yum install iscsi-initiator-utils
  • If you using CHAP authentification - edit /etc/iscsi/iscsid.conf (for example, using vi)
    Uncomment next strings and add login/password:
node.session.auth.authmethod = CHAP
node.session.auth.username = admin
node.session.auth.password = 123456
  • Add service in auto-boot and start it:
# systemctl enable iscsid
# systemctl start iscsid
  • Search ISCSi-targets
# iscsiadm -m discovery -t sendtargets -p 192.168.0.1

(where 192.168.0.1 - ISCSi-target IP address)

  • Connect to ISCSi-target
# iscsiadm -m node --login
  • Check new disk in system

# lsblk
  • Mark-up a new disk:

# parted /dev/{} mktable gpt
(where {} - your disk)
# parted /dev/{} mkpart --primary ext4 1M -1
# mkfs.ext4 -F -L TrassirArchive /dev/{}
  • Check UUID of new disk
# blkid
  • Create a new folder in /media:
# mkdir /media/[Foldername] && sudo chmod 777 /media/[Foldername]

For example, [Foldername] can be TrassirArchive4

  • Mount new disk in /media/[Foldername]
# mount /dev/{} /media/[Foldername]
  • Add a new disk in /etc/fstab (as a new string) (use vi, for example)
UUID=XXXXX /media/Foldername ext4 _netdev,x-systemd.after=iscsi.service 0 0 (where XXXXX - UUID)
  • Disable archive writing in /media/[Foldername]
# chattr +i -VR /media/[Foldername]

iSCSI login failed due to authorization failure

If the login error will appear, you can try to change the language encoding from English to West Europe/Latin


  • Нет меток