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/sdcDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0xba68f31c.Changes will remaininmemory only,untilyou 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 toswitch off the mode (command'c') and change displayunitstosectors (command'u').Command (mforhelp): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 1First cylinder (1-2610, default 1):Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +6GCommand (mforhelp): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 2First cylinder (785-2610, default 785):Using default value 785Last cylinder, +cylinders or +size{K,M,G} (785-2610, default 2610): +6GCommand (mforhelp): tPartition number (1-4): 1Hex code (typeL to list codes): fdChanged systemtypeof partition 1 to fd (Linux raid autodetect)Command (mforhelp): tPartition number (1-4): 2Hex code (typeL to list codes): fdChanged systemtypeof partition 2 to fd (Linux raid autodetect)Command (mforhelp): wThe partition table has been altered!Calling ioctl() to re-readpartition 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 metadatamdadm: array/dev/md0started.[root@mail ~]# cat /proc/mdstatPersonalities : [raid0]md0 : active raid0 sdc2[1] sdc1[0]12585984 blocks super 1.2 512k chunksunused devices: <none>[root@mail ~]# mdadm -D /dev/md0/dev/md0:Version : 1.2Creation Time : Tue May 10 20:19:43 2016Raid Level : raid0Array Size : 12585984 (12.00 GiB 12.89 GB)Raid Devices : 2Total Devices : 2Persistence : Superblock is persistentUpdate Time : Tue May 10 20:19:43 2016State : cleanActive Devices : 2Working Devices : 2Failed Devices : 0Spare Devices : 0Chunk Size : 512KName : mail.saviorsyang.com:0 (localto host mail.saviorsyang.com)UUID : b5ec8803:366d2e9d:a1ddd0f2:58101d5cEvents : 0Number Major Minor RaidDevice State0 8 33 0 activesync/dev/sdc11 8 34 1 activesync/dev/sdc2[root@mail ~]# mke2fs -t ext4 /dev/md0mke2fs 1.43-WIP (20-Jun-2013)Filesystem label=OStype: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=128 blocks, Stripe width=256 blocks786864 inodes, 3146496 blocks157324 blocks (5.00%) reservedforthe super userFirst data block=0Maximum filesystem blocks=322541977697 blockgroups32768 blocks per group, 32768 fragments per group8112 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208Allocating group tables:doneWriting inode tables:doneCreating journal (32768 blocks):doneWriting 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_rooton /typeext4 (rw)proc on/proctypeproc (rw)sysfs on/systypesysfs (rw)devpts on/dev/ptstypedevpts (rw,gid=5,mode=620)tmpfs on/dev/shmtypetmpfs (rw)/dev/sda1on/boottypeext4 (rw)/dev/sdb1on/studenttypeext4 (rw)/dev/sr0on/mnttypeiso9660 (ro)none on/proc/sys/fs/binfmt_misctypebinfmt_misc (rw)/dev/md0on/test/md0typeext4 (rw)使用raid1创建一个2G大小的磁盘。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168[root@mail ~]# fdisk /dev/sdcWARNING: DOS-compatible mode is deprecated. It's strongly recommended toswitch off the mode (command'c') and change displayunitstosectors (command'u').Command (mforhelp): nCommand actione extendedp primary partition (1-4)ePartition number (1-4):Value out of range.Partition number (1-4): 3First cylinder (1569-2610, default 1569):Using default value 1569Last cylinder, +cylinders or +size{K,M,G} (1569-2610, default 2610):Using default value 2610Command (mforhelp): nCommand actionl logical (5 or over)p primary partition (1-4)lFirst cylinder (1569-2610, default 1569):Using default value 1569Last cylinder, +cylinders or +size{K,M,G} (1569-2610, default 2610): +2GCommand (mforhelp): nCommand actionl logical (5 or over)p primary partition (1-4)lFirst cylinder (1831-2610, default 1831):Using default value 1831Last cylinder, +cylinders or +size{K,M,G} (1831-2610, default 2610): +2GCommand (mforhelp): wThe partition table has been altered!Calling ioctl() to re-readpartition 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 atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.[root@mail ~]# fdisk /dev/sdcWARNING: DOS-compatible mode is deprecated. It's strongly recommended toswitch off the mode (command'c') and change displayunitstosectors (command'u').Command (mforhelp): tPartition number (1-6): 5Hex code (typeL to list codes): fdChanged systemtypeof partition 5 to fd (Linux raid autodetect)Command (mforhelp): tPartition number (1-6): 6Hex code (typeL to list codes): fdChanged systemtypeof partition 6 to fd (Linux raid autodetect)Command (mforhelp): wThe partition table has been altered!Calling ioctl() to re-readpartition 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 atthe 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/partitionsmajor minor#blocks name8 32 20971520 sdc8 33 6297448 sdc18 34 6297480 sdc28 35 31 sdc38 37 2104483 sdc58 38 2104483 sdc68 0 52428800 sda8 1 512000 sda18 2 51915776 sda28 16 524288000 sdb8 17 524281243 sdb18 48 20971520 sdd11 0 3763200 sr0252 0 47816704 dm-0252 1 4096000 dm-19 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 andmay not be suitable as a boot device. If you plan tostore'/boot'on this device please ensure thatyour boot-loader understands md/v1.x metadata, or use--metadata=0.90Continue creating array?yesmdadm: Defaulting to version 1.2 metadatamdadm: array/dev/md1started.[root@mail ~]# cat /proc/mdstatPersonalities : [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/secmd0 : active raid0 sdc2[1] sdc1[0]12585984 blocks super 1.2 512k chunksunused devices: <none>[root@mail ~]# cat /proc/mdstatPersonalities : [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 chunksunused devices: <none>[root@mail ~]#[root@mail ~]# mke2fs -t ext4 /dev/md1mke2fs 1.43-WIP (20-Jun-2013)Filesystem label=OStype: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks131648 inodes, 525600 blocks26280 blocks (5.00%) reservedforthe super userFirst data block=0Maximum filesystem blocks=54106521617 blockgroups32768 blocks per group, 32768 fragments per group7744 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912Allocating group tables:doneWriting inode tables:doneCreating journal (16384 blocks):doneWriting 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_rooton /typeext4 (rw)proc on/proctypeproc (rw)sysfs on/systypesysfs (rw)devpts on/dev/ptstypedevpts (rw,gid=5,mode=620)tmpfs on/dev/shmtypetmpfs (rw)/dev/sda1on/boottypeext4 (rw)/dev/sdb1on/studenttypeext4 (rw)/dev/sr0on/mnttypeiso9660 (ro)none on/proc/sys/fs/binfmt_misctypebinfmt_misc (rw)/dev/md1on/test/md1typeext4 (rw)
Linux软raid创建的更多相关文章
- Linux 常见 RAID 及软 RAID 创建
RAID可以大幅度的提高磁盘性能,以及可靠性,这么好的技术怎么能不掌握呢!此篇介绍一些常见RAID,及其在Linux上的软RAID创建方法. mdadm 创建软RAID mdadm -C -v /de ...
- 网易视频云技术分享:linux软raid的bitmap分析
网易视频云是网易倾力打造的一款基于云计算的分布式多媒体处理集群和专业音视频技术,提供稳定流畅.低时延.高并发的视频直播.录制.存储.转码及点播等音视频的PAAS服务,在线教育.远程医疗.娱乐秀场.在线 ...
- linux软raid练习
创建一个空间大小为10G的raid5,要求其chunk为1024k,格式为ext4文件系统,开机可自动挂载至/backup目录,并支持acl功能: 1 2 3 4 5 6 7 8 9 10 11 12 ...
- Linux中的LVM和软RAID
在实际工作中,会经常碰到所给的服务器硬盘容量太小,而实际的应用软件中却需要一个容量较大的分区进行数据存储等,除了通过硬件RAID卡来实现合并多硬盘外,其实我们也可以通过软件的方式来实现. 实验 ...
- Linux下创建软Raid
1- Linux下创建软Raid 步骤1.创建磁盘,并转换为fd #fdisk /dev/sdb //这里使用新的磁盘sdb 然后输入n ,创建分区 使用默认的起始点 输入大小为+100M 然后重 ...
- ☆RHEL6创建软raid的使用☆——经典之作
raid主要的种类 1.raid0 扩展卷 raid 0又称Stripee或Striping,中文译为集带工作方式, 有时也可以理解为拼凑. 它是将要存取的数据以条带状的形式尽量平均分配到多个硬 ...
- linux磁盘管理系列-软RAID的实现
1 什么是RAID RAID全称是独立磁盘冗余阵列(Redundant Array of Independent Disks),基本思想是把多个磁盘组合起来,组合一个磁盘阵列组,使得性能大幅提高. R ...
- linux磁盘管理系列二:软RAID的实现
磁盘管理系列 linux磁盘管理系列一:磁盘配额管理 http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_040_quota.html l ...
- LINUX中软RAID的实现方案
转自linux就该这么学 应用场景 Raid大家都知道是冗余磁盘的意思(Redundant Arrays of Independent Disks,RAID),可以按业务系统的需要提供高可用性和冗余性 ...
随机推荐
- tail 显示文件最后若干行内容
功能:tail命令可以输出文件的尾部内容,默认情况下它显示文件的最后十行.显示每个指定文件的最后10 行到标准输出.若指定了多于一个文件,程序会在每段输出的开始添加相应文件名作为头.如果不指定文件或文 ...
- thymeleaf常用标签
1. th:checked ,th:selected标签<input type="radio" value="M" name="gender&q ...
- 数据类型int、bigint、smallint 和 tinyint范围
bigint 从 -2^63 (-9223372036854775808) 到 2^63-1 (9223372036854775807) 的整型数据(所有数字).存储大小为 8 个字节. int ...
- 无约束优化算法——牛顿法与拟牛顿法(DFP,BFGS,LBFGS)
简介:最近在看逻辑回归算法,在算法构建模型的过程中需要对参数进行求解,采用的方法有梯度下降法和无约束项优化算法.之前对无约束项优化算法并不是很了解,于是在学习逻辑回归之前,先对无约束项优化算法中经典的 ...
- 手机支持USB功能、驱动文件对应关系
手机支持USB功能: 1.UMS(USB MASS Stronge) : 连接PC作为存储盘使用 2.ADB : 用于调试 3.MTP :连接PC作为存储盘使用(win XP需要安装WMP10 以上 ...
- Excel的python读写
实际工作中可能需要整理一些文档,或者记录一些数据,这时候使用python来操作Excel可能会帮得上你. 读操作: # encoding : utf-8 #设置编码方式 import xlrd #导入 ...
- C++Promise函数
Promise内部会建立一个shared state是用来放一个相应的类型的值或是一个异常,并可被future object 取其数据当线程结果 promise是在形成成果后才将结果放进shared ...
- linux命令:du
1.命令介绍: du用来查看文件和目录的使用空间. 2.命令格式: du [选项] 文件 3.命令参数: -a或-all 显示目录中个别文件的大小. -b或-bytes 显示目录或文件大小时,以b ...
- 【物联网应用与维护】基于SQL sever 2008 R2的数据库定时处理
--SQLServer : --1.打开[SQL Server Management Studio],在[对象资源管理器]列表中选择[SQL Server 代理]: --2.鼠标右击[SQL Serv ...
- 转---B/S结构JavaEE WebApp的全自动安装包制作心得
JavaEE的Web应用程序如今已大行其道,但其安装.配置.部署却一直繁琐无比,客观上阻碍了Web应用程序更大规模的推广和应用.因此,开发方制作一个集JDK.Web中间件.开源数据库的全自动安装程序很 ...