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

SPARC: 添加系统磁盘或辅助磁盘(任务列表)

以下任务列表介绍了将磁盘添加到基于 SPARC 的系统的过程。

任务 

说明 

参考 

1. 连接磁盘并进行引导。 

系统磁盘

连接新磁盘并从本地或远程 Solaris CD 或 DVD 进行引导。  

SPARC: 如何连接系统磁盘并进行引导

 

辅助磁盘

连接新磁盘并执行重新配置引导,以便系统可识别该磁盘。  

SPARC: 如何连接辅助磁盘并进行引导

2. 创建片并标记磁盘。 

如果磁盘制造商尚未创建磁盘片和标记磁盘,请创建磁盘片并标记磁盘。 

SPARC: 如何创建磁盘片和标记磁盘

3. 创建文件系统。 

使用 newfs 命令在磁盘片上创建 UFS 文件系统。必须为系统磁盘创建根 (/) 文件系统和/或 /usr 文件系统。

SPARC: 如何创建 UFS 文件系统

4. 恢复文件系统。 

在系统磁盘上恢复根 (/) 文件系统和/或 /usr 文件系统。如有必要,请在辅助磁盘上恢复文件系统。

第 27 章,恢复文件和文件系统(任务)

5. 安装引导块。 

仅限系统磁盘。在根 (/) 文件系统上安装引导块,以便该系统可以引导。

SPARC: 如何在系统磁盘上安装引导块

SPARC: 添加系统磁盘或辅助磁盘

系统磁盘包含根 (/) 文件系统和/或 /usr 文件系统。如果包含其中任一文件系统的磁盘损坏,则可以使用以下两种方法恢复文件系统:

辅助磁盘不包含根 (/) 文件系统和 /usr 文件系统。辅助磁盘通常包含用于存储用户文件的空间。可以将辅助磁盘添加到系统以获得更多磁盘空间。或者,可以更换损坏的辅助磁盘。如果更换系统中的辅助磁盘,则可以在新磁盘上恢复旧磁盘的数据。

ProcedureSPARC: 如何连接系统磁盘并进行引导

