Jephe Wu - http://linuxtechres.blogspot.com.au
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 such as /dev/sda1
Steps:
1. add a new LUN disk in EVA storage and present it properly to the server
2. use commands below to rescan scsi hosts
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host2/scan
you can find out how many scsi disks you have by running "ls /sys/class/scsi_host", or just run above commands for all hosts under /sys/class/scsi_host
2.1 if you increased the existing LUN disk size, please refer to http://serverfault.com/questions/66638/how-to-extend-a-san-based-vdisk-in-red-hat-without-rebooting as follows:
or refer to http://www.datadisk.co.uk/html_docs/redhat/rh_multipathing.htm Resize online multpath LUN part and Multipathing and DR part
resize SAN disk / physical device first.
# rescan disk size
multipath -ll # list all disks, for all disk, run
echo 1 > /sys/block/sdX/device/rescan
#run for all sdX under /sys/block
[#optional, then you can test multipath failover by running]
multipathd -k
del path sdx
add path sdx
# resize mapname
note: refer to 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 page 21 - Resizing an Online Multipath Device
multipathd -k
resize map multipath-map-name # this might be optional too, according to
http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?lang=en&cc=us&taskId=120&prodSeriesId=3559651&prodTypeId=18964&objectID=c02000699
multipath # run this command to make multipath pickup the new size according to above hp bizsupport
use multipath -ll to verify the new size, then
pvresize,lvextend and resize2fs to expand the disk to new size.
References:
1. Moving root File Systems from a Single Path Device to a Multipath Device - 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 page 32.
2. Moving swap File Systems from a Single Path Device to a Multipath Device
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 page 34
3. verify wwid for new lun disk ndb01-b - optonal
[root@db01 sys]# multipath -ll
mpatha (3600508b1001030363946364434300999) dm-0 HP,LOGICAL VOLUME
size=137G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
`- 2:0:0:0 sda 8:0 active ready running
ndb01 (3600143800648a76c0000b00037b10777) dm-5 HP,HSV300
size=200G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 1:0:0:2 sdc 8:32 active ready running
|- 1:0:1:2 sdf 8:80 active ready running
|- 0:0:0:2 sdi 8:128 active ready running
`- 0:0:1:2 sdl 8:176 active ready running
ndb01-b (3600143800648a76c0000b001566f0888) dm-11 HP,HSV300
size=200G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 0:0:0:4 sdn 8:208 active ready running
|- 0:0:1:4 sdq 65:0 active ready running
|- 1:0:0:4 sdt 65:48 active ready running
`- 1:0:1:4 sdw 65:96 active ready running\
you can get a lun disk wwid by running:
/lib/udev/scsi_id --page=0x83 --whitelisted --device=/dev/sdw
3600143800648a76c0000b001566f0888
verify fiber channel adapter port wwn matches between server and storage
[root@db01 zabbix]# more /sys/class/fc_host/host0/node_name
0x20000000c9928eb1
[root@db01 zabbix]# more /sys/class/fc_host/host1/node_name
0x20000000c9928eb2
then check EVA storage Hosts - port tab part to confirm
4. modify /etc/multipath.conf to add new wwid for new LUN disk
vi /etc/multipath.conf
multipaths {
multipath {
wwid 3600143800648a76c0000b00037b50005
alias db01
}
multipath {
wwid 3600143800648a76c0000b001566f0888
alias db01-b
}
}
fdisk -l | grep sd # check the last disk detected by os
ls /dev/mapper -l # check the existing lun disks
chkconfig multipathd on
/etc/init.d/multipathd start # make sur start it
/etc/init.d/multipathd reload
go to /dev/mapper to run ls -l to verify newly add LUN disks
fdisk -l | grep sd #confirm new disks have been detected.
5. resize pv and file system
pvcreate /dev/mapper/ndb01-b
or
pvresize /dev/mapper/ndb01 # if you increase the existing lun disk
vgextend VgGroup1 /dev/mapper/ndb01-b
lvextend -L +150G /dev/VolGroup01/ndb01-mysql1
resize2fs /dev/VolGroup01/ndb01-mysql1
df -h
6. what if it's a single lun disk in OS - /dev/sda
lun admin to resize disk
echo "- - -" > /sys/block/sda/device/rescan
fdisk /dev/sda #remove then readd a partition that is the new disk size
partprobe # to update /proc/partitions
pvdisplay
pvresize /dev/sda1 or pvresize /dev/sda # grow pv
vgdisplay
lvextend
e2fsck -fy /dev/VolGroup1/LogVol1 # optional
resize2fs /dev/VolGroup1/LogVol1
or, instead of growing pv, you can use the new added partiton size to create another pv
fdisk /dev/sda # to add a new partition, not to delete/create
partprobe
pvcreate /dev/sda2
vgextend, lvextend, resize2fs etc
7. References:
a. Vmware Linux Guest Add a New Hard Disk Without Rebooting Guest - http://www.cyberciti.biz/tips/vmware-add-a-new-hard-disk-without-rebooting-guest.html
b. Multi-path Device Mapper for Linux Software - How to Resize an EVA LUN on RedHat 4.8 and Later -
http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?lang=en&cc=us&taskId=120&prodSeriesId=3559651&prodTypeId=18964&objectID=c02000699
c. HP business support center - http://www.hp.com/bizsupport/
d. search redhat customer portal for article - How to extend filesystem built on LVM SAN disks on RHEL5
e. HP EVA storage default port 2372 with https
How to add LUN disk online under CentOS 6.2
Posted by
Jephe Wu
at
5/03/2012 09:28:00 AM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment