已阅读5页,还剩9页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Solaris 软RAID指导内容简介1、简单的镜像实例2、简单的metadevice概念3、concatenation、stripe,RAID1,raid10,raind01.4、补充说明和常见问题5、相关命令详细解说看贴学习要回贴哦做人要厚道呀第一章请用1小时跟着作试验,后面的内容就好理解,本人作完各种RAID试验用了一周第一章:原系统单硬盘新增一块硬盘后,把根文件系统和SWAP分区作镜像一、假设目前的情况,如果不符合,请先搭建环境:1 - 有2个 disks - c0t0d0 (disk0) and c0t1d0 (disk1).disk1为新增磁盘 2 原系统安装在 disk0, disk1未使用. 3 - disk0磁盘都有以下的分片(slices),最好disk1手工创建和disk0一样的分片: 0 - / 1 - swap 2 - whole-disk 3 - unassigned 64-MB -未使用的空间4 - unassigned 64-MB -未使用的空间Slice3和4是用来存放meta-database日志,磁盘必须有至少128M的空余日志空间,每片64M如果disk0上没有空余没用的slice也没关系,添加另外一个硬盘随便分区,只要有空余的分区用来存放metadb就行(没有说一定要分区3和4哦),假设这里我们用来存放metadb数据库的分区是c0t2d0s3,c0t2d0s4下面我们开始制作根系统的镜像实例(1cylinder=16track=1008block=1008sector,1track=63block,1block=512byte)重要提示:动手前,请先备份系统二、动手1.复制disk0的分片信息到disk1:prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2因为metadevices是工作在块级别的,所以两个磁盘必须所有物理信息一致(几何匹配)2.建立meta-databasesmetadb -af -c 2 /dev/dsk/c0t2d0s3 /dev/dsk/c0t2d0s4 在每个分片上建立2个meta-database,-a 添加,-c 2 数量为2个,-f是第一次建metadb必须的参数,如果有多个disks,可以把数据库分布在多个磁盘上以获得更好的性能和故障冗余3.建立镜像设备(raid-device)在一个2-disk的系统里,我们要做的就是把disk0和disk1结合在一起。建立以下的镜像设备和成员(d0表示slice0的raid-device,d10表示d0的成员1):d0 - / mirror d10 - /dev/dsk/c0t0d0s0 d20 - /dev/dsk/c0t1d0s0 d1 - swap d11 - /dev/dsk/c0t0d0s1 d21 - /dev/dsk/c0t1d0s1 metainit -f d10 1 1 /dev/dsk/c0t0d0s0 metainit -f d20 1 1 /dev/dsk/c0t1d0s0 metainit -f d0 -m d10 metainit -f d11 1 1 /dev/dsk/c0t0d0s1 metainit -f d21 1 1 /dev/dsk/c0t1d0s1 metainit -f d1 -m d11 4.metainit初始化了设备,metastat已经可以查看,不过还不能使用(因为mirror-halves 还没attached)(有时系统已经自动attach了d10和d11)metattachd0 d10 metattachd1 d11 现在我们已经把镜像的一半(first half,即正在运行的磁盘,disk0)attached上来了.在后面的步骤中,我们会把另外一半attach上来,一旦attach磁盘会立刻疯狂同步!5.指定系统使用metadevices,指定根文件系统:metaroot d0修改/etc/vfstab让swap使用metadevices 的d1(/dev/md/dsk/d1)根文件系统(d0)的mount option 下标记写为 “logging”如果镜像的所有子镜像(请注意是所有子镜像)都没创建文件系统,在mounted之前必须:newfs /dev/md/dsk/d16.最后重新启动系统lockfs fa锁定文件系统,这个没什么好商量的,为了防止出现文件不同步之类的情况init 67.启动后会有类似以下的一些错误信息,不用管它,因为我们还没完成raid-devices的操作:forceload of misc/md_trans failed forceload of misc/md_raid failed forceload of misc/md_hotspares failed 现在把镜像的另外一半 attach上来:metattachd0 d20 metattachd1 d21 这时候,磁盘开始疯狂转动,进行同步(your disks are syncing)8.把启动扇区的信息复制到disk1,以便disk1也可以启动:installboot /usr/platform/uname -i/lib/fs/ufs/bootblk/dev/rdsk/c0t1d0s0uname -i指的是用uname i看到的平台名字s10中已经用installgrub命令代替insallboot,命令如下installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t1d0s09.如果disk0无法启动的时候,我们可以设置OPB,让系统从disk1启动,进入ok模式:setenv boot-device disk disk1 nvstore boot disk1 X86的也可以直接编辑/boot/solaris/bootenv.rc文件,或者用#eeprom boot-device disk disk1 ?也可从BIOS设置disk1启动,可看到disk1的硬盘先闪This will set up a failover boot to disk1. The very last command there will also boot from disk1, proving to you that this works. Do be sure to substitute the correct disk for disk1. 强烈推荐去看SUN的在线文档, Theres a lot more that you can do with it thats not covered here. Oh, and youll probably want to read up on how to actually replace a failed disk. 三、换盘/替换坏盘:1、关机、替换硬盘、format-fdisk-复制另一盘的分区信息2、然后#metastat | more 看哪些盘提示需要metareplace,然后按照提示输入类似如下:#metareplace -e d1 c1d1s13、或者重新创建metadevice和attach.具体例子:RAID5坏掉一个盘的恢复方法: 例阵列d55中一个组件c1t4d0s2盘坏掉,更换坏硬盘后作如下工作: ok boot -r (X86 #touch /reconfigure;sync;init 6 或者重启后#devfsadm)注意,只有加入-r选项时, 系统在起动时才给所识别了的设备(包括SCSI设备) 生成相应的设备文件。 #metareplace e d55 c1t4d0s2 如果新硬盘插的地方和旧硬盘不一样,比如是c1t5d0s2,那么用以下命令#metareplace e d55 c1t4d0s2 c1t5d0s2#metastat d55 #metastat -i 看进度# metastat -i d0d0: Mirror Submirror 0: d10 State: Okay Submirror 1: d20 State: Resyncing Resync in progress: 19 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 1434384 blocks详见本人网站:/bbs06/dispbbs.asp?boardID=4&ID=4&page=1 本帖最后由 yuhuohu 于 2006-11-17 17:26 编辑 yuhuohu (盘丝大仙) 天使斑竹申请中2楼 发表于 2006-9-27 09:01 metadb命令:建立meta-database-a 建立一个新的meta-database的副本(replica)-f 建立一个初始化meta-database-af 只有刚开始的时候使用-af ,因为此时没有meta-database-c 指定放在每个设备上的副本的数量,默认为1-d 删除指定设备上的副本,删除所有的副本将导致现有的metadevices无法使用metadb -a c0t0d0s2 c0t1d0s2 将在2个磁盘上建立2个副本(一磁盘一个副本)/etc/lvm/mddb.conf:metadevice的状态数据库的每个拷贝的存放位置/etc/lvm/md.tab: 存放metadevice的数据库的工作文件(workspace file),比如内容如下: d7 1 8 c2t1d16s2 c3t0d17s2 c2t1d14s2 c3t0d15s2 c2t1d12s2 c3t0d13s2 c2t1d11s2 c3t0d9s2 -i 32k/kernel/drv/md.conf:本系统所有metadevice的数据库的副本信息,通常也包括SVM的配置信息yuhuohu (盘丝大仙) 天使斑竹申请中3楼 发表于 2006-9-27 09:02 metainit 创建metadevice(动态设备)-f 强行执行metainit命令,即使某一分片(slice)中含有已经mounted的文件系统,或者该分片正在作为swap使用,通常在配置根(/),swap,/usr时使用concat/stripe 指定metadevice的名字,建立metadevice的时候,先指定名字,然后指定该设备由几条组成,每条有几片组成。根据不同的条片组合情况,可以分为以下几种: concatenation(串,即可能单条单片、多条单片), stripe(条:多片) concatenation of stripe(条串:多条多片)numstripes 指定在metadevice中独立的stripe的数量,对于一个简单的stripe来说通常为1,对于一个concatenation来说, numstripes等于slices的数量,对于concatenation of stripes来说,numbtripes随着stripes的数量而变化width 组成一个stripe的slice的数量componet 一个磁盘中对应每一个分片(分区)的逻辑名字,比如/dev/dsk/c0t0d0s2,对于RAID5的metadevice来说,至少需要3个slice分片来分布奇偶信息-i 交替写的数据大小,告诉SVM,在每个metadevice(stripe或者RAID5)的分片上写多少k/m/b后转到另一个分片去写例子:metainit d0根据/etc/lvm/md.conf中关于d0的配置信息去配置d0这个metadevicemetainit -a激活/etc/lvm/md.conf中定义的所有metadevices1.one-on-one的concatenation(即单stripe单slice)#metainit -f d1 1 1 c0t0d0s0 使d1成为一个使用root slice的one-on-one concatenation.#metainit d0 -m d1使镜像设备d0成为one-way mirror(单向镜像)2.Concatenation(多条单片),以下每分片大小可以不一样,可用空间是各分片的和:#metainit d7 4 1 c0t1d0s0 1 c0t2d0s0 1 c0t3d0s0 1 /dev/dsk/c0t4d0s0d7=该metadevice名字4=由4个stripe组成1 c*t*d*s*=每个stripe由1个slice组成,c*t*d*s*为slice的逻辑名字3。stripe(单条多片)# metainit d15 1 2 c0t1d0s2 c0t2d0s2 -i 32kd15这个metadevice包含1个stripe,每个stripe由2个slice组成,交替写数据的大小为32k,默认16k.每片大小必须一样,不然浪费空间,因为条带区的大小算法根据最小的分片来计算。4.Concatentation of Stripes(多条多片)# metainit d75 2 3 c0t1d0s2 c0t2d0s2 c0t3d0s2 -i 16k 3 c1t1d0s2 c1t2d0s2 c1t3d0s2 -i 32k5.mirroring,下面是个two-way mirror的例子# metainit d51 1 1 c0t1d0s2# metainit d52 1 1 c0t2d0s2# metainit d50 -m d51 -m说明是d51作为mirror d50的submirror# metattach d50 d52d51,d52这2个submirror(子镜像)由metainit创建,c0t2d0s2可以比c0t1d0s2大然后通过 init -m d51,创建了一个one-way mirror(单向镜像):d50最后通过metattach d50 d52把第2个submirror d52 attach上来,完成two-way mirror的建立。在建立mirror的时候,可以使用任意条和串的组合( When creatingamirror, any combination of stripes and concatenations can beused. )6. Logging (trans)# metainit d11 1 1 c0t1d0s2# metainit d12 1 1 c0t2d0s2# metainit d21 1 1 c1t1d0s3# metainit d22 1 1 c1t2d0s3# metainit d10 -m d11# metattach d10 d12# metainit d20 -m d21# metattach d20 d22# metainit d1 -t d10 d20最后一个命令:建立了一个d1(trans metadevice,因为使用了-t),使用d10作为主设备(master device),d20用来logging device.8. RAID Level 5# metainit d80 -r c1t0d0s2 c1t1d0s2 c1t3d0s2 -i 20k -r说明是RAID5,-i是交替写的大小9.soft partition 软分区# metainit d1 -p d100 100M# metainit d2 -p d100 100M.# metainit d99 -p d100 100M在建立好的逻辑设备(动态设备d100上)上继续划分分区,每个100M,一共99个分区。10.soft partition on full disk# metainit d1 -p -e c3t4d0 9GbThe following example shows asoftpartitiondevice,d1, built on disk c3t4d0,In this example, the disk is repartitioned and a soft parti-tion is defined to occupy all 9 Gbytes of disk c3t4d0s0.11.hot spare pool热备盘池# metainit hsp001 c2t2d0s2 c3t2d0s2 c1t2d0s2# metainit d41 1 1 c1t0d0s2 -h hsp001# metainit d42 1 1 c3t0d0s2 -h hsp001# metainit d40 -m d41# metattach d40 d42建立了一个hot-spare-pool hsp001,d41和d42都使用hsp001,然后d41和d42组成d40.12.RAID0+1#metainit -f d10 1 2 c0d0s2 c0d1s2#metainit -f d20 1 2 c1d0s2 c1d1s2#metainit -f d0 -m d10#metattach d0 d2012.RAID1+0#metainit -f d10 2 1 c0d0s2 1 c0d1s2#metainit -f d20 2 1 c1d0s2 1 c1d1s2#metainit -f d0 -m d10#metattach d0 d20写数据的时候,同时写c0d0s2和c1d0s2,写满后接着同时写c0d1s2和c1d1s2备注:当mirroring data的时候,可能由于内容数据变化导致写入镜像盘中的数据不同而产生数据不同步,可以在/etc/system中加入以下行:set md_mirror:md_mirror_wow_flg=0x20设置这个flag将导致性能下降。.可用空间上的区别分片情况如下:c0d1s0 c1d0s0 c1d1s01434384blocksc0d1s1 c1d0s1 c1d1s1 392112blocks1 stripe 2slice 按照条带卷的计算方法得出可用空间,由小的分片决定可用空间1434384+392112=783216blocks392112+392112=783216blocks2 strips 1slice 2个条带组合:可用空间为条带卷的空间和1434384+392112=1826496blocks392112+392112= 784224 blocksRAID5:c0d1s1 c1d0s1 c1d1s1 size:783216blocksRAID5:c0d1s0 c0d1s1 c1d0s1 c1d1s1 size:1175328blocks 可用空间约等于最小的分片*(N-1)/Nyuhuohu (盘丝大仙) 天使斑竹申请中4楼 发表于 2006-9-27 09:03 相关补充知识:删除所有的metadevicemetaclear -a对于已经mounted的metadevice,要先umount文件系统,再删除删除metadevice d0metaclear d0换盘,替换坏盘metareplace从mirror(d0)中分离submirror(d10,d20)metadetach d0 d20只显示分区(分片信息)prtvtoc -h /dev/rdsk/c0d0s2mount_option如何指定: 具体见 man mount_ufs or man mount_nfslogging | nologging If logging is specified,thenloggingis enabledforthedurationof the mounted file system.Loggingistheprocessof storingtransactions (changes that make up a complete UFS operation) in alogbefore thetransactionsareapplied to the file system. Once a transaction isstored,the transaction can be applied to the file sys- tem later. This prevents file systemsfrom becominginconsistent, therefore eliminat- ing the need torunfsck. And,because fsckcanbe bypassed, logging reduces the time required torebootasystemifit crashes,orafteranuncleanhalt. The default behavior is nologging. The log is allocated fromfreeblockson the file system, and is sized approximately 1 Mbyte per 1 Gbyte of file system, up to a maximum of64Mbytes.Loggingcanbe enabled on any UFS, including root (/). The logcreated sby UFS logging is continually flushed as it fills up. The log istotally flushedwhenthe file system is unmounted or as a result of the lockfs -f command.prtvtoc/format-partition-printThe data in the Tag column above indicates the type ofpar-tition, as follows:Name NumberUNASSIGNED 0x00BOOT 0x01ROOT 0x02SWAP 0x03USR 0x04BACKUP 0x05STAND 0x06VAR 0x07HOME 0x08ALTSCTR 0x09CACHE 0x0aThe data in the Flags column above indicates how theparti-tion is to be mounted, as follows:Name NumberMOUNTABLE, READ AND WRITE 0x00NOT MOUNTABLE 0x01MOUNTABLE, READ ONLY 0x10The following error shows the same serial number for different disks. Duplicate serial numbers on different disks will result in duplicate device IDs when configuring using SDS commands# metainit -f d11 1 1 /dev/rdsk/c1d0s1metainit: solaris: c1d0s1: overlaps with device in d10通常是因为分片中对cylinder的使用有重叠yuhuohu (盘丝大仙) 天使斑竹申请中UID:53267注册:2003-4-22最后登录: 2007-10-04帖子:1500精华:12 可用积分:1415 信誉积分:135 专家积分:75 (本版)来自:昆仑山狐狸洞状态:.离线. 资料 站内短信 Blog 5楼 发表于 2006-9-27 09:03 metattach和metadetach详细解说功能:metattach, metadetach - attach or detachmetadevicetoorfrom a mirror or trans device, or attach space (blocks) to asoft partition to grow the soft partition除了-h选项,其他选项只有root用户才可以执行1.把一个新分片附加到现有metadevice(d上,然后用growfs命令扩展文件系统# metattach d8 /dev/dsk/c0t1d0s22.从trans-metadevice(d9)中分离logging-device#metadetach d93.扩展一个RAID5-metadevice(d45)# metattach d45 /dev/dsk/c3t0d0s2新的空间将仅仅分配给数据使用,不会存放有新的奇偶块,但是存放在新分片上的数据已经被包含在所有的奇偶校验计算中。因此它不怕单点故障(it is protected against single-device failure)4.扩展软分区(d42增加150M空间)# metattach d42 150M此150M将从分片中任意有效的空间中取出(is taken from any available space on the slice),可能不会和现有的软分区使用的空间连续在一起。5.增加空间到two-way mirror,事后必须用growfs扩展文件系统# metattach d9 /dev/dsk/c0t2d0s5相当于创建一个多条带区设备,每条带只有一个分片# metattach d10 /dev/dsk/c0t3d0s5通过给子镜像(submirror)分别增加一样大小的分片来给two-way mirror增加空间6.从一个镜像(mirror:d4)中分离(metadetach)子镜像(submirror:d2),事后growfs#metadetach d4 d27.附加4个分片到metadevice(d9)# metattach d9 /dev/dsk/c0t1d0s2 /dev/dsk/c0t2d0s2 /dev/dsk/c0t3d0s2 /dev/dsk/c0t4d0s2growfs和lockfs和mkfs详细解说growfs:非破坏性的扩展文件系统扩展空间的常见步骤和说明:一、通过附加新分片给metadevice二、growfs来扩展文件系统给mirror扩展空间时,先给submorror添加一样的新分片,然后使用growfs命令而对于trans-metadevice来说,仅仅是给master-device添加新分片,然后对trans-metadevice使用growfs命令。(也可以给logging-device添加空间,而且不需要使用growfs命令,因为系统会自动识别新加的空间)在growfs进行扩展的时候,会对正在被扩展的文件系统进行写锁定(write-lock,详见lockfs的帮助)。在实施扩展期间,可以访问该文件系统,但是性能可能有点影响。通常我们可以通过实施分阶段扩展来缩短锁定的时间。比如:要把1G的文件系统扩展到2G的话,我们可以使用-s选项指定一次扩展多少个sector的空间,不过每次扩展的空间大小必须是cylinder大小的整数倍,而且不得少于2倍,也就是说至少要1008*2=2016个sector.growfs在扩展时显示的信息和mkfs命令一样如果扩展失败,可以使用umount文件系统和fsck命令来恢复丢失的空间,或者重新指定growfs命令。举例说明1、给非metadevice扩展空间现有分片为:,装载点为/export,实施步骤如下:先把现有分片转换为metadevice(d# metainit -f d8 2 1 c1t0d0s3 1 c2t0d0s3# umount /export修改/etc/vfstab,把/export指向d8(/dev/md/dsk/d,然后实施扩展# mount /export# growfs -M /export /dev/md/rdsk/d82、动态扩展/export文件系统(接上例)# metattach d8 c0t1d0s2# growfs -M /export /dev/md/rdsk/d8通过metattach命令把分片c0t1d0s2动态的串接附加在d8后面,然后指定挂接点/export必须被扩展到裸设备/dev/md/rds
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 天津市南开区2025-2026学年高三上学期期中考试化学试题(含答案)
- 监理员考试试题及答案真题题库
- 碳资产管理师2025《评估》备考题
- 《麻雀》教学设计
- 光电隔离器项目可行性分析报告范文(总投资7000万元)
- 年产xxx全套配件项目可行性分析报告
- 贴片可调电容项目可行性研究报告(总投资7000万元)(34亩)
- 对夹球阀建设项目可行性分析报告(总投资13000万元)
- 学校推行什么管理制度
- 职工健身道具管理制度
- 高空曲臂车安全操作规程
- 2025年粉尘涉爆培训题库及答案
- 厨房消防安全培训课件
- DL-T 1476-2023 电力安全工器具预防性试验规程
- (高清版)DZT 0399-2022 矿山资源储量管理规范
- 智慧售电方案
- 数字化人力资源管理系统建设
- 国有企业投资公司绩效考核管理办法
- 模板支撑系统大样图
- T-CAPDA 006-2020 丙酰芸苔素内酯原药
- 家族财富传承法商
评论
0/150
提交评论