免费注册 查看新帖 |

Chinaunix

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

solaris 镜像系统的硬盘扩容方案(ufsdump系统,拆镜像,分区方法) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-05-08 11:32 |只看该作者 |倒序浏览
1        背景信息介绍
       主机有2个36G硬盘,系统作了镜像。准备把现在的2快36G硬盘更换为2块73G硬盘。本文档就是该系统扩容实施的介绍!
3        方案实施细节   //为避免透露客户信息 对部分内容作了删减,希望对完整性不会有影响
3.1        系统健康检查
A.检查扩充部件是否与主机匹配。
B.系统健康检查
Sourcing //.profile-EIS.....
[email=root@xz_netman]root@xz_netman[/email]
# prtdiag -v
[email=root@xz_netman]root@xz_netman[/email]
# df -k
文件系统              千字节    用了    可用 容量      挂接在
/dev/md/dsk/d10      30241354 26590345 3348596    89%    /
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
mnttab                     0       0       0     0%    /etc/mnttab
swap                 3996568       8 3996560     1%    /var/run
swap                 3999968    3408 3996560     1%    /tmp
[email=root@xz_netman]root@xz_netman[/email]
# psrinfo -v
Status of processor 0 as of: 03/20/07 20:11:53
  Processor has been on-line since 09/15/05 17:38:58.
  The sparcv9 processor operates at 900 MHz,
        and has a sparcv9 floating point processor.
Status of processor 1 as of: 03/20/07 20:11:53
  Processor has been on-line since 09/15/05 17:39:00.
  The sparcv9 processor operates at 900 MHz,
        and has a sparcv9 floating point processor.
[email=root@xz_netman]root@xz_netman[/email]
# format   //察看当前硬盘能否正常识别及分区大小
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333eb,0
       1. c1t1d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333ff,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !     - execute , then return
        quit
format> p
PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        ! - execute , then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 24620 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 - 21266       29.30GB    (21267/0/0) 61440363
  1       swap    wu   21267 - 24170        4.00GB    (2904/0/0)   8389656
  2     backup    wm       0 - 24619       33.92GB    (24620/0/0) 71127180
  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   24171 - 24178       11.29MB    (8/0/0)        23112
  7 unassigned    wm       0                0         (0/0/0)            0
partition> ^D
[email=root@xz_netman]root@xz_netman[/email]
# metastat   //查看镜像状态,发现子镜像d11状态不正常
d10: Mirror
    Submirror 0: d11
      State: Needs maintenance
    Submirror 1: d12
      State: Okay         
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 61440363 blocks
d11: Submirror of d10
    State: Needs maintenance
    Invoke: metareplace d10 c1t0d0s0
    Size: 61440363 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t0d0s0                   0     No    Maintenance  
d12: Submirror of d10
    State: Okay         
    Size: 61440363 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t1d0s0                   0     No    Okay         
d20: Mirror
    Submirror 0: d21
      State: Okay         
    Submirror 1: d22
      State: Okay         
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 8389656 blocks
d21: Submirror of d20
    State: Okay         
    Size: 8389656 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t0d0s1                   0     No    Okay         
d22: Submirror of d20
    State: Okay         
    Size: 8389656 blocks
    Stripe 0:
        Device              Start Block  Dbase State        Hot Spare
        c1t1d0s1                   0     No    Okay         
