RAID 0最少要求两个磁盘:
先给系统添加两磁盘sdb和sdc。分别分配512M空间:
方法:VMware Server 控制台:单击 Edit virtual machine settings。
àAdd->Hard Disk.分别添加raid_sdb.vmdk和raid_sdc.vmdk。
[root@11g ~]# fdisk –l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3916 31350847+ 8e Linux LVM
Disk /dev/sdb: 536 MB, 536870912 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
Disk /dev/sdc doesn't contain a valid partition table
分区 /dev/sdb
[root@11g ~]# fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512):
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): L
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!
再分区 /dev/sdc:
[root@11g ~]# fdisk /dev/sdc
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512):
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): fd
Changed system type of partition 2 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
查看分区列表:
[root@11g ~]# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3916 31350847+ 8e Linux LVM
/dev/sdb1 1 512 524272 fd Linux raid autodetect
/dev/sdc1 1 512 524272 fd Linux raid autodetect
创建md0分区:
[root@11g ~]# mdadm -C /dev/md0 -l0 -n2 /dev/sd[b,c]1
mdadm: array /dev/md0 started.
创建成功。
注:“l0”表示level=0。
“n2”表示活动磁盘两个。
格式化md0分区为ext3文件系统:
[root@11g ~]# mkfs.ext3 /dev/md0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
131072 inodes, 262080 blocks
13104 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (4096 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.
加载md0分区到/opt目录:
[root@11g ~]# mkdir mdtest
[root@11g /]# mount /dev/md0 /mdtest
拷贝一个文件到/mdtest目录下:
[root@11g /]# cp /etc/fstab /mdtest
添加开机即挂载:
vi /etc/fstab 添加:
/dev/md0 /mdtest ext3 defaults 0 0
该贴被kim编辑于2011-8-8 12:34:33