Posts Tagged san

iSCSI SAN for CentOS 5.4


Well I guess I could have used OpenFiler for this… BUT here are a few steps to creating your own SAN-type-thing on CentOS 5.4…

#!/bin/bash
# iSCSI SAN for CentOS5.4
cd /usr/src
# Get the iscsi package
wget http://sourceforge.net/projects/iscsitarget/files/iscsitarget/1.4.20/iscsitarget-1.4.20.tar.gz/download
yum -y install kernel-devel openssl-devel gcc rpm-build make automake autoconf # you may already have these, this was a newer build for me so I didn’t…
tar -xzvf iscsitarget-1.4.20.tar.gz
cd iscsitarget-1.4.20
make
make install

# Name the disk
echo “Ok, I am going to name the disk for you”
echo “iqn.`date -I`.`hostname |awk -F “.” ‘{print $1’}`-sanhead” # awk only needed if u use FQDN’s
echo “BUT… you need to tell me what disk to use…”
df -h
echo “Type in the full path to your disk, i.e.(/dev/<md3>)”
read dname
touch /etc/initiators.allow
idname=”`echo iqn.`date -I`.`hostname |awk -F “.” ‘{print $1’}`-sanhead:$dname`”
echo “$idname 192.168.11.0/24” >> /etc/initiators.allow
touch /etc/initiators.deny
echo “ALL:ALL” >> /etc/initiators.deny
touch /etc/ietd.conf
echo “Target iqn.`date -I`.`hostname |awk -F “.” ‘{print $1’}`-sanhead:$dname” >> /etc/ietd.conf
echo ”        IncomingUser <uname>    <passwd>” >> /etc/ietd.conf
echo ”        OutgoingUser <uname>    <passwd>” >> /etc/ietd.conf
echo ”        Lun 0 Path=/dev/SAN/diskname,Type=fileio,IOMode=wb” >> /etc/ietd.conf
echo ”        Alias iSCSI for diskname” >> /etc/ietd.conf
echo ”        ImmediateData Yes” >> /etc/ietd.conf
echo ”        MaxConnections 1″ >> /etc/ietd.conf
echo ”        InitialR2T Yes” >> /etc/ietd.conf
yum -y install iscsi-initiator-utils open-iscsi
echo “InitiatorName=iqn.2010-04.factslx01-sanhead:factslx01” >> /etc/iscsi/initiatorname.iscsi
# /etc/iscsi/iscsid.conf
mv /etc/iscsi/iscsid.conf /etc/iscsi/iscsid.conf.bak
touch /etc/iscsi/iscsid.conf
chmod 600 /etc/iscsi/iscsid.conf
echo “# Default Settings” /etc/iscsi/iscsid.conf
echo “# Default Settings” /etc/iscsi/iscsid.conf
echo “#node.startup = automatic” /etc/iscsi/iscsid.conf
echo “#node.session.timeo.replacement_timeout = 120” /etc/iscsi/iscsid.conf
echo “#node.conn[0].timeo.login_timeout = 15” /etc/iscsi/iscsid.conf
echo “#node.conn[0].timeo.logout_timeout = 15” /etc/iscsi/iscsid.conf
echo “#node.conn[0].timeo.noop_out_interval = 5” /etc/iscsi/iscsid.conf
echo “#node.conn[0].timeo.noop_out_timeout = 5” /etc/iscsi/iscsid.conf
echo “#node.session.err_timeo.abort_timeout = 15” /etc/iscsi/iscsid.conf
echo “#node.session.err_timeo.lu_reset_timeout = 20” /etc/iscsi/iscsid.conf
echo “#node.session.initial_login_retry_max = 8” /etc/iscsi/iscsid.conf
echo “#node.session.cmds_max = 128” /etc/iscsi/iscsid.conf
echo “#node.session.queue_depth = 32” /etc/iscsi/iscsid.conf
echo “#node.session.iscsi.InitialR2T = No” /etc/iscsi/iscsid.conf
echo “#node.session.iscsi.ImmediateData = Yes” /etc/iscsi/iscsid.conf
echo “#node.session.iscsi.FirstBurstLength = 262144” /etc/iscsi/iscsid.conf
echo “#node.session.iscsi.MaxBurstLength = 16776192” /etc/iscsi/iscsid.conf
echo “#node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144” /etc/iscsi/iscsid.conf
echo “#discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768” /etc/iscsi/iscsid.conf
echo “#node.conn[0].iscsi.HeaderDigest = None” /etc/iscsi/iscsid.conf
echo “#node.session.iscsi.FastAbort = Yes” /etc/iscsi/iscsid.conf
echo “#” /etc/iscsi/iscsid.conf
echo “# Custom Settings” /etc/iscsi/iscsid.conf
echo “node.startup = automatic” /etc/iscsi/iscsid.conf
echo “node.session.auth.authmethod = CHAP” /etc/iscsi/iscsid.conf
echo “node.session.auth.username = <uname>” /etc/iscsi/iscsid.conf
echo “node.session.auth.password = <passwd>” /etc/iscsi/iscsid.conf
echo “node.session.auth.username_in = <uname>” /etc/iscsi/iscsid.conf
echo “node.session.auth.password_in = <passwd>” /etc/iscsi/iscsid.conf
echo “node.session.timeo.replacement_timeout = 120” /etc/iscsi/iscsid.conf
echo “node.conn[0].timeo.login_timeout = 15” /etc/iscsi/iscsid.conf
echo “node.conn[0].timeo.logout_timeout = 15” /etc/iscsi/iscsid.conf
echo “node.conn[0].timeo.noop_out_interval = 10” /etc/iscsi/iscsid.conf
echo “node.conn[0].timeo.noop_out_timeout = 15” /etc/iscsi/iscsid.conf
echo “node.session.initial_login_retry_max = 10” /etc/iscsi/iscsid.conf
echo “node.session.cmds_max = 128” /etc/iscsi/iscsid.conf
echo “node.session.queue_depth = 32” /etc/iscsi/iscsid.conf
echo “node.session.iscsi.InitialR2T = No” /etc/iscsi/iscsid.conf
echo “node.session.iscsi.ImmediateData = Yes” /etc/iscsi/iscsid.conf
echo “node.session.iscsi.FirstBurstLength = 262144” /etc/iscsi/iscsid.conf
echo “node.session.iscsi.MaxBurstLength = 16776192” /etc/iscsi/iscsid.conf
echo “node.conn[0].iscsi.MaxRecvDataSegmentLength = 131072” /etc/iscsi/iscsid.conf
echo “discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768” /etc/iscsi/iscsid.conf
echo “node.session.iscsi.FastAbort = No” /etc/iscsi/iscsid.conf
echo “# EOF” /etc/iscsi/iscsid.conf
service iscsi start
i=”`ifconfig |grep -v 127.0.0.1|grep “inet addr:” |awk -F “:” ‘{print $2}’|cut -c 1-14`”
iscsiadm -m discovery -t st -p $i # IP for iSCSI host
iscsiadm -m node -p $i -T iqn.`date -I`.`hostname |awk -F “.” ‘{print $1’}`-sanhead:$dname –login

