Chinaunix首页 | 论坛 | 博客
  • 博客访问: 365522
  • 博文数量: 78
  • 博客积分: 3274
  • 博客等级: 中校
  • 技术积分: 686
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-06 12:47
文章分类

全部博文(78)

文章存档

2017年(1)

2016年(2)

2015年(2)

2014年(1)

2013年(5)

2012年(22)

2011年(8)

2010年(31)

2009年(6)

分类:

2012-12-05 01:33:27

 

                                                         文档作者:白一峰

 

一. 环境描述:

1.  硬件:Sun’s workstation or server

          Sun’s storage ,array or mutipack

 2.        软件:Solaris 2.6,7,8

Sun’s Disksuite software

 

二. 如何制做及确认RAID 0、RAID1、RAID0+1、RAID5、及HOT SPARE

1. 如何制做及确认RAID 0

     How to create a concatenated metadevice

特性:不安全模式,若有一块盘坏,整个卷就被破坏了。

# metainit device height width component(s) width component(s) width component(s) …..

note: metainit--------------command

    device---------------metadevice name in the form d###(d0-127 by the default)

    height---------------number of stripes in the concat metadevice

    width----------------number of slice within the stripe

    component(s)------which physical slice(s) comprise the stripe

For explame:

# metainit d0 1 1 /dev/dsk/c0t0d0s3

This create concatenate metadevice d0 out of a signal partition /dev/dsk/c0t0ed0s3

# metainit d1 2 1 /dev/dsk/c0t0d0s1 1 /dev/dsk/c0t0d0s5

This create concatenate metadevice d1 out of two slices,/dev/dsk/c0t0d0s1 and /dev/dsk/c0t0d0s5.

制作完成后,可以用metastat命令察看结果和Raid级别。

# metastat d0

# metastat d1

     How to create a stripe metadevice

# metainit device height width component component …..-i interlace

For example:

# metainit d2 1 2 /dev/dsk/c0t0d0s4 /dev/dsk/c0t0d0s5 –i 32k

note: This create striped metadevice d2 out of two slices: /dev/dsk/c0t0d0s4 and /dev/dsk/c0t0d0s5. The metadevice use the interlace value of 32Kbytes.

制作完成后,可以用metastat命令察看结果和Raid级别。

# metastat d2

  2.   如何制做及确认RAID 1

特性:安全模式,但是浪费硬盘空间。

Create a two-way metamirror using the metainit command

# metainit metadevice –m concatenate-1 concatenate-2

For example:

# metainit /dev/md/dsk/d3 –m /dev/md/dsk/d4 /dev/md/dsk/d5

制作完成后,可以用metastat命令察看结果和Raid级别。

# metastat d3 

  3.  如何制做及确认RAID 0+1

   特性:安全模式,但是浪费硬盘空间。

   制作过程:

a.       先建两个submirror

b.       把一个submirror先加入mirror

c.       在把另一个submirror加入mirror

d.       mirror建立完成。

For example:

# metainit d6 1 1 /dev/dsk/c0t0d0s5

# metainit d7 1 1 /dev/dsk/c0t1d0s6

# meatinit d8 –m d6

# metattach d8 d7

此例子中,每个submirror中只有一个component,也可以在每个submirror中建立多个component.

For example:

# metainit d9 3 1 /dev/dsk/c0t0d0s0 2 /dev/dsk/c0t0d0s3 /dev/dsk/c0t0d0s4 1 /dev/dsk/c0t0d0s5

# metainit d10 3 1 /dev/dsk/c0t1d0s0 2 /dev/dsk/c0t1d0s3 /dev/dsk/c0t1d0s4 1 /dev/dsk/c0t1d0s5

# metainit d11 –m d9

# metattach d11 d10

制作完成后,可以用metastat命令察看结果和Raid级别。

# metastat d6

# metastat d11

  4.  如何制做及确认RAID5

How to create a Raid5 metadevice

# metainit metadevice –r comp1 comp2 comp3 …..-i interlace

For example:

# metainit /dev/md/dsk/d12 –r /dev/dsk/c0t0d0s3 /dev/dsk/c0t0d0s4 /dev/dsk/c0t0d0s5 –i 8k

This creates a Raid-5 metadevice(d12) with an interlace of 8Kbytes across three components : /dev/dsk/c0t0d0s3 /dev/dsk/c0t0d0s4 /dev/dsk/c0t0d0s5.

制作完成后,可以用metastat命令察看结果和Raid级别。

# metastat d12

 

三. 如何更换RAID 5 volume 中的坏硬盘

