{"id":1313,"date":"2012-09-05T15:39:15","date_gmt":"2012-09-05T07:39:15","guid":{"rendered":"http:\/\/rmohan.com\/?p=1313"},"modified":"2012-09-05T15:40:04","modified_gmt":"2012-09-05T07:40:04","slug":"how-to-add-lun-disk-online-under-centos-6-2","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=1313","title":{"rendered":"How to add LUN disk online under CentOS 6.2"},"content":{"rendered":"<p><strong>Environment:<\/strong> CentOS 6.2 64bit with multipath connected to HP EVA storage, the LUN disk was LVM disk<br \/> <strong>Objective<\/strong>: add a new LUN disk for server online and add into the existing LVM to make the partition size bigger<br \/> <strong>scenario<\/strong>: LVM add new lun disk, increase the existing lvm lun disk, increase the existing partition disk such as \/dev\/sda1<\/p>\n<p><strong>Steps:<\/strong><br \/> <strong><br \/><\/strong><br \/> <strong>1. add a new LUN disk in EVA storage and present it properly to the server<\/strong><br \/> <strong>2. use commands below to rescan scsi hosts<\/strong><\/p>\n<p><em>\u00a0echo &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/host0\/scan \u00a0\u00a0<\/em><br \/> <em>\u00a0echo &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/host1\/scan\u00a0<\/em><br \/> <em>\u00a0echo &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/host2\/scan\u00a0<\/em><\/p>\n<p>you can find out how many scsi disks you have by running &#8220;ls \/sys\/class\/scsi_host&#8221;, or just run above commands\u00a0for all hosts under \/sys\/class\/scsi_host<\/p>\n<p>2.1 if you increased the existing LUN disk size, please refer to <a href=\"http:\/\/serverfault.com\/questions\/66638\/how-to-extend-a-san-based-vdisk-in-red-hat-without-rebooting\">http:\/\/serverfault.com\/questions\/66638\/how-to-extend-a-san-based-vdisk-in-red-hat-without-rebooting<\/a> as follows:<br \/> or refer to\u00a0<a href=\"http:\/\/www.datadisk.co.uk\/html_docs\/redhat\/rh_multipathing.htm\">http:\/\/www.datadisk.co.uk\/html_docs\/redhat\/rh_multipathing.htm<\/a>\u00a0\u00a0<strong>Resize online multpath LUN part \u00a0and\u00a0<\/strong><strong>Multipathing and DR part<\/strong><br \/> <strong><br \/><\/strong><br \/> resize SAN disk \/ physical device first.<\/p>\n<p># rescan disk size<br \/> <em><strong>multipath -ll<\/strong><\/em> # list all disks, for all disk, run<br \/> <strong><em>echo 1 &gt; \/sys\/block\/sdX\/device\/rescan<\/em><\/strong><br \/> #run for all sdX under \/sys\/block<\/p>\n<p>[#optional, then you can test multipath failover by running]<br \/> <em>multipathd -k<\/em><br \/> <em>del path sdx\u00a0<\/em><br \/> <em>add path sdx<\/em><br \/> <strong><em><br \/><\/em><\/strong><br \/> <strong>#<\/strong> resize mapname<br \/> <strong><em>note: refer to\u00a0<a href=\"http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/pdf\/DM_Multipath\/Red_Hat_Enterprise_Linux-6-DM_Multipath-en-US.pdf\">http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/pdf\/DM_Multipath\/Red_Hat_Enterprise_Linux-6-DM_Multipath-en-US.pdf<\/a>\u00a0page 21 &#8211;\u00a0<\/em><\/strong><strong><em>Resizing an Online Multipath Device<\/em><\/strong><br \/> <strong><em>multipathd -k<\/em><\/strong><br \/> <em><strong>resize map multipath-map-name<\/strong><\/em> # this might be optional too, according to<br \/> <a href=\"http:\/\/h20000.www2.hp.com\/bizsupport\/TechSupport\/Document.jsp?lang=en&amp;cc=us&amp;taskId=120&amp;prodSeriesId=3559651&amp;prodTypeId=18964&amp;objectID=c02000699\">http:\/\/h20000.www2.hp.com\/bizsupport\/TechSupport\/Document.jsp?lang=en&amp;cc=us&amp;taskId=120&amp;prodSeriesId=3559651&amp;prodTypeId=18964&amp;objectID=c02000699<\/a><\/p>\n<p><strong><em>multipath<\/em><\/strong> # run this command to make multipath pickup the new size according to above hp bizsupport<\/p>\n<p>use <strong><em>multipath -ll<\/em><\/strong> to verify the new size, then<br \/> pvresize,lvextend and resize2fs to expand the disk to new size.<\/p>\n<p>References:<br \/> 1.\u00a0Moving root File Systems from a Single Path Device to\u00a0a Multipath Device &#8211;\u00a0<a href=\"http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/pdf\/DM_Multipath\/Red_Hat_Enterprise_Linux-6-DM_Multipath-en-US.pdf\">http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/pdf\/DM_Multipath\/Red_Hat_Enterprise_Linux-6-DM_Multipath-en-US.pdf<\/a>\u00a0page 32.<br \/> 2.\u00a0Moving swap File Systems from a Single Path Device\u00a0to a Multipath Device<br \/> <a href=\"http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/pdf\/DM_Multipath\/Red_Hat_Enterprise_Linux-6-DM_Multipath-en-US.pdf\">http:\/\/docs.redhat.com\/docs\/en-US\/Red_Hat_Enterprise_Linux\/6\/pdf\/DM_Multipath\/Red_Hat_Enterprise_Linux-6-DM_Multipath-en-US.pdf<\/a>\u00a0page 34<\/p>\n<p><strong>3. verify wwid for new lun disk ndb01-b \u00a0&#8211; optonal<\/strong><br \/> <em>[root@db01 sys]# multipath -ll<\/em><br \/> <em>mpatha (3600508b1001030363946364434300999) dm-0 HP,LOGICAL VOLUME<\/em><br \/> <em>size=137G features=&#8217;1 queue_if_no_path&#8217; hwhandler=&#8217;0&#8242; wp=rw<\/em><br \/> <em>`-+- policy=&#8217;round-robin 0&#8242; prio=1 status=active<\/em><br \/> <em>\u00a0 `- 2:0:0:0 sda 8:0 \u00a0 \u00a0active ready running<\/em><br \/> <em>ndb01 (3600143800648a76c0000b00037b10777) dm-5 HP,HSV300<\/em><br \/> <em>size=200G features=&#8217;1 queue_if_no_path&#8217; hwhandler=&#8217;0&#8242; wp=rw<\/em><br \/> <em>`-+- policy=&#8217;round-robin 0&#8242; prio=1 status=active<\/em><br \/> <em>\u00a0 |- 1:0:0:2 sdc 8:32 \u00a0 active ready running<\/em><br \/> <em>\u00a0 |- 1:0:1:2 sdf 8:80 \u00a0 active ready running<\/em><br \/> <em>\u00a0 |- 0:0:0:2 sdi 8:128 \u00a0active ready running<\/em><br \/> <em>\u00a0 `- 0:0:1:2 sdl 8:176 \u00a0active ready running<\/em><br \/> <em>ndb01-b (3600143800648a76c0000b001566f0888) dm-11 HP,HSV300<\/em><br \/> <em>size=200G features=&#8217;1 queue_if_no_path&#8217; hwhandler=&#8217;0&#8242; wp=rw<\/em><br \/> <em>`-+- policy=&#8217;round-robin 0&#8242; prio=1 status=active<\/em><br \/> <em>\u00a0 |- 0:0:0:4 sdn 8:208 \u00a0active ready running<\/em><br \/> <em>\u00a0 |- 0:0:1:4 sdq 65:0 \u00a0 active ready running<\/em><br \/> <em>\u00a0 |- 1:0:0:4 sdt 65:48 \u00a0active ready running<\/em><br \/> <em>\u00a0 `- 1:0:1:4 sdw 65:96 \u00a0active ready running\\<\/em><\/p>\n<p>you can get a lun disk wwid by running:<br \/> <strong><em>\/lib\/udev\/scsi_id &#8211;page=0x83 &#8211;whitelisted &#8211;device=\/dev\/sdw<\/em><\/strong><br \/> 3600143800648a76c0000b001566f0888<\/p>\n<p><strong><em>verify fiber channel adapter port wwn matches between server and storage\u00a0<\/em><\/strong><\/p>\n<p><em>[root@db01 zabbix]# more \/sys\/class\/fc_host\/host0\/node_name\u00a0<\/em><br \/> <em>0x20000000c9928eb1<\/em><br \/> <em>[root@db01 zabbix]# more \/sys\/class\/fc_host\/host1\/node_name\u00a0<\/em><br \/> <em>0x20000000c9928eb2<\/em><\/p>\n<p>then check EVA storage Hosts &#8211; port tab part to confirm<\/p>\n<p><strong><br \/><\/strong><br \/> <strong>4. modify \/etc\/multipath.conf to add new wwid for new LUN disk<\/strong><br \/> <strong><em>vi \/etc\/multipath.conf<\/em><\/strong><br \/> <em>multipaths {<\/em><br \/> <em>\u00a0 \u00a0 \u00a0 \u00a0 multipath {<\/em><br \/> <em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 wwid 3600143800648a76c0000b00037b50005<\/em><br \/> <em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 alias db01<\/em><br \/> <em>\u00a0 \u00a0 \u00a0 \u00a0 }<\/em><br \/> <em>\u00a0 \u00a0 \u00a0 \u00a0 multipath {<\/em><br \/> <em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 wwid 3600143800648a76c0000b001566f0888<\/em><br \/> <em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 alias db01-b<\/em><br \/> <em>\u00a0 \u00a0 \u00a0 \u00a0 }<\/em><br \/> <em>}<\/em><\/p>\n<p><strong><em>fdisk -l | grep sd<\/em><\/strong> # check the last disk detected by os<br \/> <strong><em>ls \/dev\/mapper -l<\/em><\/strong> # check the existing lun disks<br \/> <strong><em>chkconfig multipathd on<\/em><\/strong><br \/> <strong><em>\/etc\/init.d\/multipathd start<\/em><\/strong> # make sur start it<br \/> <strong><em>\/etc\/init.d\/multipathd reload<\/em><\/strong><br \/> go to \/dev\/mapper to run<strong><em> ls -l<\/em><\/strong> to verify newly add LUN disks<br \/> <strong><em>fdisk -l | grep sd<\/em><\/strong> #confirm new disks have been detected.<\/p>\n<p><strong>5. resize pv and file system<\/strong><br \/> <strong><em>pvcreate \/dev\/mapper\/ndb01-b<\/em><\/strong><br \/> or<br \/> <strong><em>pvresize \/dev\/mapper\/ndb01<\/em><\/strong> # if you increase the existing lun disk<\/p>\n<p><strong><em>vgextend VgGroup1 \/dev\/mapper\/ndb01-b<\/em><\/strong><br \/> <strong><em>lvextend -L +150G \/dev\/VolGroup01\/ndb01-mysql1<\/em><\/strong><br \/> <strong><em>resize2fs \/dev\/VolGroup01\/ndb01-mysql1<\/em><\/strong><br \/> <strong><em>df -h<\/em><\/strong><\/p>\n<p><strong>6. what if it&#8217;s a single lun disk in OS &#8211; \/dev\/sda<\/strong><br \/> lun admin to resize disk<br \/> <strong><em>echo &#8220;- &#8211; -&#8221; &gt; \/sys\/block\/sda\/device\/rescan<\/em><\/strong><br \/> <strong><em>fdisk \/dev\/sda<\/em><\/strong> #remove then readd a partition that is the new disk size<br \/> <strong><em>partprob<\/em><\/strong>e # to update \/proc\/partitions<br \/> <strong><em>pvdisplay<\/em><\/strong><br \/> <strong><em>pvresize \/dev\/sda1<\/em><\/strong> or <strong><em>pvresize \/dev\/sda<\/em><\/strong> # grow pv<br \/> <strong><em>vgdisplay<\/em><\/strong><br \/> <strong><em>lvextend<\/em><\/strong><br \/> <em>e2fsck -fy \/dev\/VolGroup1\/LogVol1<\/em> # optional<br \/> <strong><em>resize2fs \/dev\/VolGroup1\/LogVol1<\/em><\/strong><\/p>\n<p>or, instead of growing pv, you can use the new added partiton size to create another pv<br \/> <strong><em>fdisk \/dev\/sda<\/em><\/strong> # to add a new partition, not to delete\/create<br \/> <strong><em>partprobe<\/em><\/strong><br \/> <strong><em>pvcreate \/dev\/sda2<\/em><\/strong><br \/> vgextend, lvextend, resize2fs etc<br \/> <strong><br \/><\/strong><br \/> <strong>7. References:<\/strong><br \/> a. Vmware Linux Guest Add a New Hard Disk Without Rebooting Guest &#8211; <a href=\"http:\/\/www.cyberciti.biz\/tips\/vmware-add-a-new-hard-disk-without-rebooting-guest.html\">http:\/\/www.cyberciti.biz\/tips\/vmware-add-a-new-hard-disk-without-rebooting-guest.html<\/a><\/p>\n<p>b. Multi-path Device Mapper for Linux Software &#8211; How to Resize an EVA LUN on RedHat 4.8 and Later &#8211;<br \/> <a href=\"http:\/\/h20000.www2.hp.com\/bizsupport\/TechSupport\/Document.jsp?lang=en&amp;cc=us&amp;taskId=120&amp;prodSeriesId=3559651&amp;prodTypeId=18964&amp;objectID=c02000699\">http:\/\/h20000.www2.hp.com\/bizsupport\/TechSupport\/Document.jsp?lang=en&amp;cc=us&amp;taskId=120&amp;prodSeriesId=3559651&amp;prodTypeId=18964&amp;objectID=c02000699<\/a><\/p>\n<p>c. HP business support center &#8211; <a href=\"http:\/\/www.hp.com\/bizsupport\/\">http:\/\/www.hp.com\/bizsupport\/<\/a><br \/> d. search redhat customer portal for article &#8211; <em>How to extend filesystem built on LVM SAN disks on RHEL5<\/em><br \/> <em>e. HP EVA storage default port 2372 with https<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Environment: CentOS 6.2 64bit with multipath connected to HP EVA storage, the LUN disk was LVM disk Objective: add a new LUN disk for server online and add into the existing LVM to make the partition size bigger scenario: LVM add new lun disk, increase the existing lvm lun disk, increase the existing partition disk [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1313"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1313"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1313\/revisions"}],"predecessor-version":[{"id":1316,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1313\/revisions\/1316"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}