Chinaunix

标题: 命令行创建RAID5(非常感谢前人的工作!) [打印本页]

作者: zhumao    时间: 2006-10-16 17:18
标题: 命令行创建RAID5(非常感谢前人的工作!)
1.建立分区表
partition> p
Current partition table (original):
Total disk cylinders available: 4924 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm      18 - 4690        8.00GB    (4673/0/0) 16780743
  1 unassigned    wu       0               0         (0/0/0)           0
  2 unassigned    wm       0               0         (0/0/0)           0
  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 unassigned    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0 -   17       31.56MB    (18/0/0)      64638

2.传送分区表参数到其他硬盘
prtvtoc /dev/rdsk/c0t0d0s0|fmthard -s- /dev/rdsk/c0t1d0s0
prtvtoc /dev/rdsk/c0t0d0s0|fmthard -s- /dev/rdsk/c0t2d0s0
prtvtoc /dev/rdsk/c0t0d0s0|fmthard -s- /dev/rdsk/c0t3d0s0
prtvtoc /dev/rdsk/c0t0d0s0|fmthard -s- /dev/rdsk/c0t4d0s0
prtvtoc /dev/rdsk/c0t0d0s0|fmthard -s- /dev/rdsk/c0t5d0s0

3.建立metadb
metadb -a -f -c 3 c0t0d0s7 c0t1d0s7 c0t2d0s7

4.建立raid5(5 disks)
metainit d10 -r c0t0d0s0 c0t1d0s0 c0t2d0s0 c0t3d0s0 c0t4d0s0

5.建立HSP
metainit hsp001 c0t5d0s0

6.增加HSP到raid
metaparam -h hsp001 d10

7.验证
# metastat
d10: RAID
    State: Initializing
    Initialization in progress: 31.8% done
    Hot spare pool: hsp001
    Interlace: 32 blocks
    Size: 67119381 blocks (32 GB)
Original device:
    Size: 67121536 blocks (32 GB)
        Device     Start Block  Dbase        State Reloc  Hot Spare
        c0t0d0s0        330        No Initializing   Yes
        c0t1d0s0        330        No Initializing   Yes
        c0t2d0s0        330        No Initializing   Yes
        c0t3d0s0        330        No Initializing   Yes
        c0t4d0s0        330        No Initializing   Yes

hsp001: 1 hot spare
        Device     Status      Length   Reloc
        c0t5d0s0   Available    16780743 blocks Yes

Device Relocation Information:
Device   Reloc  Device ID
c0t5d0   Yes    id1,ssd@w20000020370984af
c0t0d0   Yes    id1,ssd@w2000002037146e50
c0t1d0   Yes    id1,ssd@w2000002037146b7e
c0t2d0   Yes    id1,ssd@w2000002037146dff
c0t3d0   Yes    id1,ssd@w2000002037146c22
c0t4d0   Yes    id1,ssd@w20000020370d7dc5

8.投入使用
#newfs /dev/md/rdsk/d10
newfs: construct a new file system /dev/md/rdsk/d10: (y/n)? y
Warning: 1 sector(s) in last cylinder unallocated
/dev/md/rdsk/d10:       67119380 sectors in 18691 cylinders of 27 tracks, 133 sectors
        32773.1MB in 1169 cyl groups (16 c/g, 28.05MB/g, 3392 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 57632, 115232, 172832, 230432, 288032, 345632, 403232, 460832, 518432,
Initializing cylinder groups:
.......................
super-block backups for last 10 cylinder groups at:
66592544, 66650144, 66707744, 66765344, 66822944, 66880544, 66938144,
66995744, 67053344, 67110944,
#mkdir /raid5
#vi /etc/vfstab
添加一行:
/dev/md/dsk/d10 /dev/md/rdsk/d10 /raid5 ufs 2 yes -
#reboot(OR mount /dev/md/dsk/d10 /raid5)

9.维护RAID5(未测试)
坏掉一个盘的恢复方法(例c0t1d0盘坏掉)
ok boot -r
#metareplace -e d10 c0t1d0s0
#metastat d10
10.操作环境
1)硬件Sun E3000 + A5200
2)系统Solaris 9

[ 本帖最后由 zhumao 于 2006-10-18 08:31 编辑 ]
作者: C.Arthur    时间: 2006-10-16 17:31
很规范,UP一下




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2