RAID10 在线扩容

背景

DB Server磁盘空间达到90%


环境
DELL R710+CentOS5.5+RAID10+LVM

R710六个磁盘接口,四个做了RAID10,正好还空两个。与其说RAID10扩容,还不如说是LVM扩容。利用两个空磁盘接口做RAID1,最终将RAID1的磁盘容量加入LVM,实现对分区扩容。


1.Installation of the MegaCLI RPM

[root@RAID ~]# mkdir -p /data/software/megacli
[root@RAID ~]# cd /data/software/megacli
[root@RAID megacli]# wget http://www.lsi.com/downloads/Public/Nytro/downloads/Nytro%20XM/Management%20Software%20and%20Tools/NMR%201.5/CSA1.5-MegaCli_REL80571.zip
[root@RAID megacli]# unzip CSA1.5-MegaCli_REL80571.zip
[root@RAID megacli]# cd MegaCLI/MegaCli_Linux/
[root@RAID MegaCli_Linux]# rpm -Uvh MegaCli-8.05.71-1.noarch.rpm
[root@RAID MegaCli_Linux]# alias MegaCli="/opt/MegaRAID/MegaCli/MegaCli64"

tips
click here to download the MegaCLI RPM


2.Display general information

[root@RAID MegaCli_Linux]# MegaCli -LDInfo -Lall -aALL | less    #Display virtual disk information
Adapter 0-- Virtual Drive Information:
Virtual Drive:0 (Target Id:0)
Name                :Virtual Disk 0
RAID Level          : Primary-1, Secondary-3, RAID Level Qualifier-0
Size                :557.75 GB
Sector Size         :512
Mirror Data         :557.75 GB
State               : Optimal
Strip Size          :64 KB
Number Of Drives per span:2
Span Depth          :2
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
Is VD Cached: No
Exit Code: 0x00
(END)


[root@RAID MegaCli_Linux]# MegaCli -PDList -aALL | less    #显示物理磁盘信息,查出新加入的两块硬盘的Device Id是4,5

Enclosure Device ID: 32
Slot Number: 3
Drive'

Slot Number: 3
Drive'
s postion: DiskGroup:0, Span:1, Arm:1
Enclosure position: N/A
Device Id:3
WWN:
Sequence Number:2
Media Error Count:0
Other Error Count:0
Predictive Failure Count:0
Last Predictive Failure Event Seq Number:0
PD Type: SAS

Raw Size:279.396 GB [0x22ecb25c Sectors]
Non Coerced Size:278.896 GB [0x22dcb25c Sectors]
Coerced Size:278.875 GB [0x22dc0000 Sectors]
Sector Size:0
Firmware state: Online, Spun Up
Device Firmware Level: ES64
Shield Counter:0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50039a6f7e5
SAS Address(1): 0x0
Connected Port Number:3(path0)
Inquiry Data: SEAGATE ST3300657SS     ES646SJ172R8          
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: Unknown
Link Speed: Unknown
Media Type: Hard Disk Device
Drive Temperature :39C (102.20 F)
PI Eligibility:  No
Drive is formatted for PI information:  No
PI: No PI
Port-0:
Port status: Active
Port's Linkspeed: Unknown
Port-1 :
Port status: Active
Port'
s Linkspeed: Unknown
Drive has flagged a S.M.A.R.T alert : No

Enclosure Device ID:32
Slot Number:4
Enclosure position: N/A
Device Id:4
WWN:
Sequence Number:1
Media Error Count:0
Other Error Count:0
Predictive Failure Count:0
Last Predictive Failure Event Seq Number:0
PD Type: SAS

Raw Size:279.396 GB [0x22ecb25c Sectors]
Non Coerced Size:278.896 GB [0x22dcb25c Sectors]
Coerced Size:278.875 GB [0x22dc0000 Sectors]
Sector Size:0
Firmware state: Unconfigured(good), Spun Up
Device Firmware Level: ES64
Shield Counter:0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50039a96379
SAS Address(1): 0x0
Connected Port Number:4(path0)
Inquiry Data: SEAGATE ST3300657SS     ES646SJ16SSN          
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: Foreign
Foreign Secure: Drive is not secured by a foreign lock key
Device Speed: Unknown
Link Speed: Unknown
Media Type: Hard Disk Device
Drive Temperature :37C (98.60 F)
PI Eligibility:  No
Drive is formatted for PI information:  No
PI: No PI
Port-0:
Port status: Active
Port's Linkspeed: Unknown
Port-1 :
Port status: Active
Port'
s Linkspeed: Unknown
Drive has flagged a S.M.A.R.T alert : No