[email=root@xz_netman]root@xz_netman[/email]
# cd /var/adm                                                                                             
[email=root@xz_netman]root@xz_netman[/email]
# ls –l   //发现message中无报错信息
总数 1332986
-rw-r--r--   1 root     root           0 2004   6月  5 Xvfb.log
drwxrwxr-x   5 adm      adm          512 2004   6月  3 acct
-rw-------   1 uucp     bin            0 2004   6月  3 aculog
drwxr-xr-x   2 adm      adm          512 2004   6月  3 exacct
-r--r--r--   1 root     other      28056  3月 20 20:15 lastlog
drwxr-xr-x   2 adm      adm          512 2004   6月  3 log
-rw-r--r--   1 root     other          0  3月 18 03:10 messages
-rw-r--r--   1 root     other          0  3月 11 03:10 messages.0
-rw-r--r--   1 root     other          0  3月  4 03:10 messages.1
-rw-r--r--   1 root     other          0  2月 25 03:10 messages.2
-rw-r--r--   1 root     other          0  2月 18 03:10 messages.3
drwxr-xr-x   2 adm      adm          512 2004   6月  3 passwd
drwxrwxr-x   2 adm      sys          512 2004   6月  3 sa
drwxr-xr-x   2 root     sys          512 2004   6月  3 sm.bin
-rw-rw-rw-   1 root     bin            0 2004   6月  3 spellhist
drwxr-xr-x   2 root     sys          512 2004   6月  3 streams
-rw-------   1 root     root        9489  3月  6 15:05 sulog
-rw-r--r--   1 root     bin         2976  3月 20 20:11 utmpx
-rw-r--r--   1 root     root        4628 2005   9月 15 vold.log
[email=root@xz_netman]root@xz_netman[/email]
# metastat –t    //查看子镜像发生故障的时间,发现故障发生时,正是客户开始备份时,所以怀疑是大规模的文件读写(tar文件)导致硬盘损坏。
    State: Okay         2004年06月03日 d10: Mirror
    Submirror 0: d11
      State: Needs maintenance 2007年03月20日 星期二 18时57分55秒
    Submirror 1: d12
      State: Okay         2004年06月03日 星期四 19时20分26秒
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 61440363 blocks
d11: Submirror of d10
    State: Needs maintenance 2007年03月20日 星期二 18时57分55秒
    Invoke: metareplace d10 c1t0d0s0
    Size: 61440363 blocks
    Stripe 0:
      Device     Start  Dbase  State        Hot Spare  Time
      c1t0d0s0       0  No     Maintenance     2007年03月20日 星期二 18时57分55秒
d12: Submirror of d10         星期四 19时20分26秒
    Size: 61440363 blocks
    Stripe 0:
      Device     Start  Dbase  State        Hot Spare  Time
      c1t1d0s0       0  No     Okay   2004年06月03日 星期四 17时18分15秒
d20: Mirror
    Submirror 0: d21
      State: Okay         2004年06月03日 星期四 17时18分16秒
    Submirror 1: d22
      State: Okay         2004年06月03日 星期四 18时14分00秒
    Pass: 1
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 8389656 blocks
d21: Submirror of d20
    State: Okay         2004年06月03日 星期四 17时18分16秒
    Size: 8389656 blocks
    Stripe 0:
      Device     Start  Dbase  State        Hot Spare  Time
      c1t0d0s1       0  No     Okay    2004年06月03日 星期四 17时18分15秒
d22: Submirror of d20
    State: Okay         2004年06月03日 星期四 18时14分00秒
    Size: 8389656 blocks
    Stripe 0:
      Device     Start  Dbase  State        Hot Spare  Time
      c1t1d0s1       0  No     Okay       2004年06月03日 星期四 17时18分15秒
[email=root@xz_netman]root@xz_netman[/email]
# metadb
        flags           first blk       block count
     a m  p  luo        16              1034            /dev/dsk/c1t0d0s6
     a    p  luo        1050            1034            /dev/dsk/c1t0d0s6
     a    p  luo        2084            1034            /dev/dsk/c1t0d0s6
     a    p  luo        16              1034            /dev/dsk/c1t1d0s6
     a    p  luo        1050            1034            /dev/dsk/c1t1d0s6
     a    p  luo        2084            1034            /dev/dsk/c1t1d0s6
