• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

V880系统盘更换实践

发布: 2007-6-08 22:43 | 作者: seanhe | 来源: | 查看: 77次 | 进入软件测试论坛讨论

领测软件测试网
昨晚和华胜的工程师一起工作了一夜终于把我们的系统盘更换了,下面是操作步骤;
一、背景:
    V880,两块72G光纤硬盘。SunOS5.8 Generic_108528-21 sun4u sparc SUNW,Sun-Fire-880.Disk0是系统盘,disk1是它的克隆盘。现在disk0有问题,要求用新硬盘new disk更换disk0,成功以后重新克隆disk1,使它能够引导系统。
二、操作步骤:
1.拔出disk1硬盘,插入新硬盘new disk,开始克隆系统.
  dd if=/dev/dsk/c1t0d0s2 of=/dev/dsk/c1t1d0s2 
  bs=8192k
注意:c1t0d0s2是源盘disk0,c1t1d0s2是目标盘new disk,
bs 是块的大小。源盘和目标盘一定要分清楚,如果错了,
盘上的数据会全部被删掉。72G的硬盘需要85分钟左右。
2.把克隆好的盘new disk放入原系统的位置,重新启动,不
能启动。发现new disk的WWN与/etc/vfstab里的WWN不匹配,
所以需要修改WWN。(WWN是world wide name 的简称,每一
块盘都有一个唯一的WWN)
3.从光盘引导系统。
   OK boot cdrom –s
安装根文件系统到/mnt
#mount /dev/dsk/c1t0d0s0 /mnt
使new disk /etc/path_to_inst中的设备名与实际/devices
中的设备名一致
#drvconfig  -r /mnt –p /mnt/etc/path_to_inst
#cd /devices
#find . –print |cpio –pduVm  /mnt/devices
创建new disk从逻辑设备到物理设备的正确的连接
#disks –r /mnt
设置new disk 的/dev/dsk/c1t0d0s0 为启动设备
#luxadm set_boot_dev /dev/dsk/c1t0d0s0
4.用硬盘重新启动,能启动,但不能进入图形模式。查找资
料,发现是显示器不能识别。运行下列命令,OK。
# reboot  -- -r
5.到目前为止,disk0 已经被new disk 替代,下面开始克
隆disk1.
# dd if=/dev/dsk/c1t0d0s2 of=/dev/dsk/c1t1d0s2 bs=8192k
  85分钟以后,克隆成功。。
6.更改disk1的/etc/vfstab的设备名。
    #mount /dev/c1t1d0s0 /mnt
    #vi /mnt/etc/vfstab
把所有c1t0d0s* 改成c1t1d0s*.
7.用disk1重新起动。
   OK boot  -r disk1
启动成功。
8.重新恢复disk0启动,一切正常。

 songyupo 回复于:2004-09-23 11:40:18
高手,,,,,学习中,正好我对硬盘不怎么了解

 风之幻想 回复于:2004-09-23 11:44:27
一个相当不错的实践经验,值得学习,谢谢楼主拿出来共享。dd以后一定要改的,要不然是不能自动加载的。

 sonorous 回复于:2004-09-23 13:01:15
强,顶

 jim77 回复于:2004-09-23 13:26:19
为什么不做镜像啊?这样可以简单很多的。

 sunust 回复于:2004-09-23 13:29:23
顶一下

 nimysun 回复于:2004-09-23 13:45:58
楼主的第三步我很欣赏!!!!

 unix探路者 回复于:2004-09-23 13:59:30
谢谢,感谢你的精彩解说,再接再厉,加油在贴几个。

 x3y4z5 回复于:2004-09-23 14:09:33
你的系统是8以前的吧?8以上的系统
Remove the old path_to_inst file:

# mv /mnt/etc/path_to_inst /mnt/etc/orig.path_to_inst

Remove all the old device limks:

# rm /mnt/dev/rdsk/c* ; rm /mnt/dev/dsk/c* ; rm /mnt/dev/rmt/*

Rebuild the device structure using the devfsadm command:

# devfsadm -r /mnt -p /mnt/etc/path_to_inst

 klark 回复于:2004-09-23 14:21:13
正需要!感谢楼主

 unix菜鸟 回复于:2004-09-23 18:54:19
谢谢楼主!

 寒江獨釣 回复于:2004-09-23 21:39:11
也可以用lu(live upgrade) 去代替dd. 很好的一个工具。

 liwenguo 回复于:2004-09-23 21:57:27
880只能装solaris 8 对吧?

 寒江獨釣 回复于:2004-09-23 23:13:27
