系统磁盘包含根 (/) 文件系统和/或 /usr 文件系统。如果包含其中任一文件系统的磁盘损坏,则可以使用以下两种方法恢复文件系统:
可以重新安装整个 Solaris OS。
或者,可以更换系统磁盘,然后从备份介质恢复文件系统。
辅助磁盘不包含根 (/) 文件系统和 /usr 文件系统。辅助磁盘通常包含用于存储用户文件的空间。可以将辅助磁盘添加到系统以获得更多磁盘空间。或者,可以更换损坏的辅助磁盘。如果更换系统中的辅助磁盘,则可以在新磁盘上恢复旧磁盘的数据。
此过程假定已关闭操作系统。
断开损坏的系统磁盘与系统之间的连接。
通常,磁盘背面有一个用于此目的的小开关。
将用来替换的系统磁盘连接到系统,并检查物理连接。
有关详细信息,请参阅磁盘的硬件安装指南。
引导系统。
此过程假定将从 GRUB 的 Solaris 故障安全引导选项进行引导。
如果磁盘小于 1 TB,则可以创建 fdisk 分区。请转至x86: 如何创建 Solaris fdisk 分区。
通过新的 fdisk 菜单选项,可以在新标识符和旧标识符之间来回切换。即使挂载了分区中包含的文件系统,也可以更改 fdisk 标识符。
fdisk 菜单中的两个 type 值反映旧标识符和新标识符,如下所示:
Solaris 标识 0x82
Solaris2 标识 0xbf
成为超级用户。
显示当前的 fdisk 标识符。
例如:
Total disk size is 39890 cylinders Cylinder size is 4032 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 Active x86 Boot 1 6 6 0 2 Solaris2 7 39889 39883 100 |
从 fdisk 菜单中选择选项 4,将 fdisk 分区标识符更改回 0x82
SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: 4 |
选择选项 5 更新磁盘配置并退出。
如有必要,请从 fdisk 菜单中选择选项 4,将 fdisk 分区标识符更改回 0xbf。
例如:
Total disk size is 39890 cylinders Cylinder size is 4032 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 Active x86 Boot 1 6 6 0 2 Solaris 7 39889 39883 100 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: 4 |
选择选项 5 更新磁盘配置并退出。
有关在 x64 系统上添加磁盘标号为 EFI 的磁盘的信息,请参见带有 EFI 磁盘标号的多 TB 磁盘支持以了解更多信息。
通常,大多数新式总线类型支持热插拔。如果系统的总线类型支持热插拔,则可能无需执行下面的步骤 2 或 3。
有关热插拔设备的更多信息,请参见第 6 章,动态配置设备(任务)。
成为超级用户或承担等效角色。
(可选的)如果磁盘不受 Solaris 软件的支持,请按照硬件附带的说明,添加磁盘的设备驱动程序。
(可选的)创建将在引导系统时读取的 /reconfigure 文件。
# touch /reconfigure |
稍后打开系统电源或引导系统时,/reconfigure 文件会使 SunOSTM 软件检查是否存在任何新安装的外围设备。
关闭系统。
# shutdown -i0 -gn -y |
将系统降至运行级 0(即电源关闭状态)。
通知已登录的用户,n 秒之后系统将开始关闭。
指定命令应该在没有用户干预的情况下运行。
将显示提示 Press any key to reboot。
关闭系统和所有外部外围设备的电源。
通常,磁盘背面有一个用于此目的的小开关。
将磁盘连接到系统并检查物理连接。
有关详细信息,请参阅磁盘的硬件安装指南。
打开所有外部外围设备的电源。
打开系统的电源。
系统将引导并显示登录提示。
引导系统后,如果磁盘小于 1 TB,则可以创建 fdisk 分区。请转至x86: 如何创建 Solaris fdisk 分区。
设置一个或多个 fdisk 分区时,请遵循以下准则。
fdisk 命令不能在大于 1 TB、标号为 EFI 的磁盘上使用。
磁盘最多可以分成四个 fdisk 分区。其中一个分区必须是 Solaris 分区。
Solaris 分区必须是磁盘上的活动分区。系统启动时,缺省引导的操作系统所在的分区即为活动分区。
Solaris fdisk 分区必须从柱面边界开始。
Solaris fdisk 分区必须从第一个磁盘上的柱面 1 而不是柱面 0 开始,因为其他引导信息(包括主引导记录)写在扇区 0 中。
Solaris fdisk 分区可以是整个磁盘。或者,可能希望使其变小以便为 DOS 分区留出空间。也可以在不干扰现有分区(如果有充足的可用空间)的情况下,在磁盘上设置新的 fdisk 分区以创建新分区。
Solaris 片也称为分区。某些界面可能将片称为分区。
只有基于 x86 的系统支持 fdisk 分区。为避免混淆,Solaris 文档尝试区分 fdisk 分区和 Solaris fdisk 分区中的实体。这些实体可能称为片或分区。
如果需要有关 fdisk 分区的信息,请参见x86: fdisk 分区创建准则。
成为超级用户或承担等效角色。
# format |
将显示可用磁盘的编号列表。
有关更多信息,请参见 format(1M)。
键入要创建 Solaris fdisk 分区的磁盘的编号。
Specify disk (enter its number): disk-number |
其中 disk-number 是要创建 Solaris fdisk 分区的磁盘的编号。
选择 fdisk 菜单。
format> fdisk |
所显示的 fdisk 菜单取决于磁盘上是否已存在fdisk 分区。使用下表确定下一步操作。
任务 |
请转至 |
更多信息 |
---|---|---|
创建一个跨整个磁盘的 Solaris fdisk 分区。 |
步骤 5 | |
创建一个 Solaris fdisk 分区,并保留一个或多个现有的非 Solaris fdisk 分区。 |
步骤 6 | |
创建一个 Solaris fdisk 分区以及一个或多个其他非 Solaris fdisk 分区。 |
步骤 6 |
通过在提示符下指定 y,创建并激活跨整个磁盘的 Solaris fdisk 分区。然后,转至步骤 13。
No fdisk table exists. The default partition for the disk is: a 100% "SOLARIS System" partition Type "y" to accept the default partition, otherwise type "n" to edit the partition table. y |
如果不希望 Solaris fdisk 分区占满整个磁盘,请在提示符下指定 n。
Type "y" to accept the default partition, otherwise type "n" to edit the partition table. n Total disk size is 3498 cylinders Cylinder size is 1199 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ======== ===== === ====== === SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: |
选择选项 1 (Create a partition) 以创建 fdisk 分区。
Enter Selection: 1 |
通过选择 1(=Solaris2) 创建 Solaris fdisk 分区。
Indicate the type of partition you want to create 1=SOLARIS2 2=UNIX 3=PCIXOS 4=Other 5=DOS12 6=DOS16 7=DOSEXT 8=DOSBIG 9=DOS16LBA A=x86 Boot B=Diagnostic C=FAT32 D=FAT32LBA E=DOSEXTLBA F=EFI 0=Exit? 1 |
确定要为 Solaris fdisk 分区保留的磁盘百分比。计算此百分比时,请牢记任何现有 fdisk 分区的大小。
Specify the percentage of disk to use for this partition (or type "c" to specify the size in cylinders). nn |
通过在提示符下键入 y,激活 Solaris fdisk 分区。
Should this to become the active partition? If yes, it will be activated each time the computer is reset or turned on. Please type "y" or "n". y |
激活 fdisk 分区后,将显示提示 Enter Selection。
选择选项 1 Create a partition 以创建另一个 fdisk 分区。
有关创建 fdisk 分区的说明,请参见步骤 8–10。
更新磁盘配置,然后从 selection 菜单退出 fdisk 菜单。
Selection: 5 |
使用 label 命令重新标记磁盘。
format> label Ready to label disk, continue? yes format> |
退出 format 实用程序。
format> quit |
以下示例使用 format 实用程序的 fdisk 选项创建一个占满整个驱动器的 Solaris fdisk 分区。
# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0d0 <DEFAULT cyl 2466 alt 2 hd 16 sec 63> /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0 1. c0d1 <DEFAULT cyl 522 alt 2 hd 32 sec 63> /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0 2. c1d0 <DEFAULT cyl 13102 alt 2 hd 16 sec 63> /pci@0,0/pci-ide@7,1/ide@1/cmdk@0,0 Specify disk (enter its number): 0 selecting c0d0 Controller working list found [disk formatted] format> fdisk No fdisk table exists. The default partitioning for your disk is: a 100% "SOLARIS System" partition. Type "y" to accept the default partition, otherwise type "n" to edit the partition table. y format> label Ready to label disk, continue? yes format> quit |
以下示例说明如何在包含现有 DOS-BIG fdisk 分区的磁盘上创建 Solaris fdisk 分区。
format> fdisk Total disk size is 3498 cylinders Cylinder size is 1199 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 Active DOS-BIG 1 699 699 20 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: 1 Indicate the type of partition you want to create 1=SOLARIS2 2=UNIX 3=PCIXOS 4=Other 5=DOS12 6=DOS16 7=DOSEXT 8=DOSBIG 9=DOS16LBA A=x86 Boot B=Diagnostic C=FAT32 D=FAT32LBA E=DOSEXTLBA F=EFI 0=Exit?1 Indicate the percentage of the disk you want this partition to use (or enter "c" to specify in cylinders). 80 Should this become the active partition? If yes, it will be activated each time the computer is or turned on. Please type "y" or "n". y Total disk size is 3498 cylinders Cylinder size is 1199 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 DOS-BIG 1 699 699 20 2 Active Solaris2 700 3497 2798 80 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection:5 Partition 2 is now the active partition format> label Ready to label disk, continue? yes format> q |
以下示例说明如何创建 Solaris fdisk 分区和 DOSBIG fdisk 分区。
format> fdisk No fdisk table exists. The default partitioning for your disk is: a 100% "SOLARIS System" partition. Type "y" to accept the default partition, otherwise type "n" to edit the partition table. n Total disk size is 3498 cylinders Cylinder size is 1199 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: 1 Indicate the type of partition you want to create 1=SOLARIS2 2=UNIX 3=PCIXOS 4=Other 5=DOS12 6=DOS16 7=DOSEXT 8=DOSBIG 9=DOS16LBA A=x86 Boot B=Diagnostic C=FAT32 D=FAT32LBA E=DOSEXTLBA F=EFI 0=Exit? 8 Specify the percentage of disk to use for this partition (or type "c" to specify the size in cylinders)20 Should this to become the Active partition? If yes, it will be activated each time the computer is reset or turned on. again. Please type "y" or "n". n Total disk size is 3498 cylinders Cylinder size is 1199 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 DOS-BIG 1 699 699 20 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: 1 Indicate the type of partition you want to create 1=SOLARIS2 2=UNIX 3=PCIXOS 4=Other 5=DOS12 6=DOS16 7=DOSEXT 8=DOSBIG 9=DOS16LBA A=x86 Boot B=Diagnostic C=FAT32 D=FAT32LBA E=DOSEXTLBA F=EFI 0=Exit? 1 Indicate the percentage of the disk you want this partition to use (or enter "c" to specify in cylinders). 80 Should this become the active partition? If yes, it will be activated each time the computer is reset or turned on. Please type "y" or "n". y Total disk size is 3498 cylinders Cylinder size is 1199 (512 byte) blocks Cylinders Partition Status Type Start End Length % ========= ====== ============ ===== === ====== === 1 DOS-BIG 1 699 699 20 2 Active Solaris2 700 3497 2798 80 SELECT ONE OF THE FOLLOWING: 1. Create a partition 2. Specify the active partition 3. Delete a partition 4. Change between Solaris and Solaris2 Partition IDs 5. Exit (update disk configuration and exit) 6. Cancel (exit without updating disk configuration) Enter Selection: 5 Partition 2 is now the Active partition format> q |
在磁盘上创建 Solaris fdisk 分区后,可以在该磁盘上创建片。请转至x86: 如何创建磁盘片和标记磁盘
成为超级用户或承担等效角色。
# format |
将显示可用磁盘的编号列表。
键入要重新分区的磁盘的编号。
Specify disk (enter its number): disk-number |
其中 disk-number 是要重新分区的磁盘的编号。
选择 partition 菜单。
format> partition |
显示当前分区(片)表。
partition> print |
开始修改过程。
partition> modify |
将磁盘全部设置为浮动片 (free hog slice)。
Choose base (enter number) [0]? 1 |
有关浮动片 (free hog slice) 的更多信息,请参见使用浮动片 (free hog slice)。
在提示继续时应答 yes 创建新分区表。
Do you wish to continue creating a new partition table based on above table[yes]? yes |
出现提示时,标识浮动 (free hog) 分区(片)和片大小。
添加系统磁盘时,必须为以下项设置片:
根文件系统(片 0)和交换区域(片 1)和/或
/usr(片 6)
标识片后,将显示新的分区表。
通过在出现提示时应答 yes,使显示的分区表成为当前分区表。
Okay to make this the current partition table[yes]? yes |
如果不需要当前分区表但希望对其进行更改,请应答 no 并转至步骤 6。
命名分区表。
Enter table name (remember quotes): "partition-name" |
其中 partition-name 是新分区表的名称。
在新磁盘上完成片的分配后,用新分区表标记磁盘。
Ready to label disk, continue? yes |
退出 partition 菜单。
partition> quit |
检验新的磁盘标号。
format> verify |
退出 format 实用程序。
format> quit |
创建磁盘片并标记磁盘后,可以在磁盘上创建文件系统。请转至x86: 如何创建文件系统。
成为超级用户或承担等效角色。
为每个片创建文件系统。
# newfs /dev/rdsk/cwtxdysz |
其中 /dev/rdsk/cwtxdysz 是要创建的文件系统的原始设备。
有关 newfs 命令的更多信息,请参见第 18 章,创建 UFS、TMPFS 和 LOFS 文件系统(任务)或 newfs(1M)。
通过挂载新文件系统对其进行检验。
# mount /dev/dsk/cwtxdysz /mnt # ls /mnt lost+found |
系统磁盘-需要在磁盘上恢复根 (/) 文件系统和 /usr 文件系统。
恢复根 (/) 文件系统和 /usr 文件系统后,安装引导块。请转至x86: 如何在系统磁盘上安装引导块。
辅助磁盘-可能需要在新磁盘上恢复文件系统。请转至第 27 章,恢复文件和文件系统(任务)。如果不在新磁盘上恢复文件系统,则完成了辅助磁盘的添加。
有关使文件系统可被用户使用的信息,请参见第 19 章,挂载和取消挂载文件系统(任务)。
成为超级用户或承担等效角色。
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/cwtxdysz |
是分区引导文件。
是引导块代码。
是原始设备名称,该名称表示 GRUB 菜单 /boot/grub/menu.lst 在 Solaris 根片上的位置。
有关更多信息,请参见 installgrub(1M)。
通过将系统重新引导到运行级 3,验证是否已安装引导块。
# init 6 |
以下示例说明如何在 x86 系统上安装引导块。
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1d0s0 stage1 written to partition 0 sector 0 (abs 2016) stage2 written to to partition 0, 227 sectors starting 50 (abs 2066) |