首页 > 代码库 > Linux RAID 1
Linux RAID 1
磁盘管理RAID1
POC环境
在linux上添加2块新的30GB硬盘启动
cat /etc/redhat-releasecat
Name : mdadm Relocations: (not relocatable)
Version : 3.2.5 Vendor: Red Hat, Inc.
Release : 4.el6 Build Date: Fri 07 Dec 2012 12:14:45 AM CST
Install Date: Fri 01 Aug 2014 06:07:09 PM CST Build Host: x86-003.build.bos.redhat.com
Group : System Environment/Base Source RPM: mdadm-3.2.5-4.el6.src.rpm
Size : 860588 License: GPLv2+
Signature : RSA/8, Mon 28 Jan 2013 10:48:06 PM CST, Key ID 199e2f91fd431d51
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://www.kernel.org/pub/linux/utils/raid/mdadm/
Summary : The mdadm program controls Linux md devices (software RAID arrays)
Description :
The mdadm program is used to create, manage, and monitor Linux MD (software
RAID) devices. As such, it provides similar functionality to the raidtools
package. However, mdadm is a single program, and it can perform
almost all functions without a configuration file, though a configuration
file can be used to help with some common tasks.
操作
分区
fdisk -l
Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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
创建目录,将光盘挂载到目录下,进入sdb硬盘
进入硬盘创建sdb1 查看
Fdisk /dev/sdb1
对/dev/sdc进行操作
fdisk -l /dev/sdc
Disk /dev/sdc: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 0x8f7a12ed
Device Boot Start End Blocks Id System
/dev/sdc1 1 3916 31455238+ fd Linux raid autodetect
进入挂载目录安装rpm mdadm包
cd /mnt/packages
建立RAID1卷
使sdb1 sdc1 阵列
mdadm -C /dev/md0 -l 1 -n 2 /dev/sdb1 /dev/sdc1
进入查看是否建立成功
Cat /proc/mdstart
创建文件系统
格式化该磁盘阵列
mkfs.ext4 /dev/md0
创建目录DATA
Mkdir /mnt/data
将md0挂载到data下
Mount /dev/md0 /mnt/DATA
在文件fatab下追加内容
vi /etc/fstab
/dev/md0 /data ext4 defaults 0 0
写入配置文件
mdadm -Ds >> /etc/mdadm.conf
重新启动
reboot