免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1178 | 回复: 0
打印 上一主题 下一主题

root mirroring procedure for Solaris [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-06-14 16:21 |只看该作者 |倒序浏览
Step by Step procedure for SVM root mirroring:
Root and mirror disks, are here referred to as primary and secondary disks respectively.
1. In this step, you will need to boot cdrom in single user mode off the Solaris media or network. [refer to info doc 21310 for cdrom boot in single user mode and 13267 for info doc on fdisk] [refer to info doc 84167 for pxe boot in Solaris 10] You will need to initialize each disk prior to installation and or mirroring.
In order to initialize any new X86 disk, you need to run fdisk prior to mirroring and or installation. You could run this through format and or on command with exact fdisk and logical boot device (/dev/rdsk/c#t#d#s# or /dev/dsk/c#d#s#) pertaining to your platform. It is recommended to delete the current layout and then create the new partition as follows. I am using c1t1d0s2 in this case but that will vary according to your system and format output.
# fdisk /dev/rdsk/c1t0d0s2
WARNING: Device /dev/rdsk/c1t0d0s2:
The device does not appear to include absolute
sector 0 of the PHYSICAL disk (the normal location for an fdisk table).
Fdisk is normally used with the device that represents the entire fixed disk.
(For example, /dev/rdsk/c0d0p0 on x86 or /dev/rdsk/c0t5d0s2 on sparc).
Are you sure you want to continue? (y/n) y
           Total disk size is 8924 cylinders
           Cylinder size is 16065 (512 byte) blocks
                                              Cylinders      
Partition   Status    Type          Start   End   Length    %
=========   ======    ============  =====   ===   ======   ===
    1       Active    Solaris2          0   365     366      4
    2                 Diagnostic      365   366       2      0
SELECT 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
Specify the partition number to delete (or enter 0 to exit): 1
Are you sure you want to delete partition 1? This will make all files and
programs in this partition inaccessible (type "y" or "n"). y
Partition 1 has been deleted. This was the active partition.1
             Total disk size is 8924 cylinders
             Cylinder size is 16065 (512 byte) blocks
                                              Cylinders
Partition   Status    Type          Start   End   Length    %
=========   ======    ============  =====   ===   ======   ===
    1                 Diagnostic      365   366       2      0
SELECT 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
Specify the partition number to delete (or enter 0 to exit): 1
Are you sure you want to delete partition 1? This will make all files and
programs in this partition inaccessible (type "y" or "n"). y
Partition 1 has been deleted.1
             Total disk size is 8924 cylinders
             Cylinder size is 16065 (512 byte) blocks
                                               Cylinders
Partition   Status    Type          Start   End   Length    %
=========   ======    ============  =====   ===   ======   ===
WARNING: no partitions are defined!
SELECT 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: 1
Select the partition type to create:
   1=SOLARIS2  2=UNIX        3=PCIXOS     4=Other
   5=DOS12     6=DOS16       7=DOSEXT     8=DOSBIG
   9=DOS16LBA  A=x86 Boot    B=Diagnostic C=FAT32
   D=FAT32LBA  E=DOSEXTLBA   F=EFI        0=Exit? 1
Specify the percentage of disk to use for this partition[1]
(or type "c" to specify the size in cylinders). c
Enter starting cylinder number: 1
Enter partition size in cylinders: 8000
Should this become the active partition? If yes, it  will be activated
each time the computer is reset or turned on.
Please type "y" or "n". y
Partition 1 is now the active partition.1
             Total disk size is 8924 cylinders
             Cylinder size is 16065 (512 byte) blocks
                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    Solaris2          1  8000    8000     90
SELECT 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: 1
Select the partition type to create:
   1=SOLARIS2  2=UNIX        3=PCIXOS     4=Other
   5=DOS12     6=DOS16       7=DOSEXT     8=DOSBIG
   9=DOS16LBA  A=x86 Boot    B=Diagnostic C=FAT32
   D=FAT32LBA  E=DOSEXTLBA   F=EFI        0=Exit? B
Specify the percentage of disk to use for this partition[B]
(or type "c" to specify the size in cylinders). c
Enter starting cylinder number: 8001
Enter partition size in cylinders: 924
Total disk size is 8924 cylinders
             Cylinder size is 16065 (512 byte) blocks
Should this become the active partition? If yes, it  will be activated
each time the computer is reset or turned on.
Please type "y" or "n". n
             Total disk size is 8924 cylinders
             Cylinder size is 16065 (512 byte) blocks
                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    Solaris2          1  8000    8000     90
          2                 Diagnostic     8001  8919     919     10
SELECT 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: 5
#
Please note if the disk geometry of the x86 is different you will need to match this in disk labeling under format and in fdisk.
print disk 0
Volume:  
Current partition table (original):
Total disk cylinders available: 15940 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm     518 - 15581       17.44GB    (15064/0/0) 36575392
  1       swap    wu       1 -   432      512.16MB    (432/0/0)    1048896
  2     backup    wm       0 - 15939       18.45GB    (15940/0/0) 38702320
  3 unassigned    wm     433 -   517      100.77MB    (85/0/0)      206380
  4 unassigned    wu       0                0         (0/0/0)            0
  5 unassigned    wu       0                0         (0/0/0)            0
  6 unassigned    wu       0                0         (0/0/0)            0
  7 unassigned    wu       0                0         (0/0/0)            0
  8       boot    wu       0 -     0        1.19MB    (1/0/0)         2428
  9 unassigned    wu       0                0         (0/0/0)            0
print disk 1
Current partition table (original):
Total disk cylinders available: 2548 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm     129 - 2404       17.44GB    (2276/0/0) 36563940
  1       swap    wu       1 -  128     1004.06MB    (128/0/0)   2056320
  2     backup    wm       0 - 2547       19.52GB    (2548/0/0) 40933620
  3 unassigned    wm    2405 - 2417      101.98MB    (13/0/0)     208845
  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 unassigned    wm       0               0         (0/0/0)           0
You will have to layout your disks in format to label them with the same disk geometry as shown above but varied according to your specifications. It is recommended that the primary disk should be the smaller of the two disks per Bugid 6225636.
2. Check for the latest Solaris 10 x86 SVM patches. Check for the latest patch cluster at:
http://sunsolve.sun.com
. It is recommended to keep the patch level to the latest revision.
3. Create one slice(preferably Slice 3) of 100MB(minimum recommended) on the primary disk, for storing the metadb replicas.
4. After creating the slice for metadb replicas, copy the VTOC of the primary disk to the secondary disk, so the same slice information is copied to the secondary disk.(In the examples. c1t0d0 is primary and c1t1d0 is secondary disk)
   For example: # prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
**Please note the above mentioned examples are just that and the device mentioned can vary between systems. If you are not sure of the /dev/rdsk/c#d#s# or /dev/dsk/c#t#d#s# to be used above that pertains to your platform it is recommended you run format and verify it.
5. Create metadb replicas in slice 3 of both primary and secondary disks.
   For example: # metadb -afc 3 c1t0d0s3 c1t1d0s3
6. Create metadevices for /, swap, and /export/home file systems. Create meta-devices for any other filesystems that are part of the primary disk.
For example:
   # metainit -f d10 1 1 c1t0d0s0   --->
     This creates metadevice d10 for root slice of primary disk.
   # metainit d20 1 1 c1t1d0s0
     This creates metadevice d20 for root slice of secondary disk.
   # metainit d0 -m d10
     creating a one way mirror using d10.
   In the same way create, metadevices for other file systems, including swap.(针对此,我提出一个疑问,从上面的分区列表来看,显然这是个for X86的,但是s9分区明显太小,在做SDS时会被通知分区太小,甚至在上面放个metadb都不可以,这里就一笔带过,让我怀疑这个实验能否成功。)
7. Update the /etc/vfstab file, with the metadevices for the file systems.
Example: metaroot d0
            --> This command will update vfstab - /dev/md/dsk/d0 as /   filesystem.
                For other filesystems and swap, manually edit the vfstab
                entries.
8. reboot the system.
9. Once the system has booted, check with either the "df" or "mount" command, to check whether the file systems are using metadevices.
10. Attach the second part of the mirror to the meta mirrors.
   Example: # metattach d0 d20  
This will attach metadevice d20 to d0. After this command, mirror resync will start.
11. Once all file systems are attached, check all the metadevice status are "Okay". Then, update the secondary disk bootable using an installgrub command.
Note: From Solaris 10 x86 U1, the installboot command is obselete. So, use the installgrub command, to make the second disk bootable. It is better to run this command once, to make sure the secondary disk is bootable.
    Example: # installgrub -fm /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0
The installgrub utility will update the Master Boot record of the secondary disk, so that it can be bootable.
12. Now update the secondary disk as alternate bootpath in /boot/solaris/bootenv.rc file. (This can be done by executing the eeprom command)
    Example: eeprom altbootpath=""
If you are not sure what the physical path is that belongs in the above "". It is recommended you run the following command:
# ls -la /dev/dsk/c#t#d#s#
This example was taken from an X2100 platform:
# ls -la /dev/dsk/c2d0s0
lrwxrwxrwx   1 root     root          48 Sep  5 21:35 /dev/dsk/c2d0s0 -> ../../devices/pci@0,0/pci-ide@7/ide@1/cmdk@0,0:a
so the path that needs to added to the bootenv.rc file is eeprom
# eeprom altbootpath="/pci-ide@7/ide@1/cmdk@0,0:a"
It is important to add this altbootpath to the bootenv.rc for successful mirroring.
13. Now the system can be safely rebooted, to check if it is booting with root disk mirrored.
Recovering from primary boot disk failure:
If the primary root disk fails, the system will continue to run from the
secondary boot disk. There will be SCSI errors on the console, about the disk
failure.
"Primary root disk can be replaced online without bringing down the system"
Note: If you don't use the cfgadm command when hot swapping and syncing the disk, the mirror will go back into ?Needs Maintenance? mode after the next reboot. A subsequent sync of the mirror will fix it for good however. It is thus recommended that you use cfgadm to avoid future issues.
Note: All the usual rules apply to SVM. For example, make sure you have at least 3 metadb's on the working disks to avoid a panic due to insufficient replicas.
Step-by-Step Procedure for replacing a failed disk:
1. cfgadm -al
2. cfgadm -c unconfigure cx::xxxxxxx
This may fail with a lists of reasons. Address each reasons then try again.
Examples:


  • If SVM metadb resides on a slice of the failed disk. do a forced remove of the metadb via metadb -d

  • If there's another SVM mirror on the disk, you need to force detach it.

  • Use dumpadm to check if a dump device is assigned to this disk.

3. Hotswap the failed disk.
4. cfgadm -c configure cx::xxxxxxx
5. Redo the partitioning for the replacement disk using format or prtvtoc.
    Example: prtvtoc /dev/rdsk/c1t1d0s2 | fmthard -s - /dev/rdsk/c1t0d0s2
6. Then re-attach the failed mirrors using the metareplace command.
    Example: metareplace -e d0   
Once the synchronisation has completed, the primary disk is successfully mirrored back online.
NOTE: The above procedure can be followed for replacing a secondary disk failure.
Reference:
http://sunsolve.sun.com/search/document.do?assetkey=1-9-83605-1


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/26090/showart_321344.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP