Chinaunix首页 | 论坛 | 博客
  • 博客访问: 241794
  • 博文数量: 33
  • 博客积分: 2070
  • 博客等级: 大尉
  • 技术积分: 615
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-17 19:45
个人简介

好吃懒做

文章分类

全部博文(33)

文章存档

2013年(1)

2012年(1)

2011年(1)

2010年(2)

2009年(8)

2008年(20)

我的朋友

分类:

2008-04-11 11:51:19

Windwosraid玩了不少,今天玩哈Solaris简单的raid。唉!不经意间又多了些口水。共4块盘 分别是c1t0d0s2c1t1d0s2c1t2d0s2c1t3d0s2,其中c1t0d0s2c1t1d0s2做系统盘RAID 1c1t2d0s2c1t3d0s2做数据盘RAID 1

 

1. 先做c1t0d0s2c1t1d0s2,其中c1t0d0s2的分区如下:

     0   /                               20481

     1   swap                            16386      8192

     2   overlap                        139989

     3   /usr                            15363

     4   /var                            20481

     5   /opt                            15363

     6   /app                            51853       60047

     7                                      59

这里说明下分区c1t0d0s7 空间59MB,用作metadb(个人喜好最多给个100MB,好奢侈啊)一般用最后一个分区做metadatebases

 

2. 再做c1t2d0s2c1t3d0s2,其中c1t2d0s2的分区如下:为啥只做c1t2d0s2,唉…..因为c1t2d0s2没分区啊!至少咱弄个metadb出来啊。

partition> m

Select partitioning base:

        0. Current partition table (unnamed)

        1. All Free Hog

Choose base (enter number) [0]? 1

partition> m

Select partitioning base:

        0. Current partition table (a)

        1. All Free Hog

Choose base (enter number) [0]? 1

 

Part      Tag        Flag     Cylinders         Size            Blocks

  0       root       wm       0                0             (0/0/0)             0

  1       swap      wu       0                0              (0/0/0)             0

  2     backup      wu       0 - 14086      136.71GB          (14087/0/0)     286698624

  3     unassigned   wm       0                0             (0/0/0)             0

  4     unassigned   wm       0                0              (0/0/0)             0

  5     unassigned   wm       0                0              (0/0/0)             0

  6        usr      wm       0                0              (0/0/0)             0

  7     unassigned   wm       0                0              (0/0/0)             0

 

Do you wish to continue creating a new partition

table based on above table[yes]?

Free Hog partition[6]? 7

Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]: 14080c

Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]:

Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]:

Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]:

Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]:

Enter size of partition '6' [0b, 0c, 0.00mb, 0.00gb]:

 

Part      Tag    Flag     Cylinders         Size            Blocks

  0       root    wm       0 - 14079      136.64GB    (14080/0/0) 286556160

  1       swap    wu       0                0         (0/0/0)             0

  2     backup    wu       0 - 14086      136.71GB    (14087/0/0) 286698624

  3 unassigned    wm       0                0         (0/0/0)             0

  4 unassigned    wm       0                0         (0/0/0)             0

  5 unassigned    wm       0                0         (0/0/0)             0

  6        usr    wm       0                0         (0/0/0)             0

  7 unassigned    wm   14080 - 14086       69.56MB    (7/0/0)        142464

 

Okay to make this the current partition table[yes]?

Enter table name (remember quotes): a

 

Ready to label disk, continue? y

 

partition> disk

`disk' is not expected.

partition> q

 

 

3. 接着规划并执行4块盘的镜像表

metainit -f d11 1 1 c1t0d0s0

metainit -f d12 1 1 c1t1d0s0

metainit -f d21 1 1 c1t0d0s1

metainit -f d22 1 1 c1t1d0s1

metainit -f d31 1 1 c1t0d0s3

metainit -f d32 1 1 c1t1d0s3

metainit -f d41 1 1 c1t0d0s4

metainit -f d42 1 1 c1t1d0s4

metainit -f d51 1 1 c1t0d0s5

metainit -f d52 1 1 c1t1d0s5

metainit -f d61 1 1 c1t2d0s0

metainit -f d62 1 1 c1t3d0s0

metainit d11…..d62初始化设备

 

 

上面的步骤都准备好了,开始安装吧 :)

4. prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2

  prtvtoc /dev/rdsk/c1t2d0s2 | fmthard -s - /dev/rdsk/c1t3d0s2

t0t1  t2t3

metadevices是工作在块级别的,所以两个所有物理信息一致(几何匹配)。

5. 创建metadb

metadb -afc3 c1t0d0s7

metadb -afc3 c1t1d0s7

metadb -afc3 c1t2d0s7

metadb -afc3 c1t3d0s7

解释下:在每个分片上建立3meta-database,-a 添加,-c 2 数量为3个,-f是第一次建metadb必须的参数,如果有多个disks,可以把数据库分布在多个磁盘上以获得更好的性能和故障冗余

 

查看刚才做的步骤:# metadb

          flags           first blk       block count

     a m  p  luo        16              8192            /dev/dsk/c1t0d0s7

     a    p  luo        8208            8192            /dev/dsk/c1t0d0s7

     a    p  luo        16400           8192            /dev/dsk/c1t0d0s7

     a    p  luo        16              8192            /dev/dsk/c1t1d0s7

     a    p  luo        8208            8192            /dev/dsk/c1t1d0s7

     a    p  luo        16400           8192            /dev/dsk/c1t1d0s7

     a    p  luo        16              8192            /dev/dsk/c1t2d0s7

     a    p  luo        8208            8192            /dev/dsk/c1t2d0s7

     a    p  luo        16400           8192            /dev/dsk/c1t2d0s7

     a    p  luo        16              8192            /dev/dsk/c1t3d0s7

     a    p  luo        8208            8192            /dev/dsk/c1t3d0s7

     a    p  luo        16400           8192            /dev/dsk/c1t3d0s7

我靠!每个分区上还真的建了3份(-afc3),犹豫啥?往下走噻。。。。。。。。

 

6. 执行4块盘初始化

metainit -f d11 1 1 c1t0d0s0

metainit -f d12 1 1 c1t1d0s0

metainit -f d21 1 1 c1t0d0s1

metainit -f d22 1 1 c1t1d0s1

metainit -f d31 1 1 c1t0d0s3

metainit -f d32 1 1 c1t1d0s3

metainit -f d41 1 1 c1t0d0s4

metainit -f d42 1 1 c1t1d0s4

metainit -f d51 1 1 c1t0d0s5

metainit -f d52 1 1 c1t1d0s5

metainit -f d61 1 1 c1t2d0s0

metainit -f d62 1 1 c1t3d0s0

metainit d11…..d62初始化设备

 

7. disk0disk1disk2disk3结合在一起。建立以下的镜像设备和成员(d10表示slice0raid-device,d11表示d10的成员1):

metainit d10 -m d11

metainit d20 -m d21

metainit d30 -m d31

metainit d40 -m d41

metainit d50 -m d51

metainit d60 -m d61

做完上述配置后,像已经单项匹配了disk0c1t0d0s2

8.做完步骤“7了,啥?心里没底?那就验证下噻:以下3ok,看看d62:呢,是这个样子d62: Concat/Stripe,说明真的单项匹配哦!哈哈………

# metastat | more

d60: Mirror                 1.这里已经mirror

    Submirror 0: d61       2.子镜像d61

      State: Okay        

    Pass: 1

    Read option: roundrobin (default)

    Write option: parallel (default)

    Size: 286556160 blocks (136 GB)

 

d61: Submirror of d60     3.d61包含在d60里,状态OKAY

    State: Okay        

    Size: 286556160 blocks (136 GB)

    Stripe 0:

        Device     Start Block  Dbase        State Reloc Hot Spare

        c1t2d0s0          0     No            Okay   Yes

 

 

d50: Mirror

    Submirror 0: d51

      State: Okay        

    Pass: 1

    Read option: roundrobin (default)

    Write option: parallel (default)

    Size: 76808448 blocks (36 GB)

 

d51: Submirror of d50

    State: Okay        

    Size: 76808448 blocks (36 GB)

    Stripe 0:

        Device     Start Block  Dbase        State Reloc Hot Spare

        c1t0d0s5          0     No            Okay   Yes

 

 

d40: Mirror

    Submirror 0: d41

      State: Okay        

    Pass: 1

    Read option: roundrobin (default)

    Write option: parallel (default)

    Size: 83890944 blocks (40 GB)

 

d41: Submirror of d40

    State: Okay        

    Size: 83890944 blocks (40 GB)

    Stripe 0:

        Device     Start Block  Dbase        State Reloc Hot Spare

        c1t0d0s4          0     No            Okay   Yes

 

 

d30: Mirror

    Submirror 0: d31

      State: Okay        

    Pass: 1

    Read option: roundrobin (default)

    Write option: parallel (default)

    Size: 41945472 blocks (20 GB)

 

d31: Submirror of d30

    State: Okay        

    Size: 41945472 blocks (20 GB)

    Stripe 0:

        Device     Start Block  Dbase        State Reloc Hot Spare

        c1t0d0s3          0     No            Okay   Yes

 

 

d10: Mirror

    Submirror 0: d11

      State: Okay        

    Pass: 1

    Read option: roundrobin (default)

    Write option: parallel (default)

    Size: 41945472 blocks (20 GB)

 

d11: Submirror of d10

    State: Okay        

    Size: 41945472 blocks (20 GB)

    Stripe 0:

        Device     Start Block  Dbase        State Reloc Hot Spare

        c1t0d0s0          0     No            Okay   Yes

 

 

d20: Mirror

    Submirror 0: d21

      State: Okay        

    Pass: 1

    Read option: roundrobin (default)

    Write option: parallel (default)

    Size: 41945472 blocks (20 GB)

 

d21: Submirror of d20

    State: Okay        

    Size: 41945472 blocks (20 GB)

    Stripe 0:

        Device     Start Block  Dbase        State Reloc Hot Spare

        c1t0d0s1          0     No            Okay   Yes

 

 

d62: Concat/Stripe

    Size: 286556160 blocks (136 GB)

    Stripe 0:

        Device     Start Block  Dbase   Reloc

        c1t3d0s0          0     No      Yes

 

d52: Concat/Stripe

    Size: 76808448 blocks (36 GB)

    Stripe 0:

        Device     Start Block  Dbase   Reloc

        c1t1d0s5          0     No      Yes

 

d42: Concat/Stripe

    Size: 83890944 blocks (40 GB)

    Stripe 0:

        Device     Start Block  Dbase   Reloc

        c1t1d0s4          0     No      Yes

 

d32: Concat/Stripe

    Size: 41945472 blocks (20 GB)

    Stripe 0:

        Device     Start Block  Dbase   Reloc

        c1t1d0s3          0     No      Yes

 

d22: Concat/Stripe

    Size: 41945472 blocks (20 GB)

    Stripe 0:

        Device     Start Block  Dbase   Reloc

        c1t1d0s1          0     No      Yes

 

d12: Concat/Stripe

    Size: 41945472 blocks (20 GB)

    Stripe 0:

        Device     Start Block  Dbase   Reloc

        c1t1d0s0          0     No      Yes

 

Device Relocation Information:

Device   Reloc  Device ID

c1t3d0   Yes    id1,ssd@n500000e0156bad40

c1t2d0   Yes    id1,ssd@n500000e0156b90c0

c1t1d0   Yes    id1,ssd@n500000e01569e7a0

c1t0d0   Yes    id1,ssd@n500000e0156b5760

 

9. 指定系统使用metadevices,指定根文件系统:

#metaroot d10

 

10.编辑vfstab

# vi /etc/vfstab

root@bb # vi /etc/vfstab

#device         device          mount           FS      fsck    mount   mount

#to mount       to fsck         point           type    pass    at boot options

#

fd      -       /dev/fd fd      -       no      -

/proc   -       /proc   proc    -       no      -

/dev/dsk/c1t0d0s1       -       -       swap    -       no      -

/dev/md/dsk/d10 /dev/md/rdsk/d10        /       ufs     1       no      -

/dev/dsk/c1t0d0s3       /dev/rdsk/c1t0d0s3      /usr    ufs     1       no

-

/dev/dsk/c1t0d0s4       /dev/rdsk/c1t0d0s4      /var    ufs     1       no

-

/dev/dsk/c1t0d0s6       /dev/rdsk/c1t0d0s6      /app    ufs     2       yes

-

/dev/dsk/c1t0d0s5       /dev/rdsk/c1t0d0s5      /opt    ufs     2       yes

 

改过的表如下:注意因为d60是新增的,所以mount at boot要设置“yes”要不然下次机器启动会丢失,避免手动mount

root@SCSC-MON-20-MOB # vi vfstab

#device         device          mount           FS      fsck    mount   mount

#to mount       to fsck         point           type    pass    at boot options

#

fd      -       /dev/fd fd      -       no      -

/proc   -       /proc   proc    -       no      -

/dev/md/dsk/d20 -       -       swap    -       no      -

/dev/md/dsk/d10 /dev/md/rdsk/d10        /       ufs     1       no      -

/dev/md/dsk/d30 /dev/md/rdsk/d30        /usr    ufs     1       no      -

/dev/md/dsk/d40 /dev/md/rdsk/d40        /var    ufs     1       no      -

/dev/md/dsk/d50 /dev/md/rdsk/d50        /opt    ufs     2       yes     -

/dev/md/dsk/d60 /dev/md/rdsk/d60        /data   ufs     2       yes     -

/devices        -       /devices        devfs   -       no      -

 

11. 如果镜像的所有子镜像(请注意是所有子镜像)都没创建文件系统,在mounted之前必须:newfs /dev/md/dsk/d11

 

12. # lockfs –fa   # sync    #reboot

启动后会有类似以下的一些错误信息,不用管它,因为我们还没完成raid-devices的操作:
forceload of misc/md_trans failed
forceload of misc/md_raid failed
forceload of misc/md_hotspares failed
,把另外一半弄上来就没了。

 

13.再匹配另外一半

#metattach d10 d12

#metattach d20 d22

#metattach d30 d32

#metattach d40 d42

#metattach d50 d52

#metattach d60 d62

 

速度有点慢哦!别以为死机了,乱敲一堆键盘。哈哈   好了,剩下的看看状态和看看同步的%比吧,#metastat more   #metastat |grep %

好累!睡觉……….

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