使用Megacli64对服务器物理磁盘做Raid并通过uuid方式挂载
需求说明:公司最近来了一批服务器,用于大数据业务部署。数据节点服务器由14块物理磁盘,其中有2块是900G的盘,12块是4T的盘。在服务器系统安装时,进入系统的BIOS界面:1)将2块900G的磁盘做成raid1用作系统盘(顺便说一下:raid0最少需要1块磁盘;raid1最少需要2块磁盘;raid10最少需要4块磁盘,raid5至少需要3块磁盘);2)将其中的2块4T的磁盘做成raid1,分别挂载到/data1和/data2用作大数据日志存储;3)另外的10块4T的磁盘在系统安装时没做raid也没做分区,打算在系统安装后,登录到系统终端通过命令行进行直接进行10块盘的格式化,并分别挂载到/data3、/data4、/data5、/data6、/data7、/data8、/data9、/data10、/data11、/data12,用作大数据业务的数据盘,文件格式为ext4,采用uuid方式挂载,挂载属性为noatime,nobarrier。
待服务器系统安装后,登录机器,使用"fdisk -l"命令,发现除了看到4块做raid的盘,其余的10块物理磁盘看不到(硬盘默认采用的是raid模式,如果不做raid阵列的话,就是别不了。可以在BIOS界面里修改硬盘模式为IDE模式或AHCI模式):
[root@data-node01 ~]# fdisk -l Disk /dev/sdb: 2001.1 GB, 2001111154688 bytes
255 heads, 63 sectors/track, 243287 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004a319 Device Boot Start End Blocks Id System
/dev/sdb1 1 243288 1954208768 83 Linux Disk /dev/sdd: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdf: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sde: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdh: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sda: 899.5 GB, 899527213056 bytes
255 heads, 63 sectors/track, 109361 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00026ac4 Device Boot Start End Blocks Id System
/dev/sda1 * 1 52 409600 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 52 4229 33554432 82 Linux swap / Solaris
/dev/sda3 4229 109362 844479488 83 Linux Disk /dev/sdc: 1999.1 GB, 1999114010624 bytes
255 heads, 63 sectors/track, 243045 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006d390 Device Boot Start End Blocks Id System
/dev/sdc1 1 243046 1952258048 83 Linux
这时候,需要用到一款管理维护硬件RAID软件-MegaCli,可以通过它来了解当前raid卡的所有信息,包括 raid卡的型号,raid的阵列类型,raid 上各磁盘状态,等等。操作记录如下:
1)下载及安装MegaCLI工具
下载地址:https://pan.baidu.com/s/1TAGHjTA19ZR8MGODaqy7Mg
提取密码:msbq 下载到/usr/loca/src目录下
[root@data-node01 ~]# cd /usr/local/src/
[root@data-node01 src]# ls
ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip
[root@data-node01 src]# unzip ibm_utl_sraidmr_megacli-8.00.48_linux_32-64.zip
[root@data-node01 src]# cd linux/
[root@data-node01 linux]# ls
Lib_Utils-1.00-09.noarch.rpm MegaCli-8.00.48-1.i386.rpm
[root@data-node01 linux]# rpm -ivh Lib_Utils-1.00-09.noarch.rpm MegaCli-8.00.48-1.i386.rpm 说明:安装完毕之后MegaCli64所在路径为/opt/MegaRAID/MegaCli/MegaCli64,在此路径下可以运行MegaCli64工具,切换到其它路径下则不能执行,
此时为了使用方便,可以考虑将/opt/MegaRAID/MegaCli/MegaCli64追加到系统PATH变量,或者像下面这样做(建议):
[root@data-node01 linux]# ln -s /opt/MegaRAID/MegaCli/MegaCli64 /bin/MegaCli64
[root@data-node01 linux]# ln -s /opt/MegaRAID/MegaCli/MegaCli64 /sbin/MegaCli64 2)使用MegaCli64命令进行相关操作
先查看磁盘数量。如下可以看出,一共有14块物理磁盘
[root@data-node01 linux]# MegaCli64 -PDList -aALL | egrep 'Enclosure Device ID|Slot Number'
Enclosure Device ID: 32
Slot Number: 0
Enclosure Device ID: 32
Slot Number: 1
Enclosure Device ID: 32
Slot Number: 2
Enclosure Device ID: 32
Slot Number: 3
Enclosure Device ID: 32
Slot Number: 4
Enclosure Device ID: 32
Slot Number: 5
Enclosure Device ID: 32
Slot Number: 6
Enclosure Device ID: 32
Slot Number: 7
Enclosure Device ID: 32
Slot Number: 8
Enclosure Device ID: 32
Slot Number: 9
Enclosure Device ID: 32
Slot Number: 10
Enclosure Device ID: 32
Slot Number: 11
Enclosure Device ID: 32
Slot Number: 12
Enclosure Device ID: 32
Slot Number: 13 接着查看磁盘信息
[root@data-node01 linux]# MegaCli64 -PDList -aALL
Adapter #0 Enclosure Device ID: 32
Slot Number: 0
Enclosure position: 0
Device Id: 0
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Non Coerced Size: 3.637 TB [0x1d1b0beb0 Sectors]
Coerced Size: 3.637 TB [0x1d1b00000 Sectors]
Firmware state: Online, Spun Up
SAS Address(0): 0x500056b3983fbac0
Connected Port Number: 0(path0)
Inquiry Data: 4837K2DVF7DETOSHIBA MG04ACA400NY FK3D
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive Temperature :30C (86.00 F) ...........
...........
Enclosure Device ID: 32
Slot Number: 3
Enclosure position: 0
Device Id: 3
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Non Coerced Size: 3.637 TB [0x1d1b0beb0 Sectors]
Coerced Size: 3.637 TB [0x1d1b00000 Sectors]
Firmware state: unconfigured(good), Spun Up
SAS Address(0): 0x500056b3983fbac3
Connected Port Number: 0(path0)
Inquiry Data: 4838K1VCF7DETOSHIBA MG04ACA400NY FK3D
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive Temperature :30C (86.00 F)
...........
........... 如上命令结果信息中,注意查看"Firmware state"的状态:
如果该状态为Online,就说明该磁盘已被做成raid阵列,
如果该状态为unconfigured(good),就说明该磁盘没有被做成raid阵列,但状态OK。 由上面命令可知,前2块4T的磁盘做成了raid,其余10块4T的磁盘没有做raid,另2块900G的磁盘做成了raid。 -------------------------------------------------------------------------------------- 现在的做法是:
通过MegaCli工具将那10块4T的磁盘分别做成raid0,然后格式化成ext4,并使用uuid方式挂载。 依次对第3-12块盘做成raid0阵列,其中:
-r0表示做成raid0阵列,[32:2]中的32为Enclosure Device ID,5为Slot Number。
WB Direct:磁盘Write back
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:2] WB Direct -a0
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:3] WB Direct -a0
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:4] WB Direct -a0
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:5] WB Direct -a0
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:6] WB Direct -a0
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:7] WB Direct -a0
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:8] WB Direct -a0
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:9] WB Direct -a0
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:10] WB Direct -a0
[root@data-node01 linux]# MegaCli64 -CfgLdAdd -r0[32:11] WB Direct -a0 然后再次查看磁盘情况,发现"Firmware state"的状态都为Online,即所有磁盘都在raid阵列中了。
[root@data-node01 linux]# MegaCli64 -PDList -aALL 然后使用"fdisk -l"就能发现所有的物理磁盘了
[root@data-node01 linux]# fdisk -l Disk /dev/sdb: 1993.4 GB, 1993414541312 bytes
255 heads, 63 sectors/track, 242352 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cd8df Device Boot Start End Blocks Id System
/dev/sdb1 1 242353 1946692608 83 Linux Disk /dev/sda: 899.5 GB, 899527213056 bytes
255 heads, 63 sectors/track, 109361 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b231b Device Boot Start End Blocks Id System
/dev/sda1 * 1 52 409600 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 52 4229 33554432 82 Linux swap / Solaris
/dev/sda3 4229 109362 844479488 83 Linux Disk /dev/sdc: 2006.8 GB, 2006810624000 bytes
255 heads, 63 sectors/track, 243980 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000010e5 Device Boot Start End Blocks Id System
/dev/sdc1 1 243981 1959774208 83 Linux Disk /dev/sdd: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sde: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdf: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdg: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdh: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdi: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdj: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdk: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdl: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/sdm: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 --------------------------------------------------------------------------- 对这10块磁盘进行格式化,脚本如下:
[root@data-node01 ~]# cat disk.list
/dev/sdd
/dev/sde
/dev/sdf
/dev/sdg
/dev/sdh
/dev/sdi
/dev/sdj
/dev/sdk
/dev/sdl
/dev/sdm [root@data-node01 ~]# cat mkfs.disk.sh
#!/bin/bash
for i in `cat /root/disk.list`
do
echo 'y' | /sbin/mkfs.ext4 $i &
done [root@data-node01 ~]# sh -x mkfs.disk.sh 接着进行挂载
[root@data-node01 ~]# /bin/mkdir /data{3,4,5,6,7,8,9,10,11,12} 查看这10块盘的uuid(下面两种方式都可以)
[root@data-node01 ~]# blkid
[root@data-node01 ~]# ls -l /dev/disk/by-uuid/ [root@data-node01 ~]# blkid
/dev/sda3: UUID="964bec23-58b4-4a6b-a96f-f2e3222fc096" TYPE="ext4"
/dev/sdc1: UUID="9acdef9d-fbe1-4d9f-82ff-9e9920df868e" TYPE="ext4"
/dev/sdb1: UUID="696f5971-4c7c-4312-a1c3-a20fc3772299" TYPE="ext4"
/dev/sda1: UUID="ee26ded4-8334-4a0f-84bc-cc97d103714e" TYPE="ext4"
/dev/sda2: UUID="316cb693-05fe-473d-a2ff-3c3c0e0e6c3d" TYPE="swap"
/dev/sdd: UUID="f92e73be-526d-4d84-8f5b-95273ebbd352" TYPE="ext4"
/dev/sde: UUID="0a6404ea-60dc-4e3e-b542-48a313e149dd" TYPE="ext4"
/dev/sdf: UUID="05891dd0-256a-4f7f-a2de-f1f858eb2a95" TYPE="ext4"
/dev/sdg: UUID="77df1f77-0168-430e-96a3-f2eb44e15242" TYPE="ext4"
/dev/sdh: UUID="e1f11339-ad68-44a1-a600-066094439ed2" TYPE="ext4"
/dev/sdi: UUID="628f1658-d8f9-4573-a124-0712b0c29e90" TYPE="ext4"
/dev/sdj: UUID="9ee336b0-3960-4cfd-9cb6-c92535f45ebd" TYPE="ext4"
/dev/sdk: UUID="bb6c1e2d-41b8-407d-b6df-df2e3ffc9c52" TYPE="ext4"
/dev/sdl: UUID="9ca6aecf-e0f1-4338-a7eb-e8a1d2f3b017" TYPE="ext4"
/dev/sdm: UUID="a5bf2880-4981-462a-8042-c6e913627c3d" TYPE="ext4" 单独找出这10块磁盘的uuid
[root@data-node01 ~]# blkid|tail -10|awk '{print $2}'
UUID="f92e73be-526d-4d84-8f5b-95273ebbd352"
UUID="0a6404ea-60dc-4e3e-b542-48a313e149dd"
UUID="05891dd0-256a-4f7f-a2de-f1f858eb2a95"
UUID="77df1f77-0168-430e-96a3-f2eb44e15242"
UUID="e1f11339-ad68-44a1-a600-066094439ed2"
UUID="628f1658-d8f9-4573-a124-0712b0c29e90"
UUID="9ee336b0-3960-4cfd-9cb6-c92535f45ebd"
UUID="bb6c1e2d-41b8-407d-b6df-df2e3ffc9c52"
UUID="9ca6aecf-e0f1-4338-a7eb-e8a1d2f3b017"
UUID="a5bf2880-4981-462a-8042-c6e913627c3d" [root@data-node01 ~]# blkid|tail -10|awk '{print $2}'|sed 's/"//g'
UUID=f92e73be-526d-4d84-8f5b-95273ebbd352
UUID=0a6404ea-60dc-4e3e-b542-48a313e149dd
UUID=05891dd0-256a-4f7f-a2de-f1f858eb2a95
UUID=77df1f77-0168-430e-96a3-f2eb44e15242
UUID=e1f11339-ad68-44a1-a600-066094439ed2
UUID=628f1658-d8f9-4573-a124-0712b0c29e90
UUID=9ee336b0-3960-4cfd-9cb6-c92535f45ebd
UUID=bb6c1e2d-41b8-407d-b6df-df2e3ffc9c52
UUID=9ca6aecf-e0f1-4338-a7eb-e8a1d2f3b017
UUID=a5bf2880-4981-462a-8042-c6e913627c3d 将这10块磁盘的uuid好放到/etc/fastab开启启动文件里
[root@data-node01 ~]# cat /root/a.txt
/data3 ext4 noatime,nobarrier 0 0
/data4 ext4 noatime,nobarrier 0 0
/data5 ext4 noatime,nobarrier 0 0
/data6 ext4 noatime,nobarrier 0 0
/data7 ext4 noatime,nobarrier 0 0
/data8 ext4 noatime,nobarrier 0 0
/data9 ext4 noatime,nobarrier 0 0
/data10 ext4 noatime,nobarrier 0 0
/data11 ext4 noatime,nobarrier 0 0
/data12 ext4 noatime,nobarrier 0 0 [root@data-node01 ~]# blkid|tail -10|awk '{print $2}'|sed 's/"//g'|paste - /root/a.txt >> /etc/fastab #"paste -" 表示将两个文件内容合并
UUID=f92e73be-526d-4d84-8f5b-95273ebbd352 /data3 ext4 noatime,nobarrier 0 0
UUID=0a6404ea-60dc-4e3e-b542-48a313e149dd /data4 ext4 noatime,nobarrier 0 0
UUID=05891dd0-256a-4f7f-a2de-f1f858eb2a95 /data5 ext4 noatime,nobarrier 0 0
UUID=77df1f77-0168-430e-96a3-f2eb44e15242 /data6 ext4 noatime,nobarrier 0 0
UUID=e1f11339-ad68-44a1-a600-066094439ed2 /data7 ext4 noatime,nobarrier 0 0
UUID=628f1658-d8f9-4573-a124-0712b0c29e90 /data8 ext4 noatime,nobarrier 0 0
UUID=9ee336b0-3960-4cfd-9cb6-c92535f45ebd /data9 ext4 noatime,nobarrier 0 0
UUID=bb6c1e2d-41b8-407d-b6df-df2e3ffc9c52 /data10 ext4 noatime,nobarrier 0 0
UUID=9ca6aecf-e0f1-4338-a7eb-e8a1d2f3b017 /data11 ext4 noatime,nobarrier 0 0
UUID=a5bf2880-4981-462a-8042-c6e913627c3d /data12 ext4 noatime,nobarrier 0 0 最后将服务器通过"reboot"重启,重启之后查看磁盘及挂载状态,就能看到那10块磁盘的挂载情况
[root@data-node01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 793G 3.1G 750G 1% /
tmpfs 63G 0 63G 0% /dev/shm
/dev/sda1 380M 78M 282M 22% /boot
/dev/sdb1 1.8T 68M 1.7T 1% /data1
/dev/sdc1 1.8T 68M 1.8T 1% /data2
/dev/sdd 3.6T 68M 3.4T 1% /data3
/dev/sde 3.6T 68M 3.4T 1% /data4
/dev/sdf 3.6T 68M 3.4T 1% /data5
/dev/sdg 3.6T 68M 3.4T 1% /data6
/dev/sdh 3.6T 68M 3.4T 1% /data7
/dev/sdi 3.6T 68M 3.4T 1% /data8
/dev/sdj 3.6T 68M 3.4T 1% /data9
/dev/sdk 3.6T 68M 3.4T 1% /data10
/dev/sdl 3.6T 68M 3.4T 1% /data11
/dev/sdm 3.6T 68M 3.4T 1% /data12 [root@data-node01 ~]# mount
/dev/sda3 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/sdb1 on /data1 type ext4 (rw)
/dev/sdc1 on /data2 type ext4 (rw)
/dev/sdd on /data3 type ext4 (rw,noatime,nobarrier)
/dev/sde on /data4 type ext4 (rw,noatime,nobarrier)
/dev/sdf on /data5 type ext4 (rw,noatime,nobarrier)
/dev/sdg on /data6 type ext4 (rw,noatime,nobarrier)
/dev/sdh on /data7 type ext4 (rw,noatime,nobarrier)
/dev/sdi on /data8 type ext4 (rw,noatime,nobarrier)
/dev/sdj on /data9 type ext4 (rw,noatime,nobarrier)
/dev/sdk on /data10 type ext4 (rw,noatime,nobarrier)
/dev/sdl on /data11 type ext4 (rw,noatime,nobarrier)
/dev/sdm on /data12 type ext4 (rw,noatime,nobarrier)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
------------MegaCli相关命令使用梳理------------
1)添加新的磁盘(即对新的磁盘做raid阵列),做成raid0阵列
[root@date-test ~]# MegaCli64 -CfgLdAdd -r0[32:5] WB Direct -a0
说明:
r0: raid0,即将这快盘做成raid0磁盘阵列
[32:5]:32为Enclosure Device ID,5为Slot Number。即磁盘的序列号信息
WB Direct:磁盘Write back 2)添加一块带有残余信息的磁盘
[root@date-test ~]# MegaCli64 -cfgforeign -scan -a0
There are 1 foreign configuration(s) on controller 0. Exit Code: 0x00
说明:由于是新插入的盘,而且是块有数据的盘,所有提示有外部配置。
[root@date-test ~]# MegaCli64 -cfgforeign -clear -a0
Foreign configuration 0 is cleared on controller 0. Exit Code: 0x00
[root@date-test ~]# MegaCli64 -cfgforeign -scan -a0
There is no foreign configuration on controller 0. Exit Code: 0x00
说明:清除外部配置信息,清除后再次进行查看
[root@date-test ~]# MegaCli64 -CfgLdAdd -r0[32:5] WB Direct -a0
Adapter 0: Created VD 1 Adapter 0: Configured the Adapter!! Exit Code: 0x00 3)查看Firmware state
[root@date-test ~]# MegaCli64 -PDList -aALL -Nolog|grep '^Firm'
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
说明:Online状态表示该磁盘已被做成raid阵列,为raid在线状态;如果是unconfigured(good)状态,就说明该磁盘没有被做成raid阵列,但状态OK。 4)关闭JBOD模式
[root@date-test ~]# MegaCli64 -AdpSetProp -EnableJBOD -0 -aALL
Adapter 0: Set JBOD to Disable success.
Exit Code: 0x00 5)检查raild阵列的级别和配置(MegaCli64 -LDInfo -Lall -aALL)
[root@date-test ~]# MegaCli64 -LDInfo -LALL -aAll | grep RAID
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0 6)检查raid卡信息
[root@date-test ~]# MegaCli64 -AdpAllInfo -aALL 7)查看硬盘信息
[root@date-test ~]# MegaCli64 -PDList -aALL 8)查看电池信息
[root@date-test ~]# MegaCli64 -AdpBbuCmd -aAll 9)查看raid卡日志
[root@date-test ~]# MegaCli64 -FwTermLog -Dsply -aALL 10)显示适配器个数
[root@date-test ~]# MegaCli64 -adpCount 11)显示适配器时间
[root@date-test ~]# MegaCli64 -AdpGetTime –aALL 12)显示所有适配器配置信息
[root@date-test ~]# MegaCli64 -AdpAllInfo -aAll 13)显示所有逻辑磁盘组信息
[root@date-test ~]# MegaCli64 -LDInfo -LALL -aAll 14)显示所有的物理信息
[root@date-test ~]# MegaCli64 -PDList -aAll 15)查看充电状态
[root@date-test ~]# MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL |grep 'Charger Status' 16)查看磁盘缓存策略(下面四种方式)
[root@date-test ~]# MegaCli64 -LDGetProp -Cache -L0 -a0
[root@date-test ~]# MegaCli64 -LDGetProp -Cache -L1 -a0
[root@date-test ~]# MegaCli64 -LDGetProp -Cache -LALL -a0
[root@date-test ~]# MegaCli64 -LDGetProp -Cache -LALL -aALL
[root@date-test ~]# MegaCli64 -LDGetProp -DskCache -LALL -aALL 17)设置磁盘缓存策略
缓存策略解释:
WT (Write through
WB (Write back)
NORA (No read ahead)
RA (Read ahead)
ADRA (Adaptive read ahead)
Cached
Direct 例子
[root@date-test ~]# MegaCli64 -LDSetProp WT|WB|NORA|RA|ADRA -L0 -a0
或者
[root@date-test ~]# MegaCli64 -LDSetProp -Cached|-Direct -L0 -a0
或者
[root@date-test ~]# MegaCli64 -LDSetProp -EnDskCache|-DisDskCache -L0 -a0 18)创建一个raid5阵列,由物理盘2,3,4构成,该阵列的热备盘是物理盘5
[root@date-test ~]# MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -Hsp[1:5] -a0 19)创建一个raid5阵列,由物理盘2,3,4构成,不指定热备盘。
[root@date-test ~]# MegaCli64 -CfgLdAdd -r5 [1:2,1:3,1:4] WB Direct -a0 20)删除阵列
[root@date-test ~]# MegaCli64 -CfgLdDel -L1 -a0 21)在线添加磁盘
[root@date-test ~]# MegaCli64 -LDRecon -Start -r5 -Add -PhysDrv[1:4] -L1 -a0 22)阵列创建完后,会有一个初始化同步块的过程,可以看看其进度。
[root@date-test ~]# MegaCli64 -LDInit -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
[root@date-test ~]# MegaCli64 -LDInit -ProgDsply -LALL -aALL 23)查看阵列后台初始化进度
[root@date-test ~]# MegaCli64 -LDBI -ShowProg -LALL -aALL
或者以动态可视化文字界面显示
[root@date-test ~]# MegaCli64 -LDBI -ProgDsply -LALL -aALL 24)指定第5块盘作为全局热备
[root@date-test ~]# MegaCli64 -PDHSP -Set [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0 25)指定为某个阵列的专用热备
[root@date-test ~]# MegaCli64 -PDHSP -Set [-Dedicated [-Array1]] [-EnclAffinity] [-nonRevertible] -PhysDrv[1:5] -a0 26)删除全局热备
[root@date-test ~]# MegaCli64 -PDHSP -Rmv -PhysDrv[1:5] -a0 27)将某块物理盘下线/上线
[root@date-test ~]# MegaCli64 -PDOffline -PhysDrv [1:4] -a0
[root@date-test ~]# MegaCli64 -PDOnline -PhysDrv [1:4] -a0 28)查看物理磁盘重建进度
[root@date-test ~]# MegaCli64 -PDRbld -ShowProg -PhysDrv [1:5] -a0
以动态可视化文字界面显示
[root@date-test ~]# MegaCli64 -PDRbld -ProgDsply -PhysDrv [1:5] -a0
使用Megacli64对服务器物理磁盘做Raid并通过uuid方式挂载的更多相关文章
- 物理服务器Linux下软RAID和UUID方式挂载方法--Megacli64
一.业务部门需求说明:公司最近来了一批服务器,用于大数据业务部署.数据节点服务器由14块物理磁盘,其中有2块是900G的盘,12块是4T的盘.在服务器系统安装时,进入系统的BIOS界面:1)将2块90 ...
- 华为服务器Linux在线做RAID方法
背景概述 最近维护大数据的一些主机,大概有3k+的数目,有很大一部分是华为的服务器,大部分是12块数据盘,单盘做RAID0来存放数据,但是通常硬件是不可靠的,磁盘损坏是常态, 然而磁盘损坏进行定位更换 ...
- Dell 服务器做Raid
Dell 服务器做Raid DELL R720 服务器 RAID阵列卡配置介绍 (H310) 关于 RAID 5 与热备份(Hot Spare) 在不同RAID组间使用热备盘——Global Hot ...
- 模拟示例raid 5(5块磁盘 3块做raid 2块做备份 ) raid 10(5块磁盘) 修改版
RAID5:需要至少三块(含)硬盘,兼顾存储性能.数据安全和储存成本. RAID10:需要至少四块(含)硬盘,兼具速度和安全性,但成本很高. raid 10(5块磁盘) 1.添加硬盘设备(添加5块) ...
- RAID5的创建(5块磁盘,三块做raid,两块做备份)
RAID5的创建(5块磁盘,三块做raid,两块做备份) 第一步:参考我的上一篇博客,用同样的方法添加5块硬盘.地址如下: https://www.cnblogs.com/Feng-L/p/11735 ...
- 如何做raid级别磁盘(rhel和centos系统皆可)
添加磁盘,自己需要多少磁盘即可添加多少数量 此处只添加了三块200MB大小的磁盘 此处三块磁盘,只有两块做raid,一块与raid磁盘为实验测读写速率,不测速率可三块都做raid. 进入虚拟机给三个磁 ...
- 在线做RAID命令
# 安装raid卡管理工具 wget http://10.12.30.102:10800/other/MegaCli-8.07.14-1.noarch.rpm -O /tmp/MegaCli-8.07 ...
- 服务器&阵列卡&组raid 5
清除raid信息后,机器将会读不到系统, 后面若进一步操作处理, raid信息有可能会被初始化掉,那么硬盘数据就有可能会被清空, 导致数据丢失, 否则如果只是清除raid信息,重做raid是可以还原系 ...
- linux系统做raid
raid 常用步骤 1.ctrl+R 进入raid设置界面 2.F2 相当于右键功能 3.箭头 → 是下一个选项功能 4.ctrl+n是下一页,ctrl+p是前一页 5.Esc退出.最后ctrl+al ...
随机推荐
- 一文读懂遗传算法工作原理(附Python实现)
选自AnalyticsVidhya 参与:晏奇.黄小天 近日,Analyticsvidhya 上发表了一篇题为<Introduction to Genetic Algorithm & t ...
- Python基础知识:测试代码
1.Python标准库中的模块unittest提供了代码测试工具. 单元测试用于核实函数的某个方面没有问题: 测试用例是一组单元测试,这些单元测试一起核实函数在各种情形下的行为都符合要求. 通俗的理解 ...
- MySQL内连接(INNER JOIN)
MySQL INNER JOIN子句介绍 MySQL INNER JOIN子句将一个表中的行与其他表中的行进行匹配,并允许从两个表中查询包含列的行记录. INNER JOIN子句是SELECT语句的可 ...
- SpringMVC中与Spring相关的@注解
一.Spring的常用组件类注解 @Component 被该注解所修饰的类是一个普通的spring bean类,该注解可以替代@Controller.@Service.@Repository.在 ...
- 5、爬虫系列之scrapy框架
一 scrapy框架简介 1 介绍 (1) 什么是Scrapy? Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架,非常出名,非常强悍.所谓的框架就是一个已经被集成了各种功能(高性能 ...
- mysql中左连接后,最终的记录数大于左边表的记录分析
如果B表符合条件的记录数大于1条,就会出现1:n的情况,这样left join后的结果,记录数会多于A表的记录数. 例如:member与member_login_log表的结构如下,member记录会 ...
- The Cat in the Hat POJ - 1289
题意:给你来两个数A,B .其中A=(n+1)k, B=nk 输出:(nk-1)/(n-1) 和 ∏ (n+1)k-i ni 思路:关键就是怎么求n和k.本来想这n一定是几个质因数的乘积,那 ...
- 理解 JavaScript 中的 for…of 循环
什么是 for…of 循环 for...of 语句创建一个循环来迭代可迭代的对象.在 ES6 中引入的 for...of 循环,以替代 for...in 和 forEach() ,并支持新的迭代协议. ...
- 上传文件调用webapi方式
选择文件 <div> <label for="fileUpload"> 选择文件 </label> <br/> <input ...
- BTREE这种Mysql默认的索引方式,具有普遍的适用性
文章转自 https://blog.csdn.net/caomiao2006/article/details/52145477 Mysql目前主要有以下几种索引方式:FULLTEXT,HASH,BTR ...