Tuesday, December 9, 2014

Ubuntu server auto mount iSCSi storage

Install Open-iSCSI initiator
apt-get install open-iscsi

configuration file could be located at /etc/iscsi/iscsid.conf or ~/.iscsid.conf.
node.startup = automatic
node.session.auth.username = MY-ISCSI-USER
node.session.auth.password = MY-ISCSI-PASSWORD
discovery.sendtargets.auth.username = MY-ISCSI-USER
discovery.sendtargets.auth.password = MY-ISCSI-PASSWORD

Discover iSCSi Target
iscsiadm -m discovery -t sendtargets -p

Login to target
iscsiadm --mode node --targetname iqn.1992-04.com.emc:cx.fcnma082600013.a0 --portal --login

Note: remember login to your iSCSi server (SAN) then allow your server connection
Make sure you auto connect to iSCSi server target when server start up
vi /etc/iscsi/nodes/iqn.1992-04.com.emc\:cx.fcnma082600013.b1/\,3260\,3/default

node.startup = automatic

Restart service
/etc/init.d/open-iscsi restart

Format and mount the iSCSi volume

dmesg or fdisk -l, or look at /var/log/messages to find new devices
You can use LVM or partition your disk now
fdisk /dev/sde

Format a partition ext4 or xfs or brtfs
mkfs.ext4 /dev/sde1

Mount file system
mkdir /backupdata
mount /dev/sde1 /backupdata

Add mount point to /etc/fstab 
/dev/sde1  /backupdata ext4 defaults 0 0


Post a Comment