不会吧。装九是没有问题的。

 flighttop 回复于:2004-09-24 03:40:28
[u:a7601e5aff]# devfsadm -r /mnt -p /mnt/etc/path_to_inst [/u:a7601e5aff] doesn't look right.

 solaris+AIX 回复于:2004-09-24 08:50:13
[quote:59acfab3ae="x3y4z5"]你的系统是8以前的吧?8以上的系统
Remove the old path_to_inst file:

# mv /mnt/etc/path_to_inst /mnt/etc/orig.path_to_inst

Remove all the old device limks:

# rm /mnt/dev/rdsk/c* ; rm /mnt/dev/..........[/quote:59acfab3ae]


太厉害了,在做之前,我就对drvconfig,disks等命令有疑问,因为我知道那是老版本的命令,现在都用devfsadm,但华胜的工程师认为还应该这么做,所以就这么做了。多谢指点迷津,有可能,下次我要实验一下。

 nimysun 回复于:2004-09-24 08:58:40
你这步骤没有一点问题。我昨天做试验给验证过了!!!!

 ywsun 回复于:2004-09-24 09:01:35
好收下了 !
挺棒的实践!

 hlzhan 回复于:2004-09-24 09:24:23
多做了一些浪费时间操作

 hcjia 回复于:2004-09-24 11:25:03
好贴子,很好的经验!!!

 yangjunma 回复于:2004-09-24 14:56:17
不错,这样的实战经验多拿几个出来,谢谢.

 bear 回复于:2004-09-24 15:15:10
SUN 说是连接的关系了,我倒是没注意。。。
Document ID: 26817 
Title: Summary of the devfsadm command in the Solaris[TM] 8 Operating Environment 
Synopsis: Summary of the devfsadm command in the Solaris[TM] 8 Operating Environment 
Update Date: Fri Feb 13 00:00:00 MST 2004 
Description Top 


Document Body Top 

Before the Solaris [TM] 8 Operating Environment release, the drvconfig command was used to configure devices. This command managed the physical device entries in the /devices directory. The commands disks, tapes, devlinks and ports, manage the local device entries in the /dev directory.

Note: The "ports" command creates /dev entries for serial lines.

Now (starting with Solaris 8), both the reconfiguration boot process and the updating of the /dev and /devices directories for dynamic reconfiguration events are handled by the devfsadm command. 

For compatibility purposes, drvconfig and the other commands are symbolic links to devfsadm.

 sunyeait 回复于:2004-09-24 15:42:57
[quote:0a6ff1b3be="solaris+AIX"]昨晚和华胜的工程师一起工作了一夜终于把我们的系统盘更换了,下面是操作步骤;
一、背景:
    V880,两块72G光纤硬盘。SunOS5.8 Generic_108528-21 sun4u sparc SUNW,Sun-Fire-880.Disk0是系统盘,disk1是它的克?.........[/quote:0a6ff1b3be]

5-8步骤有必要执行嘛?!

 木刀客 回复于:2004-09-24 15:59:07
其实好像也不用光盘引导。只要在openboot中。setenv boot-device 
即可。 大概是 /pci@8,600000/SUNW,qlc@4........./disk@wwn号,0:a 
不知各位大虾意下如何?

 anthcho 回复于:2004-09-27 08:54:16
#drvconfig -r /mnt –p /mnt/etc/path_to_inst
#cd /devices
#find . –print |cpio –pduVm /mnt/devices
创建new disk从逻辑设备到物理设备的正确的连接
#disks –r /mnt 


chroot /mnt /usr/sbin/devfsadm will do the same job.

 solarislog 回复于:2004-09-27 11:11:12
第一步我没理解清楚,不是说disk0有问题,怎么却把disk1拿出来。是不是把坏的disk0取出,再把原来的disk1放入disk0的位置,再把新disk放入disk1的位置?

 cqvrboy 回复于:2004-09-27 12:13:36
WWN是如何修改的?我在我的服务器上的/etc/vfstab里面没有看到有什么WWN号啊?
我记得WWN是在硬盘标签上的。

 solaris+AIX 回复于:2004-09-27 13:05:34
[quote:c42fdb3c11="solarislog"]第一步我没理解清楚,不是说disk0有问题,怎么却把disk1拿出来。是不是把坏的disk0取出,再把原来的disk1放入disk0的位置,再把新disk放入disk1的位置?[/quote:c42fdb3c11]


你理解错了,是把新盘放在disk1的插槽里,和disk0 做dd, 保证系统是正确的。

 solaris+AIX 回复于:2004-09-27 13:09:47