此过程假定系统已关闭。

  1. 断开损坏的系统磁盘与系统之间的连接。

  2. 确保所添加的磁盘与系统中的其他设备具有不同的目标号码。

    通常,磁盘背面有一个用于此目的的小开关。

  3. 将用来替换的系统磁盘连接到系统,并检查物理连接。

    有关详细信息,请参阅磁盘的硬件安装指南。

  4. 根据从本地 Solaris CD 或 DVD 还是从网络中的远程 Solaris CD 或 DVD 引导,按照下表中的说明进行操作。

    引导类型 

    操作 

    从本地驱动器中的 Solaris CD 或 DVD 

    1. 确保 Solaris 软件 1 CD 或 Solaris DVD 位于驱动器中。 

    2. 从介质引导到单用户模式: 

    ok boot cdrom -s

    从网络 

    从网络引导到单用户模式:  

    ok boot net -s

    几分钟后,将显示超级用户提示符 (#)。

连接系统磁盘并进行引导后...

引导系统后,可以在磁盘上创建片和磁盘标号。请转至SPARC: 如何创建磁盘片和标记磁盘

ProcedureSPARC: 如何连接辅助磁盘并进行引导

如果要添加磁盘标号为 EFI 的磁盘,请参见带有 EFI 磁盘标号的多 TB 磁盘支持以了解更多信息。

通常,大多数新式总线类型支持热插拔。如果系统的总线类型支持热插拔,则可能无需执行下面的步骤 2 或 3。

有关热插拔设备的更多信息,请参见第 6 章,动态配置设备(任务)

  1. 成为超级用户或承担等效角色。

  2. (可选的)如果 Solaris 软件不支持该磁盘类型,请按照硬件附带的说明,添加磁盘的设备驱动程序。

    有关为磁盘创建 format.dat 项的信息,请参见如何创建 format.dat(如有必要)。

  3. (可选的)创建将在引导系统时读取的 /reconfigure 文件。


    # touch /reconfigure
    

    稍后打开系统电源或引导系统时,/reconfigure 文件会使 SunOSTM 软件检查是否存在任何新安装的外围设备。

  4. 关闭系统。


    # shutdown -i0 -gn -y
    
    -i0

    更改为运行级 0(即关闭电源状态)。

    -gn

    通知已登录的用户,n 秒之后系统将开始关闭。

    -y

    指定命令应该在没有用户干预的情况下运行。

    在关闭 Solaris OS 后将显示 ok 提示符。

  5. 关闭系统和所有外部外围设备的电源。

  6. 确保所添加的磁盘与系统中的其他设备具有不同的目标号码。

    通常,磁盘背面有一个用于此目的的小开关。

  7. 将磁盘连接到系统并检查物理连接。

    有关详细信息,请参阅磁盘的硬件安装指南。

  8. 打开所有外部外围设备的电源。

  9. 打开系统的电源。

    系统将引导并显示登录提示。

连接辅助磁盘并进行引导之后

引导系统后,可以在磁盘上创建片和磁盘标号。请转至SPARC: 如何创建磁盘片和标记磁盘

ProcedureSPARC: 如何创建磁盘片和标记磁盘

  1. 成为超级用户或承担等效角色。

  2. 调用 format 实用程序。


    # format
    

    将显示可用磁盘的编号列表。有关更多信息,请参见 format(1M)

  3. 键入要重新分区的磁盘的编号。


    Specify disk (enter its number): disk-number
    

    disk-number 是要重新分区的磁盘的编号。

  4. 选择 partition 菜单。


    format> partition
    
  5. 显示当前分区(片)表。


    partition> print
    
  6. 开始修改过程。


    partition> modify
    
  7. 将磁盘全部设置为浮动片 (free hog slice)。


    Choose base (enter number) [0]?1
    

    有关浮动片 (free hog slice) 的更多信息,请参见使用浮动片 (free hog slice)

  8. 通过在提示您继续时应答 y 创建新分区表。


    Do you wish to continue creating a new partition table based on 
    
    above table[yes]? y
    
  9. 出现提示时,标识浮动 (free hog) 分区(片)和片大小。

    添加系统磁盘时,必须为以下项设置片:

    • 根文件系统(片 0)和交换区域(片 1)

    • /usr(片 6)

    标识片后,将显示新的分区表。

    有关创建磁盘片的示例,请参见示例 13–1

  10. 通过在提示时应答 y,使显示的分区表成为当前分区表。


    Okay to make this the current partition table[yes]? y
    

    如果不需要当前分区表但希望对其进行更改,请应答 no 并转至步骤 6

  11. 命名分区表。


    Enter table name (remember quotes): "partition-name"
    

    其中 partition-name 是新分区表的名称。

  12. 在新磁盘上完成片的分配后,用新分区表标记磁盘。


    Ready to label disk, continue? yes
    
  13. 退出 partition 菜单。


    partition> q
    
  14. 验证磁盘标号。


    format> verify
    
  15. 退出 format 实用程序。


    format> q
    

示例 13–1 SPARC: 创建磁盘片和标记系统磁盘

以下示例说明如何使用 format 实用程序将 18 GB 的磁盘分成三个片:其中一个片用于根 (/) 文件系统,一个片用于交换区域,还有一个片用于 /usr 文件系统。


# format

AVAILABLE DISK SELECTIONS:

       0. /dev/rdsk/c1t0d0s0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>

          /sbus@2,0/QLGC,isp@2,10000/sd@0,0

       1. /dev/rdsk/c1t1d0s0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>

          /sbus@2,0/QLGC,isp@2,10000/sd@1,0

       2. /dev/rdsk/c1t8d0s0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>

          /sbus@2,0/QLGC,isp@2,10000/sd@8,0

       3. /dev/rdsk/c1t9d0s0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>

          /sbus@2,0/QLGC,isp@2,10000/sd@9,0

Specify disk (enter its number): 0

selecting c1t0d0

[disk formatted]

format> partition

partition> print

partition> modify

Select partitioning base:

	0. Current partition table (original)

	1. All Free Hog

Part      Tag    Flag     Cylinders        Size            Blocks

  0       root    wm       0               0         (0/0/0)           0

  1       swap    wu       0               0         (0/0/0)           0

  2     backup    wu       0 - 7505       16.86GB    (7506/0/0) 35368272

  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       0               0         (0/0/0)           0

  7 unassigned    wm       0               0         (0/0/0)           0



Choose base (enter number) [0]? 1

table based on above table[yes]? yes

Free Hog partition[6]? 6

Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]: 4gb

Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]: 4gb

Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]: 

Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]: 

Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]: 

Enter size of partition '7' [0b, 0c, 0.00mb, 0.00gb]: 

Part      Tag    Flag     Cylinders        Size            Blocks

  0       root    wm       0 - 1780        4.00GB    (1781/0/0)  8392072

  1       swap    wu    1781 - 3561        4.00GB    (1781/0/0)  8392072

  2     backup    wu       0 - 7505       16.86GB    (7506/0/0) 35368272

  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    3562 - 7505        8.86GB    (3944/0/0) 18584128

  7 unassigned    wm       0               0         (0/0/0)           0

 

Okay to make this the current partition table[yes]? yes

Enter table name (remember quotes): "disk0"

Ready to label disk, continue? yes

partition> quit

format> verify

format> quit


示例 13–2 SPARC: 创建磁盘片和标记辅助磁盘

以下示例说明如何使用 format 实用程序将一个 18 GB 的磁盘分成用于 /export/home 文件系统的一个片。


# format /dev/rdsk/c1*

AVAILABLE DISK SELECTIONS:

       0. /dev/rdsk/c1t0d0s0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>

          /sbus@2,0/QLGC,isp@2,10000/sd@0,0

       1. /dev/rdsk/c1t1d0s0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>

          /sbus@2,0/QLGC,isp@2,10000/sd@1,0

       2. /dev/rdsk/c1t8d0s0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>

          /sbus@2,0/QLGC,isp@2,10000/sd@8,0

       3. /dev/rdsk/c1t9d0s0 <SUN18G cyl 7506 alt 2 hd 19 sec 248>

          /sbus@2,0/QLGC,isp@2,10000/sd@9,0