So there it is !!! Now go use OpenFiler… LOL -> http://www.openfiler.com/

Advertisements

, , , , , , , , , ,

2 Comments

Adding space to server by assigning a new lun


Off we go…
On the filer:
n3601*> lun show
.
.
.
/vol/bcdvb10_web10_dev_boot/bcdvb10_web10_dev_boot   34.0g (36509319168)   (r/w, online, mapped)
.
.
.
n3601*> igroup show
bcdvb10_web10_dev (FCP) (ostype: linux):
21:00:00:1b:32:14:76:6f (logged in on: vtic, 0a)
21:01:00:e0:8b:34:76:6f (logged in on: vtic, 0b)
n3601*> vol create <—– view syntax
n3601*> vol create bcdvb10_web10_dev_home -s none aggr0 550g
Creation of volume ‘bcdvb10_web10_dev_home’ with size 550g on containing aggregate
‘aggr0’ has completed.

n3601*> vol status bcdvb10_web10_dev_home
Volume State      Status            Options
bcdvb10_web10_dev_home online     raid_dp, flex     guarantee=none
Containing aggregate: ‘aggr0’

n3601*> vol size bcdvb10_web10_dev_home
vol size: Flexible volume ‘bcdvb10_web10_dev_home’ has size 550g.

n3601*> snap reserve bcdvb10_web10_dev_home 0
n3601*> snap sched bcdvb10_web10_dev_home 0 0 0
n3601*> vol options bcdvb10_web10_dev_home nosnap on
n3601*> lun create -s 500g -t linux /vol/bcdvb10_web10_dev_home/bcdvb10_web10_dev_home
Thu Mar 12 08:45:36 EST [n3601: lun.vdisk.spaceReservationNotHonored:notice]: Space reservations in bcdvb10_web10_dev_home are not being honored, eithe  r because the volume space guarantee is set to ‘none’ or the guarantee is currently disabled due to lack of space in the aggregate.
lun create: created a LUN of size:  500.1g (536952700928)

