阅读提示:本文档以SUN Fire V880 Server(6*73GB Dsik)为例讲解在Solarsi8下使用命令行的方式安装及维护RAID1和RAID5。
以SUN Fire V880 Server(6*73GB Dsik)为例讲解在Solarsi8下使用命令行的方式安装及维护RAID1和RAID5。本文档内容都经本人实践验证过,但对于不同机型仅供参考。
Disk分布情况:
0:c1t0d0 1:c1t1d0 2:c1t2d0 3:c1t3d0 4:c1t4d0 5:c1t5d0 |
注:0,1做镜像;2,3,4,5做RAID5
系统盘(c1t0d0)分区及镜像盘(c1t1d0)情况:
c1t0d0s0(d10) d0 c1t1d0s0(d20) / 1024M c1t0d0s1(d11) d1 c1t1d0s1(d21) swap 8192M c1t0d0s2 c1t1d0s2 overlap 69999M c1t0d0s3(d13) d3 c1t1d0s3(d23) /usr 4096M c1t0d0s4(d14) d4 c1t1d0s4(d24) /opt 10240M c1t0d0s5(d15) d5 c1t1d0s5(d25) /var 2048M c1t0d0s6(d16) d6 c1t1d0s6(d26) /home free c1t0d0s7 c1t1d0s7 /metaDB 30M |
系统安装完成后,使用Solarsi8 software 2 of 2安装DiskSuite_4.2.1软件,安装路径:/cdrom/cdrom0/Solaris_8/EA/installer & 选择默认安装就可以。
用root用户登陆,运行以下命令:
#prtvtoc /dev/rdsk/c1t0d0s2|fmthard –s – /dev/rdsk/c1t1d0s2 fmthard:New volume table of contents now in place |
上面命令将第二块硬盘(c1t1d0)的文件分区表调整为和引导盘一致。
#umount /metaDB #rm –r /metaDB #vi /etc/vfstab |
将下面这行注释掉或删除,如下:
#/dev/dsk/c1t0d0s7 /dev/rdsk/c1t0d0s7 /metaDB ufs 1 yes – |
一、RAID1
对各个分区逐一作镜像:
①先生成replicas,这是DiskSuite内部用的。
#metadb –a –f –c 3 c1t0d0s7 c1t1d0s7 #metadb |
②Creating a mirror from swap
#metainit –f d11 1 1 c1t0d0s1 #metainit d21 1 1 c1t1t0s1 #metainit d1 –m d11 #vi /etc/vfstab /dev/dsk/c1t0d0s1 - - swap – no – should be changed to: /dev/md/dsk/d1 - - swap – no - #reboot #metattach d1 d21 |
③Creating a mirror from /usr
#metainit –f d13 1 1 c1t0d0s3 #metainit d23 1 1 c1t1t0s3 #metainit d3 –m d13 #vi /etc/vfstab /dev/dsk/c1t0d0s3 /dev/rdsk/c1t0d0s3 /usr ufs 1 yes – should be changed to: /dev/md/dsk/d3 /dev/md/rdsk/d3 /usr ufs 1 yes – #reboot #metattach d3 d23 |
④Creating a mirror from /opt
#metainit –f d14 1 1 c1t0d0s4 #metainit d24 1 1 c1t1t0s4 #metainit d4 –m d14 #vi /etc/vfstab /dev/dsk/c1t0d0s4 /dev/rdsk/c1t0d0s4 /opt ufs 1 yes – should be changed to: /dev/md/dsk/d4 /dev/md/rdsk/d4 /opt ufs 1 yes – #reboot #metattach d4 d24 |
⑤Creating a mirror from /var
#metainit –f d15 1 1 c1t0d0s5 #metainit d25 1 1 c1t1t0s5 #metainit d5 –m d15 #vi /etc/vfstab /dev/dsk/c1t0d0s5 /dev/rdsk/c1t0d0s5 /var ufs 1 yes – should be changed to: /dev/md/dsk/d5 /dev/md/rdsk/d5 /var ufs 1 yes – #reboot #metattach d5 d25 |
⑥Creating a mirror from /home
c1t0d0s0(d10) d0 c1t1d0s0(d20) / 1024M c1t0d0s1(d11) d1 c1t1d0s1(d21) swap 8192M c1t0d0s2 c1t1d0s2 overlap 69999M c1t0d0s3(d13) d3 c1t1d0s3(d23) /usr 4096M c1t0d0s4(d14) d4 c1t1d0s4(d24) /opt 10240M c1t0d0s5(d15) d5 c1t1d0s5(d25) /var 2048M c1t0d0s6(d16) d6 c1t1d0s6(d26) /home free c1t0d0s7 c1t1d0s7 /metaDB 30M |
⑦Creating a mirror from /
c1t0d0s0(d10) d0 c1t1d0s0(d20) / 1024M c1t0d0s1(d11) d1 c1t1d0s1(d21) swap 8192M c1t0d0s2 c1t1d0s2 overlap 69999M c1t0d0s3(d13) d3 c1t1d0s3(d23) /usr 4096M c1t0d0s4(d14) d4 c1t1d0s4(d24) /opt 10240M c1t0d0s5(d15) d5 c1t1d0s5(d25) /var 2048M c1t0d0s6(d16) d6 c1t1d0s6(d26) /home free c1t0d0s7 c1t1d0s7 /metaDB 30M |
#metastat (检查镜像进度)
镜像完成后,还需作如下操作:
修改EEPROM
ok devalias(察看启动设备)
ok nvalias rootdisk /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@0,0
ok nvalias mirrdisk /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@1,0
ok setenv boot-device rootdisk mirrdisk
eeprom命令:
boot-device=rootdisk mirrdisk
boot-device=rootdisk mirrdisk
use-nvramrc?=true
nvramrc=devalias mirrdisk /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@1,0
devalias rootdisk /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@0,0
#ls -l c1t0d0s0
lrwxrwxrwx 1 root root 70 1月 2 10:45 c1t0d0s0 -> ../../devices/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000000870e80e7,0:a
对应:/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@0,0
root@voiplnjvr4 # ls -l c1t1d0s0
lrwxrwxrwx 1 root root 70 1月 2 10:45 c1t1d0s0 -> ../../devices/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000000870fb287,0:a
对应:/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@1,0
测试:
ok boot rootdisk 系统启动正常。
ok boot mirrordisk 系统启动正常。
假如c1t0d0盘坏掉,则停机更换硬盘后需做恢复工作,如下;
c1t0d0s0(d10) d0 c1t1d0s0(d20) / 1024M c1t0d0s1(d11) d1 c1t1d0s1(d21) swap 8192M c1t0d0s2 c1t1d0s2 overlap 69999M c1t0d0s3(d13) d3 c1t1d0s3(d23) /usr 4096M c1t0d0s4(d14) d4 c1t1d0s4(d24) /opt 10240M c1t0d0s5(d15) d5 c1t1d0s5(d25) /var 2048M c1t0d0s6(d16) d6 c1t1d0s6(d26) /home free c1t0d0s7 c1t1d0s7 /metaDB 30M |
二、RAID5
c1t0d0s0(d10) d0 c1t1d0s0(d20) / 1024M c1t0d0s1(d11) d1 c1t1d0s1(d21) swap 8192M c1t0d0s2 c1t1d0s2 overlap 69999M c1t0d0s3(d13) d3 c1t1d0s3(d23) /usr 4096M c1t0d0s4(d14) d4 c1t1d0s4(d24) /opt 10240M c1t0d0s5(d15) d5 c1t1d0s5(d25) /var 2048M c1t0d0s6(d16) d6 c1t1d0s6(d26) /home free c1t0d0s7 c1t1d0s7 /metaDB 30M |
RAID5坏掉一个盘的恢复方法:
例c1t4d0盘坏掉,更换坏硬盘后作如下工作:
c1t0d0s0(d10) d0 c1t1d0s0(d20) / 1024M c1t0d0s1(d11) d1 c1t1d0s1(d21) swap 8192M c1t0d0s2 c1t1d0s2 overlap 69999M c1t0d0s3(d13) d3 c1t1d0s3(d23) /usr 4096M c1t0d0s4(d14) d4 c1t1d0s4(d24) /opt 10240M c1t0d0s5(d15) d5 c1t1d0s5(d25) /var 2048M c1t0d0s6(d16) d6 c1t1d0s6(d26) /home free c1t0d0s7 c1t1d0s7 /metaDB 30M |
卸去RAID5的方法:
c1t0d0s0(d10) d0 c1t1d0s0(d20) / 1024M c1t0d0s1(d11) d1 c1t1d0s1(d21) swap 8192M c1t0d0s2 c1t1d0s2 overlap 69999M c1t0d0s3(d13) d3 c1t1d0s3(d23) /usr 4096M c1t0d0s4(d14) d4 c1t1d0s4(d24) /opt 10240M c1t0d0s5(d15) d5 c1t1d0s5(d25) /var 2048M c1t0d0s6(d16) d6 c1t1d0s6(d26) /home free c1t0d0s7 c1t1d0s7 /metaDB 30M |
注释此行:
c1t0d0s0(d10) d0 c1t1d0s0(d20) / 1024M c1t0d0s1(d11) d1 c1t1d0s1(d21) swap 8192M c1t0d0s2 c1t1d0s2 overlap 69999M c1t0d0s3(d13) d3 c1t1d0s3(d23) /usr 4096M c1t0d0s4(d14) d4 c1t1d0s4(d24) /opt 10240M c1t0d0s5(d15) d5 c1t1d0s5(d25) /var 2048M c1t0d0s6(d16) d6 c1t1d0s6(d26) /home free c1t0d0s7 c1t1d0s7 /metaDB 30M |