说明:通过上面的检查发现,除了d11子镜像状态不正常外系统其他项目都正常,由于d11子镜像的问题,导致原来计划需要临时改变,因为客户备份时曾在0号盘上tar文件,这可能是导致0号硬盘故障的原因,所以现在为了安全起见,不能从0号盘dump文件系统,转而要从1号盘dump文件系统。相应的操作步骤也要发生变化:要先把系统从1号盘启动,删除0号盘上的子镜像,更换0号盘,备份文件系统到号盘,从零号盘启动,更换1号盘,重新同步镜像。
拆除现有镜像
[email=root@xz_netman]root@xz_netman[/email]
# cd /etc
[email=root@xz_netman]root@xz_netman[/email]
# ls    //下面输出有删减
LGTOuscsi                   nsswitch.conf
TIMEZONE                    nsswitch.dns
log                         syslog.pid
logindevperm                system
lp                          system-INSTALL
lu                          tar
lvm                         telinit
name_to_major               utmpx
name_to_sysnum              uucp
nca                         vfstab
ncheck                      vfstab-INSTALL
net                         volcopy
netconfig                   vold.conf
[email=root@xz_netman]root@xz_netman[/email]
# more vfstab-I*   //确认是否为镜像前的内容
[email=root@xz_netman]root@xz_netman[/email]
# more system-I*   //确认是否为镜像前的内容
[email=root@xz_netman]root@xz_netman[/email]
# cp vfstab vfstab.bak //备份现有的vfstab
[email=root@xz_netman]root@xz_netman[/email]
# cp system system.bak  //备份现有的system文件,供故障时还原
[email=root@xz_netman]root@xz_netman[/email]
# more system.bak     //确认备份成功
[email=root@xz_netman]root@xz_netman[/email]
# more vfstab.bak
[email=root@xz_netman]root@xz_netman[/email]
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333eb,0
       1. c1t1d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333ff,0
Specify disk (enter its number): ^D
[email=root@xz_netman]root@xz_netman[/email]
# prtconf -vp|grep bootpath   //查看当前启动盘为0号盘
        bootpath:  