n3601*> lun show
/vol/bcdvb10_web10_dev_boot/bcdvb10_web10_dev_boot   34.0g (36509319168)   (r/w, online, mapped)
/vol/bcdvb10_web10_dev_home/bcdvb10_web10_dev_home  500.1g (536952700928)  (r/w, online) <—– online but not mapped yet

n3601*> lun map /vol/bcdvb10_web10_dev_home/bcdvb10_web10_dev_home bcdvb10_web10_dev 1
Thu Mar 12 08:46:35 EST [n3601: lun.map:info]: LUN /vol/bcdvb10_web10_dev_home/bcdvb10_web10_dev_home was mapped to initiator group bcdvb10_web10_dev=1

On the host:
[gconklin@web10.dev ~]$ df -h
/dev/mapper/vg_root-lv_home
2.0G   37M  1.9G   2% /home <—– original size that we are going to extend

[gconklin@web10.dev ~]$ cat /proc/partitions
[gconklin@web10.dev ~]$ cat /etc/multipath.conf

[gconklin@web10.dev ~]$ sudo /sbin/multipath -d -l
mpath0 (360a9800050334f384e4a4e6d45494938)
[size=34 GB][features=”1 queue_if_no_path”][hwhandler=”0″]
\_ round-robin 0 [active]
\_ 2:0:1:0 sdc 8:32  [active]
\_ 3:0:0:0 sde 8:64  [active]
\_ round-robin 0 [enabled]
\_ 2:0:0:0 sda 8:0   [active]
\_ 3:0:1:0 sdg 8:96  [active]

[gconklin@web10.dev ~]$ ls /etc/rc3.d |grep 12
K12dc_client
S12crmultipathboot
S12syslog

[gconklin@web10.dev ~]$ sudo /sbin/reboot && exit
[gconklin@web10.dev ~]$ df -h
[gconklin@web10.dev ~]$ ls /etc/rc3.d |grep 12
[gconklin@web10.dev ~]$ cat /etc/multipath.conf

[gconklin@web10.dev ~]$ sudo /sbin/multipath -d -l
mpath1 (360a9800050334f384e4a4f446b6d7643)
[size=500 GB][features=”1 queue_if_no_path”][hwhandler=”0″]
\_ round-robin 0 [enabled]
\_ 2:0:1:1 sdd 8:48  [active]
\_ 3:0:0:1 sdf 8:80  [active]
\_ round-robin 0 [enabled]
\_ 2:0:0:1 sdb 8:16  [active]
\_ 3:0:1:1 sdh 8:112 [active]