使用命令: metareplace

# metareplace  metadevice  component_old  component_new

For example:

# metareplace d13 c0t0d0s6 c0t0d0s6

# metareplace d13 c0t0d0s5 c0t0d0s7

note: component_oldcomponent_new可以是同一个slice,也可以是不同的slice.

 

四. 如何更换 RAID 0+1 volume中的坏硬盘

a)         metareplace命令

# metareplace metadevice component_old component_new

For example:

#metareplace d14 c0t0d0s5 c0t0d0s5

若以上方法不行,可以用第二种方法。

b)        比如d15mirror,d16d17是两个submirror. 假如d17.

# metadetach d15 d17

#metaclear d17

以上两步操作是把坏的submirror删除掉.把新的硬盘更换上,分好区,在把submirror恢复.

# metainit d17 1 1 /dev/dsk/c0t0d0s5

# metattach d15 d17

这样就把submirror(d17)重新加入到mirror(15)中了.

制作完成后,可以用metastat命令察看结果和Raid级别。

# metastat d15

 

五. 如何在线扩充RAID 5 volume 的容量

运行metastat命令查看Raid中所有设备的状态,确认所有硬盘的状态是OK的。

用下面的命令查看:

      #/usr/opt/SUNWmd/sbin/metastat d10     

  Raid5的状态是stable,则使用metattach命令将新的slice加入到这个metadevice中。

用下面的命令实现:

      # /usr/opt/SUNWmd/sbin/metattach d10 /dev/dsk/c5t0d0s2     

    新加入的这个slice一定要与Raid5中的其他slice大小一致,若此slice的容量比其他的slice大,则多余的空间就浪费掉了。

  当新加入的组件在做初始化时,可以用metastat命令查看其状态。当初始化完成时,即状态由initializing变成OKRaid就可以重新使用了。

      # /usr/opt/SUNWmd/sbin/metastat d10

使用growfs命令来挂接文件系统。

      # growfs /dev/md/rdsk/d10 -M /test

   /test是挂接点。

.如何制作用于双机系统的DISKSET,及DISKSET 模式下的各种RAID

结构的制作与维护,及DISKSET在双机系统之间的切换操作

  两台主机分别安装操作系统及推荐的patch

     两主机均留出一个供metadb使用的小分区。

正确连接主机及阵列后,

     更改其中一台主机的scsi-initiator-id,另一台先不开机

     方法如下:进入ok状态下

     ok setenv  auto-boot?  True

     ok reset-all

     ok probe-scsi-all  记录显示的阵列中控制器的物理路径,/pci@4,4000/scsi@3,1,以下以此为例

     ok nvedit

         0:probe-all  install-console  banner

      1:cd  /pci@4,4000/scsi@3

      2:6    scsi-initiator-id”  integer-property   scsi-initiator-id改为6

      3:device-end

      4:cd  /pci@4,4000/scsi@3,1

      5: 6    scsi-initiator-id”  integer-property

      6:device-end

      7:banner  (ctrl+c)

     ok nvstore

     ok setenv  use-nvramrc?  True

     ok setenv  auto-boot?   True

     ok reset-all

   至此,两台主机可同时开机进入操作系统。用format 命令可分别看到9块硬盘,且保证阵列上的8块硬盘在两台主机上的物理路径名与逻辑设备名完全相同。

在两台主机上分别建立metadb,其中仅包含本主机内置硬盘内予留小分区,以保证下一步制做共享的diskset.

在每台主机上的/etc/hosts 文件中添入对方的IP及主机名,同时创建/.rhosts 文件,文件内容为加号(+)。

在其中一台主机上建立共享的DiskSet

#metaset  –s  diskset-name  –a  –h  hostname1  hostname2

diskset-name  建立的DiskSet的名称

hostname1  hostname2 应与 /etc/nodename  相同

-a -h 参数将DiskSet 映射到两台主机上。

将共享的8块硬盘加入DiskSet

# metaset  –s  diskset-name  –a  drivername 。。。

drivername 要加入的硬盘,格式为c?t?d? 。

完成以上步骤后,即可使用metatool –s diskset-name & 图形工具来建RAID,不用在建立metadb,Diskset自己会建立metadb

#newfs  /dev/md/diskset-name/rdsk/d0

 d0为metatool DISKSET上建立的RAID

要切换DISKSET

# metaset  –s  diskset-name   –r

一台主机放弃对阵列的管理

# metaset  –s  diskset-name  –f  –t

另一台主机接管阵列

阅读(541) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~