[email='/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w21000004cfc333eb,0:a']'/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w21000004cfc333eb,0:a'[/email]
********************************************************************************
说明:因为当前的启动盘为0号盘,所以无法删0号盘上的故障子镜像,如果此时试图删除子镜像d11,会报一个错,如:
[email=root@xz_netman]root@xz_netman[/email]
# metadetach d10 d11
metadetach: xz_netman: d10: attempt an operation on a submirror that has erred components
必须先把系统启动到1号盘上,在进行删除。而要想从1号盘启动系统,现有的镜像不能拆。
*******************************************************************************
[email=root@xz_netman]root@xz_netman[/email]
# init 0   
ok boot disk1
[email=root@xz_netman#format]root@xz_netman#format[/email]
[email=root@xz_netman]root@xz_netman[/email]
# prtconf -vp|grep bootpath  //确认启动盘是否为1号盘
[email=root@xz_netman]root@xz_netman[/email]
# metastat    //再次确认镜像状态
[email=root@xz_netman]root@xz_netman[/email]
# metadetach -f d10 d11
d10: submirror d11 is detached
//删除处于需要维护状态的子镜像必须加-f参数进行强制删除
[email=root@xz_netman]root@xz_netman[/email]
# metaclear d11
d11: Concat/Stripe is cleared
[email=root@xz_netman]root@xz_netman[/email]
# metadetach d20 d21
d20: submirror d21 is detached
[email=root@xz_netman]root@xz_netman[/email]
# metaclear d21
d21: Concat/Stripe is cleared
[email=root@xz_netman]root@xz_netman[/email]
# metastat      //确认0号盘上的子镜像已经全部删除
注:此处把0号盘上的子镜像删除,是因为防止把1号盘上的系统dump完成后,如果0号盘子镜像不删除,在最后重新同步镜像时可能会出错。
3.3        更换硬盘并分区
[email=root@xz_netman]root@xz_netman[/email]
# luxadm remove_device -F /dev/rdsk/c1t0d0s2  //逻辑上剔出0号盘
WARNING!!! Please ensure that no filesystems are mounted on these device(s).
All data on these devices should have been backed up.
The list of devices which will be removed is:
  1: Device name: /dev/rdsk/c1t0d0s2
     Node WWN:    20000004cfc333eb
     Device Typeisk device
     Device Paths:
      /dev/rdsk/c1t0d0s
Please verify the above list of devices and
then enter 'c' or  to Continue or 'q' to Quit. [Default: c]:
stopping:  /dev/rdsk/c1t0d0s2....Done
offlining: /dev/rdsk/c1t0d0s2....Done
Hit  after removing the device(s).  //此时拔掉0号盘,并按回车
  Device: /dev/rdsk/c1t0d0s2
  Logical Nodes being removed under /dev/dsk/ and /dev/rdsk:
        c1t0d0s0
        c1t0d0s1
        c1t0d0s2
        c1t0d0s3
        c1t0d0s4
        c1t0d0s5
        c1t0d0s6
        c1t0d0s7
********************************************************************************
注:这里之所以加个-F 参数,是因为从eeprom的输出结果中看出,此时系统上记录的启动盘仍然是0号盘(Nvram中存储的,而非实际),所以一旦从逻辑上剔出0号盘时,系统会有提示要求强制 剔除 提示如下:
WARNING!!! Please ensure that no filesystems are mounted on these device(s).
All data on these devices should have been backed up.
The list of devices being used (either busy or reserved) by the host:
  1: Device /dev/rdsk/c1t0d0s2
Please enter 's' or  to Skip the "busy/reserved" device(s) or
'q' to Quit and run the subcommand with
-F (force) option. [Default: s]: s
*********************************************************************************
此时在0号槽位上插入73G的硬盘,并在系统里执行devfsadm识别该盘
[email=root@xz_netman]root@xz_netman[/email]
# devfsadm
[email=root@xz_netman]root@xz_netman[/email]
# format   //按照1号盘的分区情况对0号盘进行分区,因为2块盘的大小比一样,所以只能手动分区 ,本次分区客户要求,6号分区50M左右,swap 8G, 剩下的空间全部留给/ ,所以分区时从6号分区开始。
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000014c33883a9,0
       1. c1t1d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333ff,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000014c33883a9,0
       1. c1t1d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333ff,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !     - execute , then return
        quit
format> p
PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        ! - execute , then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 14087 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -    25      129.19MB    (26/0/0)       264576
  1       swap    wu      26 -    51      129.19MB    (26/0/0)       264576
  2     backup    wu       0 - 14086       68.35GB    (14087/0/0) 143349312
  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      52 - 14086       68.10GB    (14035/0/0) 142820160
  7 unassigned    wm       0                0         (0/0/0)             0
partition> 6
Part      Tag    Flag     Cylinders         Size            Blocks
  6        usr    wm      52 - 14086       68.10GB    (14035/0/0) 142820160
Enter partition id tag[usr]: unassigned  //因为6号分区作Metadb所以不用其分区名字
Enter partition permission flags[wm]:    //回车,执行默认的WM 权限
Enter new starting cyl[52]: 14076      
*******************************************************************************
注:
从上面的输出可以看出,总的柱面数是14086个,总大小为68.35G,则可以算出每个柱面大概有5M左右,则如果想给6号分区分大约50M的空间,则分配给6号分区10个左右的柱面就可以了,而6号分区的结束柱面为14086,则开始柱面选14076就可以满足需要。
*******************************************************************************
Enter partition size[111936b, 11c, 54.66mb, 0.05gb]:   
//当输入起始柱面后,系统会自动算出该分区的大小,此时按回车确认默认的大小即可。
partition> l      //lable,保存对该分区的设置
Ready to label disk, continue? y  
partition> 6     //查看分区是否成功
Part      Tag    Flag     Cylinders         Size            Blocks
  6 unassigned    wm   14076 - 14086       54.66MB    (11/0/0)       111936
*****************************************************************************
注:
1.        其实,采用这种分区如果想达到比较精确的分区空间,我们可以采取下面的方法,比如我们想要给6号分区分50M的空间,那在估算出每个柱面的大小后(大约5M左右),先尝试把6号分区的起始柱面设为14076(大概是10个柱面的空间),则我们会在下一步中看到此时的6号分区的空间(54.66mb),发现比我们想要的空间要大了4m,则我们在下一步不保存当前设置即可(不输入label),之后重新对6号分区进行设置,把其实柱面在增大一个如:1477,再观察此时6号分区的大小,如果合适则保存,如果不合适则继续更改起始柱面,经过几次的尝试就可以得到比较精确的空间了。当空间大小合适后,输入label 保存设置即可。
2.        另外,采用这种倒着分区(从6号分区开始分区)方式进行分区时,一定要计算好起始柱面,在这里经常犯的错误是“顺序颠倒”的错误,比如6号分区起始柱面为14076,由于计算疏忽1号分区的结束柱面确为14078,这样就会出现柱面交叉,不过如果是单盘,即使出现柱面交叉,系统也不会抱错,但如果要作镜像,那么在建立子镜像和设立metadb时都回报错,具体情况会在附录中详细介绍
***********************************************************************
partition> 1
Part      Tag    Flag     Cylinders         Size            Blocks
1         swap     wu      26 -    51      129.19MB    (26/0/0)       264576
Enter partition id tag[swap]:      //回车,采取默认即可
Enter partition permission flags[wu]:     //回车,采取默认即可
Enter new starting cyl[26]: 12427     //因为6号分区的起始柱面为14076,而7号,5号,3号和4号分区的空间又为0,所以1号分区的结束柱面为14075(而非14077,此处一定注意不要犯“颠倒顺序”的错误)而1号分区要8G的空间,大概就是1648个柱面,则1号分区的起始柱面该是12427。
Enter partition size[16780224b, 1649c, 8193.47mb, 8.00gb]:  
//空间大小差不多,则按回车确认默认的空间大小即可
partition> l     //保存
Ready to label disk, continue? y
根分区类似,这里不再详述。
[email=root@xz_netman]root@xz_netman[/email]
# format     //确认分区
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c1t0d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000014c33883a9,0
       1. c1t1d0
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w21000004cfc333ff,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !     - execute , then return
        quit
format> p
PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        ! - execute , then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 14087 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 - 12426       60.30GB    (12427/0/0) 126457152
  1       swap    wu   12427 - 14075        8.00GB    (1649/0/0)   16780224
  2     backup    wu       0 - 14086       68.35GB    (14087/0/0) 143349312
  3 unassigned    wu       0                0         (0/0/0)             0
  4 unassigned    wu       0                0         (0/0/0)             0
  5 unassigned    wu       0                0         (0/0/0)             0
  6 unassigned    wm   14076 - 14086       54.66MB    (11/0/0)       111936
  7 unassigned    wu       0                0         (0/0/0)             0
  3.4        备份文件系统
[email=root@xz_netman]root@xz_netman[/email]
# newfs /dev/rdsk/c1t0d0s0      
newfs: construct a new file system /dev/rdsk/c1t0d0s0: (y/n)? y
/dev/rdsk/c1t0d0s0:     126457152 sectors in 12427 cylinders of 24 tracks, 424 sectors 61746.7MB in 1243 cyl groups (10 c/g, 49.69MB/g, 6016 i/g)
超块 (fsck -F ufs -o b=#) 备份在:
32, 102224, 204416, 306608, 408800, 510992, 613184, 715376, 817568, 919760,
1021952, 1124144, 1226336, 1328528, 1430720, 1532912, 1635104, 1737296,
1839488, 1941680, 2043872, 2146064, 2248256, 2350448, 2452640, 2554832,
2657024, 2759216, 2861408, 2963600, 3065792, 3167984, 3256352, 3358544,
……………………………………………………………………………………….
…………………………………………………………………………………………
[email=root@xz_netman]root@xz_netman[/email]
# mount /dev/dsk/c1t0d0s0 /mnt
[email=root@xz_netman]root@xz_netman[/email]
# ufsdump 0uf - /dev/dsk/c1t1d0s0 |(cd /mnt ; ufsrestore rf - )
  DUMP: 写入 32 千字节记录
  DUMP: 本级 0 日期转储:2007年03月21日 星期三 00时17分30秒
  DUMP: 上一级 0 日期转储:纪元
  DUMP: 转储 /dev/rdsk/c1t1d0s0 到 标准输出。
  DUMP: 映射(传送 I) [规则文件]
  DUMP: 映射 (传送 II) [目录]
  DUMP: 估计 46914800 块 (22907.62MB)。
  DUMP: 转储(传送 III) [目录]
  DUMP: 转储(传送 IV) [规则文件]
Warning: ./lost+found: File exists
Mar 21 00:29:06 xz_netman login: ROOT LOGIN /dev/pts/2 FROM 10.97.60.200
  DUMP: 0.22% 完成,在 112:10 完成
Mar 21 00:33:23 xz_netman last message repeated 2 times
  DUMP: 3.98% 完成,在 9:54 完成
  DUMP: 17.06% 完成,在 2:48 完成
Mar 21 00:57:13 xz_netman login: ROOT LOGIN /dev/pts/2 FROM 10.97.60.25
  DUMP: 46.56% 完成,在 0:51 完成
  DUMP: 59.46% 完成,在 0:37 完成
  DUMP: 67.04% 完成,在 0:31 完成
  DUMP: 73.55% 完成,在 0:26 完成
  DUMP: 75.49% 完成,在 0:27 完成
  DUMP: 87.37% 完成,在 0:13 完成
  DUMP: 95.01% 完成,在 0:05 完成
  DUMP: 在 1 卷上的 46915966 块 (22908.19MB)速率是 3602 KB/sec
  DUMP: 转储已完成
  DUMP: 2007年03月21日 星期三 00时17分30秒 上的 0 级转储
[email=root@xz_netman]root@xz_netman[/email]
# ps -ef |grep ufsdump
root  4865   306  0 02:07:40 console  0:00 grep ufsdump
3.5        安装启动块及刷新启动盘WWN
根文件系统备份完成后,要进入单用户在启动盘的0号分区安装启动块,并刷新WWN
[email=root@xz_netman]root@xz_netman[/email]
# cd /etc
[email=root@xz_netman]root@xz_netman[/email]
# more vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr          ufs     1       yes     -
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/dsk/c1t0d0s0       /dev/rdsk/c1t0d0s0      /       ufs     1       no      
-
swap    -       /tmp    tmpfs   -       yes     -
[email=root@xz_netman]root@xz_netman[/email]
# more vfstab-INSTALL
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr          ufs     1       yes     -
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/ c1t0d0s1 -       -       swap    -       no      -
#/dev/dsk/c1t0d0s1      -       -       swap    -       no      -
/dev/dsk/d10 /dev/rdsk/ c1t0d0s0        /       ufs     1       no      logging
swap    -       /tmp    tmpfs   -       yes     -
[email=root@xz_netman]root@xz_netman[/email]
# cp vfstab-I*  vfstab  //将现在的vfstab文件还原为镜像前的状态
[email=root@xz_netman]root@xz_netman[/email]
# more vfstab        //确认还原成功
[email=root@xz_netman]root@xz_netman[/email]
# TERM=vt100;export TERM
[email=root@xz_netman]root@xz_netman[/email]
# vi system   //将 rootdev:/pseudo/md@0:0,10,blk 项注释掉
******************************************************************************
注:因为从1号盘把系统备份到0号盘时,1号盘上的镜像还没有拆除,所以备份完成后,此时的0号盘上还是“镜像状态”,为了下面从0号盘单盘启动正常,必须把镜像彻底拆除。
******************************************************************************
[email=root@xz_netman]root@xz_netman[/email]
# cd /mnt
[email=root@xz_netman]root@xz_netman[/email]
# rm restoresymtable
[email=root@xz_netman]root@xz_netman[/email]
# cd
[email=root@xz_netman]root@xz_netman[/email]
# umount /mnt
[email=root@xz_netman]root@xz_netman[/email]
# init 0
[email=root@xz_netman]root@xz_netman[/email]
#
INIT: New run level: 0
The system is coming down.  Please wait.
System services are now being stopped.
stopping NetWorker daemons:
nsr_shutdown -a –q
打印服务已停止。
Mar 21 02:12:41 xz_netman syslogd: going down on signal 15
+4h43m30s Alarm 3 ON
The system is down.
syncing file systems... done
Program terminated
{0} ok boot cdrom -s
Boot device: /pci@8,700000/scsi@6/disk@6,0:f  File and args: -s
SunOS Release 5.8 Version Generic_108528-22 64-bit
Copyright 1983-2003 Sun Microsystems, Inc.  All rights reserved.
Configuring /dev and /devices
Using RPC Bootparams for network configuration information.
Skipping interface fcip0
SUNW,hme0 : No response from Ethernet network : Link down -- cable problem?
Skipping interface hme0
Skipping interface eri0
\
INIT: SINGLE USER MODE
# cd /usr/platform/sun4u/lib/fs/ufs
# installboot bootblk /dev/rdsk/c1t0d0s0   //安装启动块
# mount /dev/dsk/c1t0d0s0 /a
# drvconfig -r /a -p /a/etc/path_to_inst
# cd /devices
# find . -print | cpio -pduVm /a/devices
..................................................
..................................................
..................................................
..................................................
..................................................
..................................................
..............................
0 blocks
# disks -r /a
# devlinks -r /a
# luxadm set_boot_dev /dev/dsk/c1t0d0s0
Do you want to change boot-device to the new setting? (y/n) y
[email=root@xz_netman]root@xz_netman[/email]
# reboot - - -r   //此处之所以要加-r 参数 是要系统重新识别一下这个0号盘,不然如果直接boot会有报错,具体信息见附件
syncing file systems... done
rebooting...
R
LOM event: +5h34m29s host reset
screen not found.
keyboard not found.
Keyboard not present.  Using lom-console for input and output.
Sun Netra T4 (2 X UltraSPARC-III+) , No Keyboard
Copyright 1998-2002 Sun Microsystems, Inc.  All rights reserved.
OpenBoot 4.5, 2048 MB memory installed, Serial #52968011.
Ethernet address 0:3:ba:28:3a:4b, Host ID: 83283a4b.
Rebooting with command: boot -r                                       
Boot device: /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w21000014c33883a9,0:a  File and args: -r
SunOS Release 5.8 Version Generic_108528-19 64-bit
Copyright 1983-2001 Sun Microsystems, Inc.  All rights reserved.
Sourcing //.profile-EIS.....
[email=root@xz_netman]root@xz_netman[/email]
#
[email=root@xz_netman]root@xz_netman[/email]
# metastat    //因为6号分区没有备份,所以metadb也就不存在
metastat: xz_netman: there are no existing databases  
[email=root@xz_netman]root@xz_netman[/email]
#cd
[email=root@xz_netman]root@xz_netman[/email]
#mkdir
[email=root@xz_netman]root@xz_netman[/email]
#prtdiag –v
[email=root@xz_netman]root@xz_netman[/email]
#rm
[email=root@xz_netman]root@xz_netman[/email]
#su
[email=root@xz_netman]root@xz_netman[/email]
#df –k
注:以上是对备份的系统是否正常的检查,此时要求客户启动业务,查看应用是否正常,若应用正常,则可以确定本次系统dump成功,可以更换另一个盘,并重新镜像。
3.6        更换1号盘并重新同步镜像
[email=root@xz_netman]root@xz_netman[/email]
# luxadm remove_device /dev/rdsk/c1t1d0s2
WARNING!!! Please ensure that no filesystems are mounted on these device(s).
All data on these devices should have been backed up.
The list of devices which will be removed is:
  1: Device name: /dev/rdsk/c1t1d0s2
     Node WWN:    20000004cfc333ff
     Device Typeisk device
     Device Paths:
      /dev/rdsk/c1t1d0s2
Please verify the above list of devices and
then enter 'c' or  to Continue or 'q' to Quit. [Default: c]: c
stopping:  /dev/rdsk/c1t1d0s2....Done
offlining: /dev/rdsk/c1t1d0s2....Done
Hit  after removing the device(s).
  Device: /dev/rdsk/c1t1d0s2
  Logical Nodes being removed under /dev/dsk/ and /dev/rdsk:
        c1t1d0s0
        c1t1d0s1
        c1t1d0s2
        c1t1d0s3
        c1t1d0s4
        c1t1d0s5
        c1t1d0s6
        c1t1d0s7
[email=root@xz_netman]root@xz_netman[/email]
# devfsadm
[email=root@xz_netman]root@xz_netman[/email]
# format     //确认识别正常
[email=root@xz_netman]root@xz_netman[/email]
# prtvtoc /dev/rdsk/c1t0d0s2|fmthard -s - /dev/rdsk/c1t1d0s2
fmthard:  New volume table of contents now in place.
[email=root@xz_netman]root@xz_netman[/email]
# format   //确认
[email=root@xz_netman]root@xz_netman[/email]
# metadb -afc 3 c1t0d0s6
[email=root@xz_netman]root@xz_netman[/email]
# metadb -afc 3 c1t1d0s6
[email=root@xz_netman]root@xz_netman[/email]
# metainit -f d11 1 1 c1t0d0s0
d11: Concat/Stripe is setup
[email=root@xz_netman]root@xz_netman[/email]
# metainit  d12  1  1  c1t1d0s0
d12: Concat/Stripe is setup
[email=root@xz_netman]root@xz_netman[/email]
# metainit -f d21 1 1 c1t0d0s1
d21: Concat/Stripe is setup
[email=root@xz_netman]root@xz_netman[/email]
# metainit d22 1 1 c1t1d0s1
d22: Concat/Stripe is setup
[email=root@xz_netman]root@xz_netman[/email]
# metainit d10 -m d11
d10: Mirror is setup
[email=root@xz_netman]root@xz_netman[/email]
# metainit d20 -m d21
d20: Mirror is setup
[email=root@xz_netman]root@xz_netman[/email]
# metaroot d10
[email=root@xz_netman]root@xz_netman[/email]
# lockfs -fa
[email=root@xz_netman]root@xz_netman[/email]
# cd /etc
[email=root@xz_netman]root@xz_netman[/email]
# TERM=vt100;export TERM
[email=root@xz_netman]root@xz_netman[/email]
# vi vfstab
[email=root@xz_netman]root@xz_netman[/email]
# vi system
[email=root@xz_netman]root@xz_netman[/email]
# sync
[email=root@xz_netman]root@xz_netman[/email]
# sync
[email=root@xz_netman]root@xz_netman[/email]
# shutdown -y -i6 -g0
[email=root@xz_netman]root@xz_netman[/email]
# metattach d10 d12
d10: submirror d12 is attached
[email=root@xz_netman]root@xz_netman[/email]
# metattach d20 d22
d20: submirror d22 is attached
[email=root@xz_netman]root@xz_netman[/email]
# metastat
[email=root@xz_netman]root@xz_netman[/email]
# eeprom boot-device="disk disk1"
[email=root@xz_netman]root@xz_netman[/email]
# dumpadm -d /dev/md/dsk/d20
      Dump content: kernel pages
       Dump device: /dev/md/dsk/d20 (swap)
Savecore directory: /var/crash/nj_netman
  Savecore enabled: yes
[email=root@xz_netman]root@xz_netman[/email]
# metastat|grep %
    Resync in progress: 0 % done
Resync in progress: 2 % done

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

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP