Linux软raid创建
RAID:
HBA:基于主机的适配器
RAID:Redundent Array of Inexpensive Disks 廉价磁盘阵列
Independent 独立磁盘阵列
Level:仅用于标识磁盘组合方式的不同,不能取代数据备份
raid0,raid1,raid5,raid10,raid50,jbod
raid0:提高读写性能,没有容错能力。至少需要两块磁盘 100%
raid1:至少需要两块硬盘,镜像,硬件容错能力,读性能提升,写性能下降 50%
raid4:至少需要三块硬盘,允许一块盘出错,读写性能提升,(n-1)/n
raid5: 至少需要三块硬盘,允许一块盘出错,读写性能提升,(n-1)/n
raid6: 至少需要四块磁盘,允许两块盘出错。读写性能提升,(n-2)/n
raid10:至少需要四块磁盘。允许不同组内个各坏一块盘,读写性能提升,50%
raid01:
jbod:
md,可以组合任何块设备
mdadm,/etc/mdadm.conf
mdadm:模式化的工具
-A Assemble 装配模式
-C Create 创建模式
-n #:用于创建RAID设备的个数
-x #: 热备磁盘的个数
-l :指定RAID级别
-a :=yes(自动为创建的RAID设备创建设备文件) md mdp part p 如何创建设备文件
-c:指定块的大小,默认为512KB
-F FOLLOW 监控
-S 停止RAID
-D --detail: 显示阵列详细信息
Manage 管理模式专用项
-f:模拟损害
-r:模拟移除设备
-a:模拟添加新设备
watch
-n #:每个#执行一次指定的命令,单位为s
[root@mail ~]# watch -n1 'cat /proc/mdstat'
使用raid0创建一个6G大小的磁盘。
- 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
[root@mail ~]
# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xba68f31c.
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-2610, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +6G
Command (m
for
help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (785-2610, default 785):
Using default value 785
Last cylinder, +cylinders or +size{K,M,G} (785-2610, default 2610): +6G
Command (m
for
help): t
Partition number (1-4): 1
Hex code (
type
L to list codes): fd
Changed system
type
of partition 1 to fd (Linux raid autodetect)
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!
Calling ioctl() to re-
read
partition table.
Syncing disks.
[root@mail ~]
# mdadm -C /dev/md0 -a yes -l 0 -n 2 /dev/sdc{1,2}
mdadm: Defaulting to version 1.2 metadata
mdadm: array
/dev/md0
started.
[root@mail ~]
# cat /proc/mdstat
Personalities : [raid0]
md0 : active raid0 sdc2[1] sdc1[0]
12585984 blocks super 1.2 512k chunks
unused devices: <none>
[root@mail ~]
# mdadm -D /dev/md0
/dev/md0
:
Version : 1.2
Creation Time : Tue May 10 20:19:43 2016
Raid Level : raid0
Array Size : 12585984 (12.00 GiB 12.89 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Tue May 10 20:19:43 2016
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Chunk Size : 512K
Name : mail.saviorsyang.com:0 (
local
to host mail.saviorsyang.com)
UUID : b5ec8803:366d2e9d:a1ddd0f2:58101d5c
Events : 0
Number Major Minor RaidDevice State
0 8 33 0 active
sync
/dev/sdc1
1 8 34 1 active
sync
/dev/sdc2
[root@mail ~]
# mke2fs -t ext4 /dev/md0
mke2fs 1.43-WIP (20-Jun-2013)
Filesystem label=
OS
type
: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=128 blocks, Stripe width=256 blocks
786864 inodes, 3146496 blocks
157324 blocks (5.00%) reserved
for
the super user
First data block=0
Maximum filesystem blocks=3225419776
97 block
groups
32768 blocks per group, 32768 fragments per group
8112 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables:
done
Writing inode tables:
done
Creating journal (32768 blocks):
done
Writing superblocks and filesystem accounting information:
done
[root@mail ~]
# mkdir /test/md0
[root@mail ~]
# mount /dev/md0 /test/md0
[root@mail ~]
# mount
/dev/mapper/vg_demo-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/sdb1
on
/student
type
ext4 (rw)
/dev/sr0
on
/mnt
type
iso9660 (ro)
none on
/proc/sys/fs/binfmt_misc
type
binfmt_misc (rw)
/dev/md0
on
/test/md0
type
ext4 (rw)
使用raid1创建一个2G大小的磁盘。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168[root@mail ~]
# fdisk /dev/sdc
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)
e
Partition number (1-4):
Value out of range.
Partition number (1-4): 3
First cylinder (1569-2610, default 1569):
Using default value 1569
Last cylinder, +cylinders or +size{K,M,G} (1569-2610, default 2610):
Using default value 2610
Command (m
for
help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (1569-2610, default 1569):
Using default value 1569
Last cylinder, +cylinders or +size{K,M,G} (1569-2610, default 2610): +2GCommand (m
for
help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (1831-2610, default 1831):
Using default value 1831
Last cylinder, +cylinders or +size{K,M,G} (1831-2610, default 2610): +2G
Command (m
for
help): w
The partition table has been altered!
Calling ioctl() to re-
read
partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@mail ~]
# fdisk /dev/sdc
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): t
Partition number (1-6): 5
Hex code (
type
L to list codes): fd
Changed system
type
of partition 5 to fd (Linux raid autodetect)
Command (m
for
help): t
Partition number (1-6): 6
Hex code (
type
L to list codes): fd
Changed system
type
of partition 6 to fd (Linux raid autodetect)
Command (m
for
help): w
The partition table has been altered!
Calling ioctl() to re-
read
partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@mail ~]
# partx /dev/sdc
# 1: 63- 12594959 ( 12594897 sectors, 6448 MB)
# 2: 12594960- 25189919 ( 12594960 sectors, 6448 MB)
# 3: 25189920- 41929649 ( 16739730 sectors, 8570 MB)
# 4: 0- -1 ( 0 sectors, 0 MB)
# 5: 25189983- 29398949 ( 4208967 sectors, 2154 MB)
# 6: 29399013- 33607979 ( 4208967 sectors, 2154 MB)
[root@mail ~]
# cat /proc/partitions
major minor
#blocks name
8 32 20971520 sdc
8 33 6297448 sdc1
8 34 6297480 sdc2
8 35 31 sdc3
8 37 2104483 sdc5
8 38 2104483 sdc6
8 0 52428800 sda
8 1 512000 sda1
8 2 51915776 sda2
8 16 524288000 sdb
8 17 524281243 sdb1
8 48 20971520 sdd
11 0 3763200 sr0
252 0 47816704 dm-0
252 1 4096000 dm-1
9 0 12585984 md0
[root@mail ~]
# mdadm -C /dev/md1 -a yes -l 1 -n 2 /dev/sdc{5,6}
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/md1
started.
[root@mail ~]
# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdc6[1] sdc5[0]
2102400 blocks super 1.2 [2
/2
] [UU]
[=================>...] resync = 85.5% (1800064
/2102400
) finish=0.0min speed=200007K
/sec
md0 : active raid0 sdc2[1] sdc1[0]
12585984 blocks super 1.2 512k chunks
unused devices: <none>
[root@mail ~]
# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdc6[1] sdc5[0]
2102400 blocks super 1.2 [2
/2
] [UU]
md0 : active raid0 sdc2[1] sdc1[0]
12585984 blocks super 1.2 512k chunks
unused devices: <none>
[root@mail ~]
#
[root@mail ~]
# mke2fs -t ext4 /dev/md1
mke2fs 1.43-WIP (20-Jun-2013)
Filesystem label=
OS
type
: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131648 inodes, 525600 blocks
26280 blocks (5.00%) reserved
for
the super user
First data block=0
Maximum filesystem blocks=541065216
17 block
groups
32768 blocks per group, 32768 fragments per group
7744 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables:
done
Writing inode tables:
done
Creating journal (16384 blocks):
done
Writing superblocks and filesystem accounting information:
done
[root@mail ~]
# mkdir -pv /test/md1
[root@mail ~]
# mount /dev/md1 /test/md1
[root@mail ~]
# mount
/dev/mapper/vg_demo-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/sdb1
on
/student
type
ext4 (rw)
/dev/sr0
on
/mnt
type
iso9660 (ro)
none on
/proc/sys/fs/binfmt_misc
type
binfmt_misc (rw)
/dev/md1
on
/test/md1
type
ext4 (rw)
转载于:https://www.cnblogs.com/Saviorsyang/p/5738394.html
Linux软raid创建相关推荐
- Linux软raid创建和维护
2019独角兽企业重金招聘Python工程师标准>>> 说明:RAID分为软RAID和硬件RAID 软件RAID是基于系统的软件工作 不稳定,如果系统坏了,RAID整列也就损坏,容 ...
- linux 软raid创建过程
要求:需要在三块硬盘上创建RAID5 并挂载到 /raid5disk 目录下!(做raid5至少3块硬盘) 首先安装软件yum install mdadm* 先用fdisk -l 看一下三块磁盘的设备 ...
- linux创建raid步骤,Linux 软Raid创建方法:
一.Raid 0 创建 # mdadm -C /dev/md0 -n 2 -a yes -l 0 -x /dev/sdb1 /dev/sdb2 /dev/sdb3[创建Raid 0 ,其中-C 创建, ...
- linux 系统盘做软raid,Linux软RAID配置
RAID卡一般分为硬RAID卡和软RAID卡两种,通过用硬件来实现RAID功能的就是硬RAID,独立的RAID卡,主板集成的RAID芯片都是硬RAID.通过软件并使用CPU的RAID卡是指使用CPU来 ...
- linux 软raid命令,mdadm命令 – 管理linux软RAID
mdadm命令是multiple devices admin的简称,它是linux下的一款标准的软件 RAID管理工具,可以管理linux软RAID,比如创建.调整.监控RAID. mdadm命令能够 ...
- 网易视频云技术分享:linux软raid的bitmap分析
网易视频云是网易倾力打造的一款基于云计算的分布式多媒体处理集群和专业音视频技术,提供稳定流畅.低时延.高并发的视频直播.录制.存储.转码及点播等音视频的PAAS服务,在线教育.远程医疗.娱乐秀场.在线 ...
- linux 软raid恢复,Linux软RAID部署系统分区之恢复攻略
Linux软RAID部署系统分区之恢复攻略 软RAID部署系统分区之恢复攻略 ChinaUnix网友:Jerrywjl 作为在几乎所有Linux发行版操作系统中所带的逻辑卷管理方式(LVM),其最大的 ...
- linux软RAId配置与管理总结,Linux下使用mdadm创建和管理软raid(转)
Linux下使用mdadm创建和管理软raid 注:本次操作以RHEL4为例,但应该可以应用到其它大部分的distro上(guess). mdadm的几个常用参数 -C 创建Raid,后面跟参数,代表 ...
- LINUX 软RAID和硬RAI及软RAID的实现
一.RAID简介 RAID是"Redundant Array of Independent Disk"的缩写,中文意思是独立冗余磁盘阵列,早期称为廉价磁盘阵列.简单地解释,就是将N ...
- linux软raid阅读笔记,linux自学笔记——RAID级别特性以及软RAID的实现
RAID,Redundant Arrays of Inexpensive Disks廉价冗余磁盘阵列,又称为Redundant Arrays of Independent Disks,独立冗余磁盘阵列 ...
最新文章
- android canvas_Android仿IOS11 控制中心进度条
- pandas中DataFrame的apply()方法和applymap()方法,以及python内置函数map()
- 创纪录!Oracle关键补丁更新修复关键漏洞曝光
- Java输出彩色字符
- javaCh6课堂测试
- FullCalendar插件月视图正常显示周视图不正常显示问题解决方法
- pip安装报错处理+PyPi源切换教程
- 信息学奥赛一本通C++语言——1096:数字统计
- HTML 5 Canvas
- python中的tab补全功能添加
- Eclipse EGit插件安装使用记录
- 计算机组成原理三个相关,计算机组成原理试题3
- matlab无法显示图片
- 一文十大排序算法(动画图解)
- Connection closed prematurely
- 将本地代码push到github上
- c语言中用梯形法求定积分
- 如何在手机上完成日语翻译中文
- Qt之QVector基本用法
- natapp实现内网穿透(详解)
热门文章
- synchronized中重量级锁、偏向锁和轻量级锁的区别
- 数据是指在计算机科学中能够被,5. 数据在 计算机科学中 是指所有能输入到计算机并 被计算机程序处理的符号的总称。( )...
- easyui tree json php,easyui tree json
- 读论文 + 总结 + 笔记
- hdu acm 1016
- mysql5.7.9 zip achive
- 计算化侦查之根据公交卡记录抓小偷
- 不变子空间与线性变换的矩阵之间的关系
- java对象占用内存的说法_JAVA 中关于对象成员占用内存的说法哪个正确 (3.0分)_学小易找答案...
- mysql高性能sql引擎剖析_Oracle+高性能SQL引擎剖析:SQL优化与调优机制详解-笔记之执行计划(一)...