Monday, July 14, 2014

Connect/Mount An iSCSI Volume On Ubuntu Server 14.04

          Ubuntu Linux Connect to an iSCSI Volume
                                     iSCSI Initiator : iSCSI (Internet Small Computer System Interface) is a protocol that allows SCSI commands to be transmitted over a network. Typically iSCSI is implemented in a SAN (Storage Area Network) to allow servers to access a large store of hard drive space. The iSCSI protocol refers to clients as initiators and iSCSI servers as targets.
Dell-SAN Storage      Management IP : 192.168.254.81     Storage IP :-  20.1.20.20
Volume Name : Jagan-Test      
                                      
Ubuntu Server :- iSCSI Initiator  eth0 IP : 10.3.3.85   Add Additional IP on eth1 :  20.1.20.35
InitiatorName=iqn.1993-08.org.debian:01:83201076dec4
In Dell Storage :
1. Access the storage via management IP
2. Create a Volume “ Jagan-Test ”
3. Add An Access Policy in Jagan-Test for discovering the Volume from Ubuntu Server

4. Add Basic Access Point : Here Set Initiator Name of the Ubuntu Server “ iiqn.1993-08.org.debian:01:83201076dec4” and IP “ 20.1.20.35 “
In Ubuntu Server :
iSCSI Initiator Install : iSCSI initiator install the open-iscsi package
sudo apt-get install open-iscsi
iSCSI Initiator Configuration
Edit /etc/iscsi/iscsid.conf changing the following:
    vi /etc/iscsi/iscsid.conf
node.startup = automatic  (Uncomment the Line)
#node.startup = manual
Check the Default  Initiator Name
    vi /etc/iscsi/initiatorname.iscsi
        InitiatorName=iqn.1993-08.org.debian:01:3f9fbbc38058
Check which Targets are available by using the iscsiadm utility
sudo iscsiadm -m discovery -t st -p
-m: determines the mode that iscsiadm executes in.
-t: specifies the type of discovery.
-p: option indicates the target IP address.
Example :
iscsiadm -m discovery -t st -p 20.1.20.20
20.1.20.20:3260,1 iqn.2001-05.com.equallogic:0-af1ff6-d93dee2cf-7a4816d61f6538c5-avctest
The iqn number and IP address above will vary depending on your hardware.
Connect to the iSCSI target :
root@ubuntu:/etc/iscsi# iscsiadm -m node --login
Logging in to [iface: default, target: iqn.2001-05.com.equallogic:0-af1ff6-855dee2cf-906006b8186568f5-it-test, portal: 20.1.20.20,3260] (multiple)
Login to [iface: default, target: iqn.2001-05.com.equallogic:0-af1ff6-855dee2cf-906006b8186568f5-it-test, portal: 20.1.20.20,3260] successful.
Check the Disk  Status
root@ubuntu:/etc/iscsi# fdisk -l
Device Boot      Start         End      Blocks   Id  System
/dev/xvda1            2048      499711      248832   83  Linux
/dev/xvda2          501758    16775167     8136705    5  Extended
/dev/xvda5          501760    16775167     8136704   8e  Linux LVM
Disk /dev/sda doesn't contain a valid partition table
Make sure that the new disk has been detected using dmesg:
root@ubuntu:/etc/iscsi# dmesg | grep sd
[ 1946.335705] sd 2:0:0:0: Attached scsi generic sg1 type 0
[ 1946.340459] sd 2:0:0:0: [sda] 2147512320 512-byte logical blocks: (1.09 TB/1.00 TiB)
[ 1946.342936] sd 2:0:0:0: [sda] Write Protect is off
[ 1946.342940] sd 2:0:0:0: [sda] Mode Sense: 81 00 00 00
[ 1946.343449] sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 1946.348980]  sda: unknown partition table
[ 1946.352281] sd 2:0:0:0: [sda] Attached SCSI disk
Create a Partition in new iSCSI disk
root@ubuntu:/# fdisk /dev/sda
n - New Partition
p - Primary
w - Save
Format the file system and Mount it in to /cluster-storage  
root@ubuntu:/etc/iscsi# mkfs.ext4 /dev/sda1
root@ubuntu:/# mkdir cluster-storage
root@ubuntu:/# mount /dev/sda1 /cluster-storage/
root@ubuntu:/# mount -a
root@ubuntu:/#mount
Check the HDD Usage Status :
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root   12G  1.2G  9.5G  11% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
udev                         2.0G  4.0K  2.0G   1% /dev
tmpfs                        395M  404K  395M   1% /run
none                         5.0M     0  5.0M   0% /run/lock
none                         2.0G     0  2.0G   0% /run/shm
none                         100M     0  100M   0% /run/user
/dev/xvda1                   236M   37M  188M  17% /boot
/dev/sda1                    9.8G   23M  9.2G   1% /cluster-storage
Mount the iSCSI drive during boot:
root@ubuntu:/# vi /etc/fstab
/dev/sda1/cluster-storage ocfs2 _netdev 0 0

No comments:

Post a Comment

bloggerwidgets