1、HP Z400 S10镜像+硬盘维护solaris 10 x86(Z400)镜像步骤前提:系统分区如下:(分区顺序编号如不一样,后面参数会有改变)0 / 10240 /根区1 /var 4096 / 存放日志文件3 swap 8192 /内存2倍4 /(不需要)5 /opt 6000 /存放用户执行文件6 /export/home /剩余7 /svm 50 / 磁盘镜像用,类似于交换空间镜像名称d0d1d3d5d6D7源盘子镜像名d10d11d13d15d16d17镜像盘子镜像名d20d21d23d25d26d27挂载点/varswap/opt/export/home/svm分区序号cxdxs
2、0cxdxs1cxdxs3cxdxs5cxdxs6cxdxs7RAID 1,镜象磁盘阵列。同时对2个或多个硬盘读写(同样的数据)。RAID1具有最高的安全性,但只有一半的磁盘空间被用来存储数据。主要用在对数据安全性要求很高,而且要求能够快速恢复被损坏的数据的场合。1. 首先确认系统中有两块硬盘 # format Searching for disks.done AVAILABLE DISK SELECTIONS: 0. c0d0 /pci0,0/pci-ide7,1/ide0/cmdk0,0 1. c0d1 /pci0,0/pci-ide7,1/ide0/cmdk1,0 Specify dis
3、k (enter its number): C注:由于HP机器另一个盘默认安装的是SElinux,与标准安装格式看到的有区别,需要重新分区另个盘。# formatAVAILABLE DISK SELECTIONS: 0. c0d0 /pci0,0/pci-ide1f,2/ide0/cmdk0,0 1. c1d0 /pci0,0/pci-ide1f,2/ide1/cmdk0,0Specify disk (enter its number):操作如下:Format ,1,0, p,报WARNING - This disk may be in use by an application that h
4、as modified the fdisk table. Ensure that this disk is not currently in use before proceeding to use fdisk.删除分区,继续操作 输入fdisk Total disk size is 60800 cylinders Cylinder size is 16065 (512 byte) blocks Cylinders Partition Status Type Start End Length % = = = = = = = 1 Linux native 0 60801 60802 100SEL
5、ECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration)Enter Selection: 选择 3 ,1,5 ,yes,然后再用p看一下分区是否已经删除
6、再format看一下分区:fdisk,y可能需要确认一下。2. 正常情况下看到的两个盘的分区如下第一个盘(已分区) partition pPart Tag Flag Cylinders Size Blocks 0 root wm 2353 - 3658 10.00GB (1306/0/0) 20980890 1 var wm 3 - 525 4.01GB (523/0/0) 8401995 2 backup wm 0 - 60796 465.73GB (60797/0/0) 976703805 3 swap wu 1308 - 2352 8.01GB (1045/0/0) 16787925 4
7、 unassigned wm 0 0 (0/0/0) 0 5 unassigned wm 543 - 1307 5.86GB (765/0/0) 12289725 6 home wm 3659 - 60796 437.70GB (57138/0/0) 917921970 7 unassigned wm 536 - 542 54.91MB (7/0/0) 112455 8 boot wu 0 - 0 7.84MB (1/0/0) 16065 9 alternates wu 1 - 2 15.69MB (2/0/0) 32130第二个盘(未分区) 0 unassigned wm 0 0 (0/0/
8、0) 0 1 unassigned wm 0 0 (0/0/0) 0 2 backup wu 0 - 60796 465.73GB (60797/0/0) 976703805 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 0 (0/0/0) 0 8 boot wu 0 - 0 7.84MB (1/0/0) 16065 9 alternates wm 1 - 2 15.
9、69MB (2/0/0) 321303.在第二个盘上设置相同分区 prtvtoc /dev/rdsk/c0d0s2 /tmp/c0d0s2.toc fmthard -s /tmp/c0d0s2.toc /dev/rdsk/c1d0s2fmthard: New volume table of contents now in place.4. 确认哪些分区需要做镜像: # egrep ufs|swap /etc/vfstab|grep /dev/dsk/dev/dsk/c0d0s3 - - swap - no -/dev/dsk/c0d0s0 /dev/rdsk/c0d0s0 / ufs 1 no
10、 -/dev/dsk/c0d0s1 /dev/rdsk/c0d0s1 /var ufs 1 no -/dev/dsk/c0d0s6 /dev/rdsk/c0d0s6 /export/home ufs 2 yes /dev/dsk/c0d0s5 /dev/rdsk/c0d0s5 /opt ufs 2 yes -/dev/dsk/c0d0s7 /dev/rdsk/c0d0s7 /svm ufs 2 yes -5.卸载/svm分区#umount /svm(必须的)6. 制作metadb数据: # metadb -a -f -c 2 c0d0s7 c1d0s7metadb命令的各参数含义如下: -a:
11、增加metadb; -f:建立初始化的metadb(如果是新建,需要-a -f连用); -c:指定创建metadb备份的数目,如-c 3,表示建立3个metadb,不指定默认1; -i:查询现有的metadb信息,备份数量及状态等; -d:删除metadb。7. 制作各个分区的子镜像 # metainit -f d10 1 1 c0d0s0 d10: Concat/Stripe is setup # metainit -f d11 1 1 c0d0s1 d11: Concat/Stripe is setup# metainit -f d13 1 1 c0d0s3# metainit -f d1
12、5 1 1 c0d0s5# metainit -f d16 1 1 c0d0s6# metainit -f d17 1 1 c0d0s78.制作各个分区的镜像盘 # metainit d0 -m d10 d0: Mirror is setup # metainit d1 -m d11 d1: Mirror is setup# metainit d3 -m d13# metainit d5 -m d15# metainit d6 -m d16# metainit d7 -m d17 9. 标示D0为启动分区(不要遗忘,否则系统起不来)# metaroot d0 10.加入镜像标示 # echo
13、set md:mirrored_root_flag=1 /etc/system直接手动在这个文件中最后vi增加一行11. 检查新建的设备: # ls -l /dev/md/rdsk总数 24lrwxrwxrwx 1 root root 36 10月 27日 11:13 d0 - ./././devices/pseudo/md0:0,0,rawlrwxrwxrwx 1 root root 36 10月 27日 11:13 d1 - ./././devices/pseudo/md0:0,1,rawlrwxrwxrwx 1 root root 37 10月 27日 11:10 d10 - ././.
14、/devices/pseudo/md0:0,10,rawlrwxrwxrwx 1 root root 37 10月 27日 11:11 d11 - ./././devices/pseudo/md0:0,11,rawlrwxrwxrwx 1 root root 37 10月 27日 11:12 d13 - ./././devices/pseudo/md0:0,13,rawlrwxrwxrwx 1 root root 37 10月 27日 11:12 d15 - ./././devices/pseudo/md0:0,15,rawlrwxrwxrwx 1 root root 37 10月 27日 1
15、1:13 d16 - ./././devices/pseudo/md0:0,16,rawlrwxrwxrwx 1 root root 37 10月 27日 11:13 d17 - ./././devices/pseudo/md0:0,17,rawlrwxrwxrwx 1 root root 36 10月 27日 11:14 d3 - ./././devices/pseudo/md0:0,3,rawlrwxrwxrwx 1 root root 36 10月 27日 11:14 d5 - ./././devices/pseudo/md0:0,5,rawlrwxrwxrwx 1 root root
16、36 10月 27日 11:14 d6 - ./././devices/pseudo/md0:0,6,rawlrwxrwxrwx 1 root root 36 10月 27日 11:14 d7 - ./././devices/pseudo/md0:0,7,raw # ls -l /dev/md/dsk总数 24lrwxrwxrwx 1 root root 36 10月 27日 11:13 d0 - ./././devices/pseudo/md0:0,0,blklrwxrwxrwx 1 root root 36 10月 27日 11:13 d1 - ./././devices/pseudo/m
17、d0:0,1,blklrwxrwxrwx 1 root root 37 10月 27日 11:10 d10 - ./././devices/pseudo/md0:0,10,blklrwxrwxrwx 1 root root 37 10月 27日 11:11 d11 - ./././devices/pseudo/md0:0,11,blklrwxrwxrwx 1 root root 37 10月 27日 11:12 d13 - ./././devices/pseudo/md0:0,13,blklrwxrwxrwx 1 root root 37 10月 27日 11:12 d15 - ./././d
18、evices/pseudo/md0:0,15,blklrwxrwxrwx 1 root root 37 10月 27日 11:13 d16 - ./././devices/pseudo/md0:0,16,blklrwxrwxrwx 1 root root 37 10月 27日 11:13 d17 - ./././devices/pseudo/md0:0,17,blklrwxrwxrwx 1 root root 36 10月 27日 11:14 d3 - ./././devices/pseudo/md0:0,3,blklrwxrwxrwx 1 root root 36 10月 27日 11:14
19、 d5 - ./././devices/pseudo/md0:0,5,blklrwxrwxrwx 1 root root 36 10月 27日 11:14 d6 - ./././devices/pseudo/md0:0,6,blklrwxrwxrwx 1 root root 36 10月 27日 11:14 d7 - ./././devices/pseudo/md0:0,7,blk12. 修改/etc/vfstab 文件,以便镜像启动修改vfstab前先备份vfstab,直接修改这个文件,修改错系统可能起不来。 # egrep ufs|swap /etc/vfstab|grep /dev/md
20、/dsk /dev/md/dsk/d1 - - swap - no - /dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -修改前的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/c0d0s3 - - swap - no -/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -
21、/dev/dsk/c0d0s1 /dev/rdsk/c0d0s1 /var ufs 1 no -/dev/dsk/c0d0s6 /dev/rdsk/c0d0s6 /export/home ufs 2 yes -/dev/dsk/c0d0s5 /dev/rdsk/c0d0s5 /opt ufs 2 yes -/dev/dsk/c0d0s7 /dev/rdsk/c0d0s7 /svm ufs 2 yes -/devices - /devices devfs - no -sharefs - /etc/dfs/sharetab sharefs - no -ctfs - /system/contract
22、 ctfs - no -objfs - /system/object objfs - no -swap - /tmp tmpfs - yes -修改后的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/d3 - - swap - no -/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -/dev/md/
23、dsk/d1 /dev/md/rdsk/d1 /var ufs 1 no -/dev/md/dsk/d6 /dev/md/rdsk/d6 /export/home ufs 2 yes -/dev/md/dsk/d5 /dev/md/rdsk/d5 /opt ufs 2 yes -#/dev/md/dsk/d7 /dev/md/rdsk/d7 /svm ufs 2 yes -/devices - /devices devfs - no -sharefs - /etc/dfs/sharetab sharefs - no -ctfs - /system/contract ctfs - no -obj
24、fs - /system/object objfs - no -swap - /tmp tmpfs - yes -总结:加入md,改CxDxS为d13. 重新引导系统以挂载镜像 # sync;sync;sync # reboot14. 制作第二个硬盘各个分区的子镜像 # metainit -f d20 1 1 c1d0s0 d20: Concat/Stripe is setup # metainit -f d21 1 1 c1d0s1 d21: Concat/Stripe is setup# metainit -f d23 1 1 c1d0s3# metainit -f d25 1 1 c1d
25、0s5# metainit -f d26 1 1 c1d0s6# metainit -f d27 1 1 c1d0s715. 将另外各个子镜像盘加入到镜像盘中(数据同步) # metattach d0 d20 d0: submirror d20 is attached # metattach d1 d21 d1: submirror d21 is attached# metattach d3 d23# metattach d5 d25# metattach d6 d26# metattach d7 d2716. 检查进度 # metastat d1: Mirror Submirror 0: d
26、11 State: Okay Submirror 1: d21 State: Resyncing Resync in progress: 96 % done Pass: 1 Read option: roundrobin (default) Write option: parallel (default) Size: 2104515 blocks (1.0 GB) d11: Submirror of d1 State: Okay Size: 2104515 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Sp
27、are c0d0s1 0 No Okay Yes d21: Submirror of d1 State: Resyncing Size: 2104515 blocks (1.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d1s1 0 No Okay Yes d0: Mirror Submirror 0: d10 State: Okay Submirror 1: d20 State: Resyncing Resync in progress: 13 % done Pass: 1 Read option: roun
28、drobin (default) Write option: parallel (default) Size: 16787925 blocks (8.0 GB) d10: Submirror of d0 State: Okay Size: 16787925 blocks (8.0 GB) Stripe 0: Device Start Block Dbase State Reloc Hot Spare c0d0s0 0 No Okay Yes d20: Submirror of d0 State: Resyncing Size: 16787925 blocks (8.0 GB) Stripe 0
29、: Device Start Block Dbase State Reloc Hot Spare c0d1s0 0 No Okay Yes Device Relocation Information: Device Reloc Device ID=010* c0d0 Yes id1,cmdkAVMware_Virtual_IDE_Hard_Drive=00000000000000000001Boot(完成镜像工作后的操作)1. 检查第二个盘的分区是否正常 # fdisk /dev/rdsk/c1d0p0 Total disk size is 1566 cylinders Cylinder size is 16065 (512 byte) blocks Cylinders Partition Status Type Start End Length % = = = = = = = 1 Active Solaris2 1 1565 1565 100 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2