Enclosure Device ID:32
Slot Number:5
Enclosure position: N/A
Device Id:5
WWN:
Sequence Number:1
Media Error Count:0
Other Error Count:0
Predictive Failure Count:0
Last Predictive Failure Event Seq Number:0
PD Type: SAS

Raw Size:279.396 GB [0x22ecb25c Sectors]
Non Coerced Size:278.896 GB [0x22dcb25c Sectors]
Coerced Size:278.875 GB [0x22dc0000 Sectors]
Sector Size:0
Firmware state: Unconfigured(good), Spun Up
Device Firmware Level: ES64
Shield Counter:0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c50039a737a1
SAS Address(1): 0x0
Connected Port Number:5(path0)
Inquiry Data: SEAGATE ST3300657SS     ES646SJ17DZS          
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: Foreign
Foreign Secure: Drive is not secured by a foreign lock key
Device Speed: Unknown
Link Speed: Unknown
Media Type: Hard Disk Device
Drive Temperature :36C (96.80 F)
PI Eligibility:  No
Drive is formatted for PI information:  No
PI: No PI
Port-0:
Port status: Active
Port's Linkspeed: Unknown
Port-1 :
Port status: Active
Port'
s Linkspeed: Unknown
Drive has flagged a S.M.A.R.T alert : No

Exit Code: 0x00


3.Generate a controller log

[root@RAID megacli]# MegaCli -AdpEventLog -GetEvents -f controller_log.txt -aALL


4.Create a virtual disk

[root@RAID megacli]# MegaCli -CfgLdAdd -r1 [32:4, 32:5] -a0   #Create a RAID 1 using disks 4 and 5 on adapter 0 on enclosure 32
Adapter 0: Created VD 1
Adapter 0: Configured the Adapter!!
Exit Code: 0x00

[root@RAID megacli]# MegaCli -LDBI -ProgDsply -LALL -aALL   #查看raid1的building进度
[root@RAID ~]# MegaCli -LDInfo -Lall -aALL | less
Adapter 0-- Virtual Drive Information:
Virtual Drive:0 (Target Id:0)
Name                :Virtual Disk 0
RAID Level          : Primary-1, Secondary-3, RAID Level Qualifier-0
Size                :557.75 GB
Sector Size         :512
Mirror Data         :557.75 GB
State               : Optimal
Strip Size          :64 KB
Number Of Drives per span:2
Span Depth          :2
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk's Default
Encryption Type     : None
Is VD Cached: No

Virtual Drive: 1 (Target Id: 1)
Name                :
RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0
Size                : 278.875 GB
Sector Size         : 512
Mirror Data         : 278.875 GB
State               : Optimal
Strip Size          : 64 KB
Number Of Drives    : 2
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAheadNone, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Disk'
s Default
Encryption Type     : None
Is VD Cached: No

Exit Code: 0x00


[root@RAID ~]# fdisk -l
Disk /dev/sda:598.8 GB, 598879502336 bytes
255 heads, 63 sectors/track, 72809 cylinders
Units = cylinders of 16065*512=8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *11310439183  Linux
/dev/sda2              14728095847338708e  Linux LVM

Disk /dev/sdb:299.4 GB, 299439751168 bytes
255 heads, 63 sectors/track, 36404 cylinders
Units = cylinders of 16065*512=8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
tips
The specified physical disk does not have the appropriate attributes to complete
the requested command.
Exit Code: 0x26
[root@RAID megacli]# MegaCli -cfgforeign -scan -a0   #扫描外来配置的个数
There are 1 foreign configuration(s) on controller 0.
Exit Code: 0x00

[root@RAID megacli]
# MegaCli -cfgforeign -clear -a0   #清除外来配置
Foreign configuration 0 is cleared on controller 0.
Exit Code: 0x00

[root@RAID megacli]
# MegaCli -cfgforeign -scan -a0   #再次扫描外来配置的个数
There is no foreign configuration on controller 0.
Exit Code: 0x00


5.Create a LVM partition

