系统管理指南:设备和文件系统

恢复损坏的磁盘标号

有时,电源或系统故障会导致磁盘标号变得无法识别。损坏的磁盘标号并不总是意味着,必须重新创建或恢复片信息或磁盘数据。

要恢复损坏的磁盘标号,首先应使用正确的几何参数和磁盘类型信息标记磁盘。可以通过常规的磁盘标记方法完成该步骤,即使用自动配置或手动指定磁盘类型。

如果 format 实用程序识别该磁盘类型,则下一步是搜索备份标号以标记磁盘。使用备份标号标记磁盘时,会以正确的分区信息、磁盘类型和磁盘几何参数来标记磁盘。

Procedure如何恢复损坏的磁盘标号

  1. 将系统引导到单用户模式。

    如有必要,请在单用户模式下从本地 CD-ROM 或网络引导系统以访问磁盘。

    有关引导系统的信息,请参见《系统管理指南:基本管理》中的第 10  章 “引导系统(任务)”《系统管理指南:基本管理》中的第 11  章 “基于 GRUB 的引导(任务)”

  2. 重新标记磁盘。


    # format
    

    format 实用程序会尝试自动配置任何未标记的 SCSI 磁盘。如果 format 实用程序能够配置未标记的已损坏磁盘,则它将显示以下消息:


    cwtxdy: configured with capacity of abcMB

    format 实用程序然后显示系统中磁盘的编号列表。

  3. 键入需要恢复的磁盘的编号。


    Specify disk (enter its number): 1
    
  4. 选择以下内容之一以确定如何标记磁盘。

    • 如果已成功配置磁盘,则按照步骤 5 和 6 进行操作,然后转至步骤 12。

    • 如果磁盘未成功配置,则按照步骤 7–11 操作,然后转至步骤 12。

  5. 搜索备份标号。


    format> verify
    
    Warning: Could not read primary label.
    
    Warning: Check the current partitioning and 'label' the disk or 
    
    use the 'backup' command.
    
    Backup label contents:
    
    Volume name = <        >
    
    ascii name  = <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
    
    pcyl        = 2038
    
    ncyl        = 2036
    
    acyl        =    2
    
    nhead       =   14
    
    nsect       =   72
    
    Part      Tag    Flag     Cylinders        Size            Blocks
    
      0       root    wm       0 -  300      148.15MB    (301/0/0)   303408
    
      1       swap    wu     301 -  524      110.25MB    (224/0/0)   225792
    
      2     backup    wm       0 - 2035     1002.09MB    (2036/0/0) 2052288
    
      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     525 - 2035      743.70MB    (1511/0/0) 1523088
    
      7 unassigned    wm       0               0         (0/0/0)          0
  6. 如果 format 实用程序找到备份标号,而且备份标号的内容符合要求,请使用 backup 命令以备份标号标记磁盘。


    format> backup
    
    Disk has a primary label, still continue? y
    
     
    
    Searching for backup labels...found.
    
    Restoring primary label

    磁盘标号已恢复。转至步骤 12。

  7. 如果 format 实用程序无法自动配置磁盘,请使用 type 命令指定磁盘类型。


    format> type
    

    将显示 "Available Drive Types" 菜单。

  8. 选择 0 以自动配置磁盘。或者,从可能的磁盘类型列表中选择一种磁盘类型。


    Specify disk type (enter its number)[12]: 12
    
  9. 如果成功配置磁盘,则在 format 实用程序询问您是否要标记磁盘时应答 no


    Disk not labeled.  Label it now?  no
    
  10. 使用 verify 命令搜索备份标号。


    format> verify
    
    Warning: Could not read primary label.
    
    Warning: Check the current partitioning and 'label' the disk
    
    or use the 'backup' command.
    
    .
    
    .
    
    .
  11. 如果 format 实用程序找到备份标号,而且备份标号的内容符合要求,请使用 backup 命令以备份标号标记磁盘。


    format> backup
    
    Disk has a primary label, still continue? y
    
    Searching for backup labels...found.
    
    Restoring primary label

    磁盘标号已恢复。

  12. 退出 format 实用程序。


    format> q
    
  13. 使用 fsck 命令验证已恢复磁盘上的文件系统。

    有关使用 fsck 命令的信息,请参见第 22 章,检查 UFS 文件系统一致性(任务)