linux建raid1,linux中新建raid1~快来瞧一瞧看一看啦~~

操作

分区:

Disk /dev/sdb: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 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/sdc: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 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/sdd: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 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

fdisk /dev/sdb

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‘).

[[email protected] ~]# fdisk /dev/sdb

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)

建立raid1

[[email protected] ~]# mdadm -C /dev/md0 -l 1 -n 2 /dev/sd[bc]1

mdadm: Note: this array has metadata at the start and

may not be suitable as a boot device.  If you plan to

store ‘/boot‘ on this device please ensure that

your boot-loader understands md/v1.x metadata, or use

--metadata=0.90

Continue creating array? yes

mdadm: Defaulting to version 1.2 metadata

mdadm: array /dev/md0 started.

创建文件系统

格式化:

[[email protected] ~]# mkfs.ext4 /dev/md0

[[email protected] ~]# mkdir /data/

[[email protected] ~]# mount /dev/md0 /data/

total 16

drwx------ 2 root root 16384 Aug  5 11:16 lost+found

[[email protected] ~]# vi /etc/fstab

在最后添加如下内容

drwx------ 2 root root 16384 Aug 14 15:21 lost+found

ARRAY /dev/md0 metadata=1.2 name=localhost.localdomain:0 UUID=c00e8204:a51e89ea:f6069fbe:9350ed9a

写入配置文件

[[email protected] ~]# mdadm -Ds >> /etc/mdadm.conf

重新启动

/dev/mapper/VolGroup-lv_root 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/md0 on /data type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

模拟故障

[[email protected] ~]# mdadm /dev/md0 -a /dev/sdb1

mdadm: added /dev/sdb1

[[email protected] ~]# cat /proc/mdstat

Personalities : [raid1]

md0 : active raid1 sdb1[2] sdc1[1]

20948288 blocks super 1.2 [2/1] [_U]

[=====>...............]  recovery = 28.7% (6021952/20948288) finish=1.5min speed=159484K/sec

unused devices:

原文:http://9283898.blog.51cto.com/9273898/1540174

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值