[quote:f7641ffb39="cqvrboy"]WWN是如何修改的?我在我的服务器上的/etc/vfstab里面没有看到有什么WWN号啊?
我记得WWN是在硬盘标签上的。[/quote:f7641ffb39]

正常情况下在/etc/vfstab 里看不到WWN 号的,但是当你不更改WWN时,系统启动的时候就会报/etc/vfstab 里的WWN不正确。
 
按照步骤3就可以把WWN 改掉,是指把系统里原有的WWN 改成现有磁盘的WWN。

 klark 回复于:2004-09-28 15:24:57
按照你的方法,我刚刚做了测试(V480 72G两块)。我的过程是这样的:
c1t0d0是系统盘,c1t1d0是需要做得克隆盘
1.dd if=/dev/dsk/c1t0d0s2 of=/dev/dsk/c1t1d0s2 bs=256k
2.克隆完毕后,关机,拔下系统盘,把克隆好的盘插入系统盘位置,这样克隆好的盘为c1t0d0,然后开机。
3.报了很多错误,但是没有提示wwn错误的,提示需要fsck,然后自动回到ok状态。
4.boot cdrom -s
5.mount /dev/dsk/c1t0d0s0 /mnt 的时候提示错误,然后我fsck -y /dev/rdsk/c1t1d0s2 提示好像修复了超级快。
6.重新mount /dev/dsk/c1t0d0s0 /mnt 成功
7.drvconfig -r /mnt -p /mnt/etc/path_to_inst
8.cd /devices
9.find . -print|cpio -pduVm /mnt/devices
10.disks -r /mnt
11.luxadm set_boot_dev /dev/dk/c1t0d0s0
12.reboot -- -r
启动过程中提示某个文件系统错误,需要fsck修复,ctrl+d后仍然可以继续进入到图形界面,然后我又一次fsck -y /dev/rdsk/c1t0d0s2,然后reboot,这次启动提示/export/home文件系统错误(/dev/dsk/c1t0d0s3),需要fsck,ctrl+d进入图形界面。这次我fsck -y /dev/dsk/c1t0d0s3,再次reboot,启动成功!
请问我的错作步骤是否有问题?为什么需要那么多次的fsck后才可以?

 lyh003473 回复于:2004-09-28 16:22:16
