我虚拟机已经添加好三块盘
[root@oracle ~]# fdisk -l
Disk /dev/sde: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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
[root@oracle ~]# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x382d838f.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-130, default 130):
Using default value 130
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
其它两块盘做同样的分区和标记
3第三步创建raid组
mdadm --create --verbose /dev/md0 --level=0 --raid-devices=3 /dev/sde1 /dev/sdf1 /dev/sdg1
第四步 配置文件
echo DEVICE /dev/sd{e,f,g}1 >> /etc/mdadm.conf
mdadm - -detail - -scan >> /etc/mdadm.conf
第五步 穿件文件系统
刚才创建的/dev/md0 现在可以做为一个磁盘设备来使用
#mkfs.ext4 /dev/md0
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=128 blocks, Stripe width=384 blocks
195840 inodes, 782976 blocks
39148 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=805306368
24 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
mkdir /raid0test
mount /dev/md0 /raid0test
第七步 随机启动自挂载磁盘
将mount /dev/md0 /raid0test 命令写入 /dev/rc.local 中
echo mount /dev/md0 /raid0test >>/dev/rc.local
第八步 查看raid 信息
[root@oracle ~]# cat /proc/mdstat
Personalities : [raid0]
md0 : active raid0 sdg1[2] sdf1[1] sde1[0]
3131904 blocks super 1.2 512k chunks
unused devices:
[root@oracle ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Feb 11 14:37:20 2015
Raid Level : raid0
Array Size : 3131904 (2.99 GiB 3.21 GB)
Raid Devices : 3
Total Devices : 3
Persistence : Superblock is persistent
Update Time : Wed Feb 11 14:37:20 2015
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Chunk Size : 512K
Name : oracle:0 (local to host oracle)
UUID : 2a4adf15:7f218c31:3f5fe32b:d27b7ca9
Events : 0
Number Major Minor RaidDevice State
0 8 65 0 active sync /dev/sde1
1 8 81 1 active sync /dev/sdf1
2 8 97 2 active sync /dev/sdg1
这里使用的是一个mdadm 做的软raid
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26764973/viewspace-1435969/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26764973/viewspace-1435969/