[root@RAID ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 36404.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
  (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-36404, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-36404, default 36404):
Using default value 36404

Command (m for help): t          
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 299.4 GB, 299439751168 bytes
255 heads, 63 sectors/track, 36404 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       36404   292415098+  8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


6.Create a PV

[root@RAID ~]# partprobe   #使分区表生效
[root@RAID ~]# fdisk -l

Disk /dev/sda:598.8 GB, 598879502336 bytes
255 heads, 63 sectors/track, 72809 cylinders
Units = cylinders of 16065*512=8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *11310439183  Linux
/dev/sda2              14728095847338708e  Linux LVM

Disk /dev/sdb:299.4 GB, 299439751168 bytes
255 heads, 63 sectors/track, 36404 cylinders
Units = cylinders of 16065*512=8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               136404292415098+8e  Linux LVM

[root@RAID ~]# mkfs -t ext3 -c /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
36552704 inodes, 73103774 blocks
3655188 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2231 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616

Checking for bad blocks (read-only test):done
Writing inode tables:done
Creating journal (32768 blocks):done
Writing superblocks and filesystem accounting information:done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or-i to override.

[root@RAID ~]# pvcreate /dev/sdb1   #创建PV
 Physical volume "/dev/sdb1" successfully created


7.Extend the VG

[root@RAID ~]# vgdisplay   #查看已有的VG
--- Volume group ---
 VG Name               VolGroup00
 System ID            
 Format                lvm2
 Metadata Areas        1
 Metadata Sequence No  4
 VG Access             read/write
 VG Status             resizable
 MAX LV                0
 Cur LV                3
 Open LV               3
 Max PV                0
 Cur PV                1
 Act PV                1
 VG Size               557.62 GB
 PE Size               32.00 MB
 Total PE              17844
 Alloc PE / Size       17844/557.62 GB
 Free  PE / Size       0/0
 VG UUID               j15KCJ-qR8I-tRwi-diTK-QM6s-AGaq-1CzeYg

[root@RAID ~]# vgextend VolGroup00 /dev/sdb1    #扩容VG,将/dev/sdb1加入VG
 Volume group "VolGroup00" successfully extended
[root@RAID ~]# vgdisplay    #查看VG Size
--- Volume group ---
 VG Name               VolGroup00
 System ID            
 Format                lvm2
 Metadata Areas        2
 Metadata Sequence No  5
 VG Access             read/write
 VG Status             resizable
 MAX LV                0
 Cur LV                3
 Open LV               3
 Max PV                0
 Cur PV                2
 Act PV                2
 VG Size               836.47 GB
 PE Size               32.00 MB
 Total PE              26767
 Alloc PE / Size       17844/557.62 GB
 Free  PE / Size       8923/278.84 GB
 VG UUID               j15KCJ-qR8I-tRwi-diTK-QM6s-AGaq-1CzeYg


8.Extend the LV

[root@RAID ~]# df -hv
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
9.7G1.4G7.9G15%/
/dev/mapper/VolGroup00-LogVol02
529G257M502G1%/data
/dev/sda1              99M13M82M14%/boot
tmpfs                 5.9G05.9G0%/dev/shm

[root@RAID ~]# lvextend -L +278.84G /dev/mapper/VolGroup00-LogVol02   #对/data扩容
 Rounding up size to full physical extent 278.84 GB
 Extending logical volume LogVol02 to 824.47 GB
 Logical volume LogVol02 successfully resized

[root@RAID ~]# resize2fs -f /dev/mapper/VolGroup00-LogVol02    #resize
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/VolGroup00-LogVol02 is mounted on /data; on-line resizing required
Performing an on-line resize of /dev/mapper/VolGroup00-LogVol02 to 216129536 (4k) blocks.

The filesystem on /dev/mapper/VolGroup00-LogVol02 is now 216129536 blocks long.

[root@RAID ~]# df -hv
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
9.7G1.4G7.9G15%/
/dev/mapper/VolGroup00-LogVol02
799G259M758G1%/data
/dev/sda1              99M13M82M14%/boot
tmpfs                 5.9G05.9G0%/dev/shm


reference

How to use the MegaCLI Utility with your RAID Controller on your PowerEdge Server in Linux
URL:http://www.dell.com/support/troubleshooting/cn/zh/cnbsd1/KCS/KcsArticles/ArticleView?c=cn&l=zh&s=gen&docid=623352


你可能感兴趣的:(dell,lvm,raid10,在线扩容,RAID10扩容)