如果系统中的磁盘存在有缺陷的扇区,可以按照本节中的过程修复磁盘。在执行以下操作时,可能会发现存在有缺陷的扇区:
对磁盘运行表面分析
有关 format 实用程序的分析功能的更多信息,请参见analyze 菜单。
如果系统中的磁盘包含有缺陷的扇区,可以按照本节中的过程修复磁盘。由于系统同时对磁盘上的许多扇区执行操作,因此,通常很难准确查明是哪个扇区导致了给定的错误。要找到确切的一个或多个扇区,请使用如何使用表面分析确定有缺陷的扇区。
系统运行时,从磁盘驱动程序中获得有关磁盘特定部分的多个错误消息。
与磁盘错误有关的控制台消息与以下内容类似:
WARNING: /io-unit@f,e0200000/sbi@0,0/QLGC,isp@1,10000/sd@3,0 (sd33): Error for command 'read' Error Level: Retryable Requested Block 126, Error Block: 179 Sense Key: Media Error Vendor 'name': ASC = 0x11 (unrecovered read error), ASCQ = 0x0, FRU = 0x0 |
此消息指示块 179 可能有缺陷。使用 format 实用程序的 repair 命令,可以重新定位有缺陷的块。或者,可以在启用修复选项的情况下使用 analyze 命令。
成为超级用户或承担等效角色。
取消挂载包含有缺陷扇区的片中的文件系统。
# umount /dev/dsk/device-name |
有关更多信息,请参见 mount(1M)。
调用 format 实用程序。
# format |
选择受影响的磁盘。
Specify disk (enter its number):1 selecting c0t2d0: [disk formatted] Warning: Current Disk has mounted partitions. |
选择 analyze 菜单。
format> analyze |
通过在 analyze> 提示符下键入 setup 设置分析参数。
使用如下所示的参数:
analyze> setup Analyze entire disk [yes]? n Enter starting block number [0, 0/0/0]: 12330 Enter ending block number [2052287, 2035/13/71]: 12360 Loop continuously [no]? y Repair defective blocks [yes]? n Stop after first error [no]? n Use random bit patterns [no]? n Enter number of blocks per transfer [126, 0/1/54]: 1 Verify media after formatting [yes]? y Enable extended messages [no]? n Restore defect list [yes]? y Create defect label [yes]? y |
使用 read 命令查找缺陷。
analyze> read Ready to analyze (won't harm SunOS). This takes a long time, but is interruptible with Control-C. Continue? y pass 0 2035/12/1825/7/24 pass 1 Block 12354 (18/4/18), Corrected media error (hard data ecc) 25/7/24 ^C Total of 1 defective blocks repaired. |
成为超级用户或承担等效角色。
调用 format 实用程序。
# format |
选择存在有缺陷扇区的磁盘。
Specify disk (enter its number): 1 selecting c0t3d0 [disk formatted] format> |
选择 repair 命令。
format> repair |
键入有缺陷块的编号。
Enter absolute block number of defect: 12354 Ready to repair defect, continue? y Repairing block 12354 (18/4/18)...ok. format> |
如果不能确定用于确定有缺陷扇区的格式,请参见如何使用表面分析确定有缺陷的扇区以了解更多信息。