mpath0 (360a9800050334f384e4a4e6d45494938)
[size=34 GB][features=”1 queue_if_no_path”][hwhandler=”0″]
\_ round-robin 0 [active]
\_ 2:0:1:0 sdc 8:32  [active]
\_ 3:0:0:0 sde 8:64  [active]
\_ round-robin 0 [enabled]
\_ 2:0:0:0 sda 8:0   [active]
\_ 3:0:1:0 sdg 8:96  [active]

[gconklin@web10.dev ~]$ sudo /usr/sbin/pvcreate /dev/mapper/mpath1
Physical volume “/dev/mapper/mpath1” successfully created

[gconklin@web10.dev ~]$ sudo vgdisplay
— Volume group —
VG Name               vg_root
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  6
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                5
Open LV               5
Max PV                0
Cur PV                1
Act PV                1
VG Size               31.72 GB
PE Size               32.00 MB
Total PE              1015
Alloc PE / Size       1014 / 31.69 GB <——– original size
Free  PE / Size       1 / 32.00 MB
VG UUID               fUsOC3-61ph-MRlZ-rizM-sstE-cgim-DZDGGr

[gconklin@web10.dev ~]$ sudo vgextend vg_root /dev/mapper/mpath1
Volume group “vg_root” successfully extended

[gconklin@web10.dev ~]$ sudo vgdisplay
— Volume group —
VG Name               vg_root
System ID
Format                lvm2
Metadata Areas        2
Metadata Sequence No  7
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                5
Open LV               5
Max PV                0
Cur PV                2
Act PV                2
VG Size               531.78 GB
PE Size               32.00 MB
Total PE              17017
Alloc PE / Size       1014 / 31.69 GB
Free  PE / Size       16003 / 500.09 GB <——– new size
VG UUID               fUsOC3-61ph-MRlZ-rizM-sstE-cgim-DZDGGr

[gconklin@web10.dev ~]$ df -h

[gconklin@web10.dev ~]$ sudo lvdisplay
— Logical volume —
LV Name                /dev/vg_root/lv_home
VG Name                vg_root
LV UUID                xLKc0z-S32F-utvw-AeQL-mjVx-pK1l-Gvv1Ga
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                2.00 GB <—– original size
Current LE             64
Segments               1
Allocation             inherit
Read ahead sectors     0
Block device           253:6

[gconklin@web10.dev ~]$ sudo lvextend -l +8000 /dev/vg_root/lv_home
Extending logical volume lv_home to 252.00 GB
Logical volume lv_home successfully resized

[gconklin@web10.dev ~]$ df -h

[gconklin@web10.dev ~]$ sudo lvdisplay
— Logical volume —
LV Name                /dev/vg_root/lv_home
VG Name                vg_root
LV UUID                xLKc0z-S32F-utvw-AeQL-mjVx-pK1l-Gvv1Ga
LV Write Access        read/write
LV Status              available
# open                 1
LV Size                252.00 GB <—– new size
Current LE             8064
Segments               3
Allocation             inherit
Read ahead sectors     0
Block device           253:6

[gconklin@web10.dev ~]$ sudo ext2online /dev/vg_root/lv_home
ext2online v1.1.18 – 2001/03/18 for EXT2FS 0.5b

[gconklin@web10.dev ~]$ sudo tune2fs -l /dev/vg_root/lv_home
[gconklin@web10.dev ~]$ df -h
/dev/mapper/vg_root-lv_home
249G   40M  236G   1% /home

[gconklin@web10.dev ~]$ sudo vgdisplay
— Volume group —
VG Name               vg_root
System ID
Format                lvm2
Metadata Areas        2
Metadata Sequence No  8
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                5
Open LV               5
Max PV                0
Cur PV                2
Act PV                2
VG Size               531.78 GB
PE Size               32.00 MB
Total PE              17017
Alloc PE / Size       9014 / 281.69 GB
Free  PE / Size       8003 / 250.09 GB <—– remaining disk space
VG UUID               fUsOC3-61ph-MRlZ-rizM-sstE-cgim-DZDGGr

Phewww…. Got all that???

, , , , , , , , , , , , , ,

Leave a comment