最好还 是删了/dev/dsk/*和 /dev/rdsk/* /devices/*

 lovelymouse 回复于:2004-09-28 16:25:50
不知道是华胜的哪位啊?呵呵  
为什么当初没有用disksuite做镜像?那样用disksuite更换硬盘非常省事的啊

 bear 回复于:2004-09-28 16:45:37
“为什么需要那么多次的fsck后才可以?”
因为你做dd时是在原硬盘文件系统活跃的情况下,就回出现几个文件系统都要修复的情况.

 solaris+AIX 回复于:2004-09-28 17:08:07
[quote:9a9314bb74="lovelymouse"]不知道是华胜的哪位啊?呵呵  
为什么当初没有用disksuite做镜像?那样用disksuite更换硬盘非常省事的啊[/quote:9a9314bb74]

跟华胜工程师无关,是我们公司韩国IT中心制订的策略。

 bear 回复于:2004-09-28 17:12:43
做个脱机备份盘?
容灾?

 race 回复于:2004-10-10 08:42:20
[quote:febbf6ba28="x3y4z5"]你的系统是8以前的吧?8以上的系统
Remove the old path_to_inst file:

# mv /mnt/etc/path_to_inst /mnt/etc/orig.path_to_inst

Remove all the old device limks:

# rm /mnt/dev/rdsk/c* ; rm /mnt/dev/..........[/quote:febbf6ba28]

880能装8以前的操作系统吗?

 x3y4z5 回复于:2004-10-11 09:29:23
嗬嗬,疏忽了。老大的眼睛还是毒呀。

 x3y4z5 回复于:2004-10-11 09:31:00
Sun Fire V880   A30     112186-08 or later Solaris 8 7/01 - 750MHz CPUs
                                            Solaris 8 10/01 + all patches - 900MHz CPUs
                                            Solaris 8 2/02 - 900MHz CPUs

 爬虫 回复于:2004-10-11 11:49:17
880为什么系统盘不做镜像,非要这马麻烦啊

 JFPeng 回复于:2004-10-11 20:58:22
Document ID: 40133 
Title: Correcting device paths when replacing fiber boot disks after a ufsrestore 
Synopsis: Correcting device paths when replacing fiber boot disks after a ufsrestore 
Update Date: Thu Jul 29 00:00:00 MDT 2004 
Products:  Solaris  Sun Fire 280R Server 
Technical Areas:  Disk  Fiber  Boot 

--------------------------------------------------------------------------------


--------------------------------------------------------------------------------

Keyword(s):fiber, boot, disk, mounting, root filesystem, corrupted

Description  Top 

A Sun[TM] Microsystems platform, with a fiber disk as the boot disk, is dependent on the disk's World Wide Number (WWN) being included in its physical device path, in order for the system to boot properly. Below is a detail from a Sun Fire[TM] 280R system:

/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w210000203746f423,0:a
----------------------------------------------------------
|
Physical Device Path


/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w210000203746f423,0:a
                                     -----------------
                                              |
                                             WWN
                                                               

If the primary boot device is replaced by a disk which has been ufsrestore'd (from a backup via ufsdump), then the WWN of this disk must be implemented into the Solaris[TM] Operating System device path, and must be associated with the correct  Solaris OS logical device.

Document Body  Top 


To show this as a working example, we copied c1t0d0s0 to c1t1d0s0 on a Sun Fire 280R via ufsdump and ufsrestore, then installed the boot-block. The two disks were switched, emulating the replacement of the primary disk.

Note: The ufsdump and ufsrestore process is not part of the scope of this document. You may refer to INFODOC 16311 and SRDB 17643.

Upon boot, the mounting of the root filesystem will be corrupted, and the boot process may fail, as seen below:

Sun Fire 280R (UltraSPARC-III) , No Keyboard
OpenBoot 4.0, 2048 MB memory installed, Serial #16459995.
Ethe.net address 8:0:20:fb:28:db, Host ID: 80fb28db.

Rebooting with command: boot disk                                     
Boot device: /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@0,0  File and args: 
SunOS Release 5.8 Version Generic_108528-10 64-bit
Copyright 1983-2001 Sun Microsystems, Inc.  All rights reserved.
configuring IPv4 interfaces: eri0.
Hostname: ib-sf280r
mount: /dev/dsk/c1t0d0s0 is not this fstype.
/sbin/rcS: /etc/dfs/sharetab: cannot create
failed to open /etc/coreadm.confsyseventd: 
Unable to open daemon lock file '/etc/sysevent/syseventd_lock': 
'Read-only file system'
INIT: Cannot create /var/adm/utmpx

INIT: failed write of utmpx entry:"  "

INIT: failed write of utmpx entry:"  "

INIT: SINGLE USER MODE

Type control-d to proceed with normal startup,
(or give root password for system maintenance): 
single-user privilege assigned to /dev/console.
Entering System Maintenance Mode

The output from df -k may show the physical disk device mounted, but not the logical device (c1t0d0s0): 

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w210000203746f423,0:a
                     4131866  888592 3201956    22%    /
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
mnttab                     0       0       0     0%    /etc/mnttab
swap                 2756696       0 2756696     0%    /var/run
                  

The disk device that the system was booted from, is disk@w210000203746f423,0:a. This disk's WWN does not match the WWN of the disk that the vfstab file shows to be the boot device. To correct this situation, boot to mini-root from a Solaris OS CD-ROM or install image("boot net -s" or "boot cdrom -s"), and recreate the link, of the physical device path (/devices) to the logical device name (c1t0d0s0) by following the steps below:

ok boot net -s

INIT: SINGLE USER MODE

Mount the root filesystem to /mnt 

# mount /dev/dsk/c1t0d0s0 /mnt                  

Determine (from the vfstab file) the expected logical boot device (c1t0d0s0) 

# more /mnt/etc/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     -                  

Determine if the correct physical disk, as determined by its WWN (World Wide Number), is linked to the logical name (from the vfstab file) of /dev/dsk/c1t0d0s1:

# cd /mnt/dev/dsk    
# ls -al c1t0d0s0
lrwxrwxrwx   1 root     root          70 Sep 10 12:29 c1t0d0s0 ->
 ../../devices/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w2100002037c80681,0:a                  

This shows the disk with the WWN of w2100002037c80681 as the linked disk. The disk device should be w210000203746f423 (as shown in the df -k output above.)

To fix the problem: 

Make the device paths and instance numbers in the /etc/path_to_inst file, equivalent to the miniroot devices from the cdrom/net boot:

# devfsadm -r /mnt -p /mnt/etc/path_to_inst

Make the /device directory equivalent to the mini-root devices created from the cdrom/net boot. This may not be necessary if the correct device tree exists:

# cd /devices
# find . -print|cpio -pduVm /mnt/devices
..................................................
..................................................
..................................................
..................................................
..................................................
............................................
0 blocks                  

Create the links from the correct logical device to the physical device:

# disks -r /mnt

Notice the change in the link from c1t0d0s0 to the correct disk:

# cd /mnt/dev/dsk # ls -l c1t0d0s0 lrwxrwxrwx   1 root     root          70 Sep 11 10:38 c1t0d0s0 -> ../../devices/pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w210000203746f423,0:a 

Alternate fix if using a Solaris 8 OS cdrom or net image:

Remove the old path_to_inst file:

# mv /mnt/etc/path_to_inst /mnt/etc/orig.path_to_inst

Remove all the old device links:

# rm /mnt/dev/rdsk/c* ; rm /mnt/dev/dsk/c* ; rm /mnt/dev/rmt/*

Rebuild the device structure using the devfsadm command:

# devfsadm -r /mnt -p /mnt/etc/path_to_inst

 

Now that the boot device is associated with the correct logical and physical Solaris OS device, this disk will boot, providing the OpenBoot[TM] PROM (OBP) monitor has a correct boot alias (aka disk, disk1 etc). It might be advisable to set the OBP boot-device variable with luxadm prior to rebooting. At a later time, a boot alias can be created at the OBP:

Before:

# eeprom|grep boot-device
boot-device=/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w2100002037c80681,0:a 

# luxadm set_boot_dev /dev/dsk/c1t0d0s0
Do you want to change boot-device to the new setting? (y/n) y
                  

After:

# eeprom|grep boot-device
boot-device=/pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w210000203746f423,0:a
# reboot

A reboot at this point, will boot to the correct boot device, using the boot-device variable. If a boot alias is desired, use show-disks to create it. Then set boot-device to the new alias:

ok show-disks
a) /pci@8,600000/SUNW,qlc@4/fp@0,0/disk
b) /pci@8,700000/scsi@6,1/disk
c) /pci@8,700000/scsi@6/disk
q) NO SELECTION 
Enter Selection, q to quit: a
/pci@8,600000/SUNW,qlc@4/fp@0,0/disk has been selected.
Type ^Y ( Control-Y ) to insert it in the command line. 
e.g. ok nvalias mydev ^Y 
         for creating devalias mydev for 
/pci@8,600000/SUNW,qlc@4/fp@0,0/disk
ok nvalias new-disk /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w210000203746f423,0:a
ok devalias
new-disk                 /pci@8,600000/SUNW,qlc@4/fp@0,0/disk@w210000203746f423,0:a

ok setenv boot-device new-disk
boot-device =         new-disk
ok boot                   

The system should now be booting correctly.

 klark 回复于:2004-10-13 09:00:16
我把新克隆好的系统盘拔下,重新插上以前的系统盘,系统无法启动,提示: 
can't open boot device 
{ok} 
然后就完了,我必须再次用光盘启动然后重复再配置一次才可以进去。然后我把它拔下再换上刚才克隆好的系统盘也又不行了,同样还需要再重复配置一次!我不清楚是不是我的方法有问题,难道就不能使这两块克隆好的系统盘都可以插上就直接使用吗?

 dhbill 回复于:2004-10-16 19:26:54
为什么不做镜像呢?那样会省事很多的.
不过楼主说的也有道理,顶一下!

 wwwlh 回复于:2004-10-17 00:07:02
不用这么麻烦的,使用SMC先做个分区的复制,然后用METATOOL搞个镜像,73G2个小时就OK了,上个月刚搞过一次。

 lylklb 回复于:2004-11-18 14:08:46
楼主不是都已说了Disk0有问题! 怎么还将它作为源盘来克隆Disk1 !!??

 blessfish 回复于:2005-09-07 11:44:28
好像步骤确实复杂了,是什么系统呢?8或者以后的应该没有这么复杂的

 Philmoon 回复于:2005-09-07 12:48:56
2点疑惑及猜想:
1。既然说disk0有问题,disk1是它的克隆盘,为什么还用不可靠的disk0来做new_disk的克隆源盘而不用disk1?也许是disk1上的内容没有随disk0内容变化及时更新而过时了吧。
2。第二次从new_disk到disk1的克隆,为何只修改disk1上新的vfstab就可以而不出现WWN问题?估计是boot disk1起来的吧。那么如果在第一次克隆前先让系统识别到new_disk,第一次克隆后,修改new_disk上的vfstab,然后boot new_disk也应该是可行的吧(当然此后要修改boot-device)。这样好象简单些。

 shooterchan 回复于:2005-09-07 13:58:55
学习中

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网