Specify disk (enter its number): 1

selecting c1t1d0

[disk formatted]

format> partition

partition> print

partition> modify

Select partitioning base:

	0. Current partition table (original)

	1. All Free Hog

Choose base (enter number) [0]? 1

Part      Tag    Flag     Cylinders        Size            Blocks

  0       root    wm       0               0         (0/0/0)           0

  1       swap    wu       0               0         (0/0/0)           0

  2     backup    wu       0 - 7505       16.86GB    (7506/0/0) 35368272

  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       0               0         (0/0/0)           0

  7 unassigned    wm       0               0         (0/0/0)           0



Do you wish to continue creating a new partition

table based on above table[yes]? y

Free Hog partition[6]? 7

Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]: 

Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]: 

Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]: 

Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]: 

Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]: 

Enter size of partition '6' [0b, 0c, 0.00mb, 0.00gb]:

Part      Tag    Flag     Cylinders        Size            Blocks

  0       root    wm       0               0         (0/0/0)           0

  1       swap    wu       0               0         (0/0/0)           0

  2     backup    wu       0 - 7505       16.86GB    (7506/0/0) 35368272

  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       0               0         (0/0/0)           0

  7 unassigned    wm       0 - 7505       16.86GB    (7506/0/0) 35368272

Okay to make this the current partition table[yes]? yes

Enter table name (remember quotes): "home"

Ready to label disk, continue? y

partition> q

format> verify

format> q

# 

以下示例说明如何使用 format 实用程序,将标号为 EFI 的 1.15 TB 磁盘分成三个片。


# format

.

.

.

partition> modify

Select partitioning base:

        0. Current partition table (original)

        1. All Free Hog

Choose base (enter number) [0]? 1

Part      Tag    Flag     First Sector          Size          Last Sector

  0       root    wm                 0            0                0    

  1        usr    wm                 0            0                0    

  2 unassigned    wm                 0            0                0    

  3 unassigned    wm                 0            0                0    

  4 unassigned    wm                 0            0                0    

  5 unassigned    wm                 0            0                0    

  6        usr    wm                 0            0                0    

  8   reserved    wm        2576924638         8.00MB           2576941021

Do you wish to continue creating a new partition

table based on above table[yes]? y

Free Hog partition[6]? 4

Enter size of partition 0 [0b, 34e, 0mb, 0gb, 0tb]: 

Enter size of partition 1 [0b, 34e, 0mb, 0gb, 0tb]: 

Enter size of partition 2 [0b, 34e, 0mb, 0gb, 0tb]: 400gb

Enter size of partition 3 [0b, 838860834e, 0mb, 0gb, 0tb]: 400gb

Enter size of partition 5 [0b, 1677721634e, 0mb, 0gb, 0tb]: 

Enter size of partition 6 [0b, 1677721634e, 0mb, 0gb, 0tb]: 

Part      Tag    Flag     First Sector          Size          Last Sector

  0 unassigned    wm                 0            0                0    

  1 unassigned    wm                 0            0                0    

  2        usr    wm                34       400.00GB           838860833

  3        usr    wm         838860834       400.00GB           1677721633

  4        usr    wm        1677721634       428.77GB           2576924637

  5 unassigned    wm                 0            0                0    

  6 unassigned    wm                 0            0                0    

  8   reserved    wm        2576924638         8.00MB           2576941021

Ready to label disk, continue? yes



partition> q

创建磁盘片和标记磁盘之后

创建磁盘片并标记磁盘后,可以在磁盘上创建文件系统。请转至SPARC: 如何创建 UFS 文件系统

ProcedureSPARC: 如何创建 UFS 文件系统

  1. 成为超级用户或承担等效角色。

  2. 为每个片创建文件系统。


    # newfs /dev/rdsk/cwtxdysz
    

    其中 /dev/rdsk/cwtxdysx 是要创建的文件系统的原始设备。

    有关 newfs 命令的更多信息,请参见第 18 章,创建 UFS、TMPFS 和 LOFS 文件系统(任务)newfs(1M)

  3. 通过挂载新文件系统对其进行验证。


    # mount /dev/dsk/cwtxdysz /mnt
    
    # ls 
    
    lost+found
创建 UFS 文件系统之后

ProcedureSPARC: 如何在系统磁盘上安装引导块

  1. 成为超级用户或承担等效角色。

  2. 在系统磁盘上安装引导块。


    # installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk
    
    /dev/rdsk/cwtxdys0
    
    /usr/platform/`uname -i`/lib/fs /ufs/bootblk

    是引导块代码。

    /dev/rdsk/cwtxdy s0

    是根 (/) 文件系统的原始设备。

    有关更多信息,请参见 installboot(1M)

  3. 通过将系统重新引导到运行级 3,验证是否已安装引导块。


    # init 6
    

示例 13–3 SPARC: 在系统磁盘上安装引导块

以下示例说明如何在 UltraTM 10 系统中安装引导块。


# installboot /usr/platform/sun4u/lib/fs/ufs/bootblk

/dev/rdsk/c0t0d0s0