跳过导航链接 | |
退出打印视图 | |
Oracle Solaris 11.1 管理:设备和文件系统 Oracle Solaris 11.1 Information Library (简体中文) |
12. 配置和管理 Oracle Solaris Internet 存储名称服务 (Internet Storage Name Service, iSNS)
以下任务列表说明了在基于 x86 的系统中为 ZFS 根文件系统设置 ZFS 根池磁盘的过程。
|
虽然说明如何设置磁盘和创建 fdisk 分区的过程可以结合 ZFS 文件系统使用,但是 ZFS 文件系统不直接映射到磁盘或磁盘分片。必须创建 ZFS 存储池才能创建 ZFS 文件系统。有关更多信息,请参见《Oracle Solaris 11.1 管理:ZFS 文件系统》。
根池包含用于引导 Oracle Solaris OS 的根文件系统。如果根池磁盘已损坏,且根池未进行镜像配置,则系统可能不会引导。
如果根池磁盘已损坏,有两种可以恢复的方法:
可以重新安装整个 Oracle Solaris OS。
或者,可以替换根池磁盘并从快照或备份介质中恢复文件系统。可以通过创建冗余根池减少因硬件故障而导致的系统停机时间。唯一受支持的冗余根池配置是镜像根池。
用于非根池中的磁盘通常包含用户或数据文件的空间。为了获得更多磁盘空间,可以向根池或非根池附加或添加另一个磁盘。
或者,可以使用以下方法替换池中损坏的磁盘:
如果所有的设备当前为 ONLINE(联机),则可以在非冗余池中替换磁盘。
如果其他设备中存在足够的冗余,则可以在冗余池中替换磁盘。
在镜像根池中,可以替换磁盘或附加磁盘,然后拆离故障磁盘或较小的磁盘,以增加池的大小。
通常情况下,在系统中设置磁盘取决于硬件,所以当在系统中添加或替换磁盘时,请查看硬件文档。如果需要将磁盘添加到现有的控制器中,那么这可能只是将磁盘插入空槽(如果系统支持热插拔)中的问题而已。如果需要配置新的控制器,请参见动态重新配置和热插拔。
|
查看以下根池磁盘要求:
大多数情况下,Oracle Solaris 11.1 将为根池磁盘安装 EFI (GPT) 标签。SMI (VTOC) 标签仍然可用且受支持。按照本节中有关设置 EFI (GPT) 或 SMI (VTOC) 标签的相应过程进行操作。
必须是单个磁盘或镜像配置的一部分。根池既不支持非冗余配置,也不支持 RAIDZ 配置。
作为 OS 映像一部分的根文件系统的所有子目录(/var 除外)必须与根文件系统处于同一数据集。
除交换和转储设备外,所有其他 Oracle Solaris OS 组件必须驻留在根池中。
如果 x86 系统的根池磁盘带有 EFI 标签,则在大多数情况下,将自动创建正确的引导分区。
不推荐尝试使用磁盘上不同的分片并在不同的操作系统中共享该磁盘,或与不同的 ZFS 存储池或存储池组件一同使用。
如果需要重新创建 ZFS 根池或创建备用根池,请遵循以下过程。以下 zpool create 命令将使用正确的引导信息自动创建带 EFI (GPT) 标签的磁盘。
使用 format 实用程序标识根池的磁盘。
# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c6t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424> /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/sd@0,0 1. c6t1d0 <FUJITSU-MAV2073RCSUN72G-0301-68.37GB> /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/sd@1,0 2. c6t2d0 <FUJITSU-MAV2073RCSUN72G-0301-68.37GB> /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/sd@2,0 3. c6t3d0 <FUJITSU-MAV2073RCSUN72G-0301 cyl 14087 alt 2 hd 24 sec 424> /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/sd@3,0 Specify disk (enter its number):
# zpool create -B rpool mirror c1t0d0 c2t0d0
如果要创建备用根池,请使用类似于以下内容的语法:
# zpool create -B rpool2 mirror c1t0d0 c2t0d0 # beadm create -p rpool2 solaris2 # beadm activate -p rpool2 solaris2
有关完整的 ZFS 根池恢复的信息,请参见《Oracle Solaris 11.1 管理:ZFS 文件系统》中的第 11 章 "归档快照和根池恢复"。
通常情况下,安装系统时,会自动安装根池磁盘。如果需要替换根池磁盘或将新磁盘附加作为镜像根池磁盘,请参见以下步骤。
有关 fdisk 分区的完整说明,请参见x86: 创建 fdisk 分区指南。
有些硬件要求您在尝试通过 zpool replace 操作替换故障磁盘之前,使磁盘脱机并取消其配置。例如:
# zpool offline rpool c8t1d0s0 # cfgadm -c unconfigure c8::dsk/c8t1d0
# cfgadm -c configure c8::dsk/c28t1d0
对于某些硬件,插入替换磁盘后不必对其进行重新配置。
例如,format 命令显示 4 个连接至该系统的磁盘。
# format -e AVAILABLE DISK SELECTIONS: 1. c8t0d0 <Sun-STK RAID INT-V1.0 cyl 17830 alt 2 hd 255 sec 63> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@0,0 2. c8t1d0 <Sun-STK RAID INT-V1.0-136.61GB> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@1,0 3. c8t2d0 <Sun-STK RAID INT-V1.0-136.61GB> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@2,0 4. c8t3d0 <Sun-STK RAID INT-V1.0-136.61GB> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@3,0
Specify disk (enter its number): 1 selecting c8t1d0 [disk formatted] . . . format>
如果磁盘不具有 fdisk 分区,您将看到类似于以下内容的消息:
format> fdisk No Solaris fdisk partition found.
如果这样,请转到下一步创建 fdisk 分区。
如果磁盘具有 EFI fdisk 或某些其他分区类型,请转至下一步创建 Solaris fdisk 分区。
如果磁盘具有 Solaris fdisk 分区,请转至步骤 9 为根池创建磁盘分片。
format> fdisk 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
如果使用 format 实用程序打印磁盘的分区表,并且看见该分区表指向第一个扇区和大小,那么这就是一个 EFI 分区。将需要按照以下操作创建 Solaris fdisk 分区:
# format -e c8t1d0 selecting c8t1d0 [disk formatted] format> fdisk
Enter Selection: 3 Specify the partition number to delete (or enter 0 to exit): 1 Are you sure you want to delete partition 1? This will make all files and programs in this partition inaccessible (type "y" or "n"). y Partition 1 has been deleted.
Enter Selection: 1 Select the partition type to create: 1 Specify the percentage of disk to use for this partition (or type "c" to specify the size in cylinders). 100 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 Partition 1 is now the active partition.
Enter Selection: 6 format>
format> partition partition> print
设置浮动分区,以使所有未分配的磁盘空间集中在分片 0 中。然后,按下 "return"(返回)键通过分片大小字段来创建一个大的分片 0。
partition> modify Select partitioning base: 0. Current partition table (default) 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 - 17829 136.58GB (17830/0/0) 286438950 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 8 boot wu 0 - 0 7.84MB (1/0/0) 16065 9 alternates wm 0 0 (0/0/0) 0 Do you wish to continue creating a new partition table based on above table[yes]? Free Hog partition[6]? 0 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]: Enter size of partition '7' [0b, 0c, 0.00mb, 0.00gb]: Part Tag Flag Cylinders Size Blocks 0 root wm 1 - 17829 136.58GB (17829/0/0) 286422885 1 swap wu 0 0 (0/0/0) 0 2 backup wu 0 - 17829 136.58GB (17830/0/0) 286438950 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 8 boot wu 0 - 0 7.84MB (1/0/0) 16065 9 alternates wm 0 0 (0/0/0) 0 Do you wish to continue creating a new partition table based on above table[yes]? yes Enter table name (remember quotes): "c8t0d0" Ready to label disk, continue? yes
# zpool replace rpool c8t1d0s0 # zpool online rpool c8t1d0s0
对于某些硬件,插入替换磁盘后不必使其联机。
如果正在附加新磁盘来创建镜像根池或附加较大的磁盘来替换较小的磁盘,请使用与以下语法类似的语法:
# zpool attach rpool c8t0d0s0 c8t1d0s0
对根池磁盘执行的 zpool attach 操作将自动应用引导块。
例如:
# bootadm install-bootloader
zpool replace 操作不会自动应用引导块。
仅在附加新磁盘来替换故障磁盘或较小磁盘时,本步骤才是必要步骤。
# zpool detach rpool c8t0d0s0
通常情况下,安装系统时,会自动安装根池磁盘。如果需要替换根池磁盘或将新磁盘附加为镜像根池磁盘,请参见以下步骤。
大多数情况下,在 Oracle Solaris 11.1 中将为根池磁盘安装 EFI (GPT) 磁盘标签。
有关 fdisk 分区的完整说明,请参见x86: 创建 fdisk 分区指南。
有些硬件要求您在尝试通过 zpool replace 操作替换故障磁盘之前,使磁盘脱机并取消其配置。例如:
# zpool offline rpool c8t1d0 # cfgadm -c unconfigure c8::dsk/c8t1d0
# cfgadm -c configure c8::dsk/c8t1d0
对于某些硬件,插入替换磁盘后不必对其进行重新配置。
例如,format 命令显示 4 个连接至该系统的磁盘。
# format -e AVAILABLE DISK SELECTIONS: 1. c8t0d0 <Sun-STK RAID INT-V1.0 cyl 17830 alt 2 hd 255 sec 63> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@0,0 2. c8t1d0 <Sun-STK RAID INT-V1.0-136.61GB> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@1,0 3. c8t2d0 <Sun-STK RAID INT-V1.0-136.61GB> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@2,0 4. c8t3d0 <Sun-STK RAID INT-V1.0-136.61GB> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@3,0
# zpool replace rpool c8t1d0 # zpool online rpool c8t1d0
对于某些硬件,插入替换磁盘后不必使其联机。
如果正在附加新磁盘来创建镜像根池或附加较大的磁盘来替换较小的磁盘,请使用与以下语法类似的语法:
# zpool attach rpool c8t0d0 c8t1d0
对根池磁盘执行的 zpool attach 操作将自动应用引导块。
如果根池磁盘包含定制分区,则可能需要使用类似于以下内容的语法:
# zpool attach rpool c8t0d0s0 c8t0d0
例如:
# bootadm install-bootloader
对根池磁盘执行的 zpool replace 操作未自动应用引导块。
仅在附加新磁盘来替换故障磁盘或较小磁盘时,本步骤才是必要步骤。
# zpool detach rpool c8t0d0
通常情况下,安装系统时,会自动安装根池磁盘。如果需要替换根池磁盘或将新磁盘附加为镜像根池磁盘,请参见以下步骤。
有关 fdisk 分区的完整说明,请参见x86: 创建 fdisk 分区指南。
有些硬件要求您在尝试通过 zpool replace 操作替换故障磁盘之前,使磁盘脱机并取消其配置。例如:
# zpool offline rpool c8t1d0 # cfgadm -c unconfigure c8::dsk/c8t1d0
# cfgadm -c configure c8::dsk/c8t1d0
对于某些硬件,插入替换磁盘后不必对其进行重新配置。
例如,format 命令显示 4 个连接至该系统的磁盘。
# format -e AVAILABLE DISK SELECTIONS: 1. c8t0d0 <Sun-STK RAID INT-V1.0 cyl 17830 alt 2 hd 255 sec 63> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@0,0 2. c8t1d0 <Sun-STK RAID INT-V1.0-136.61GB> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@1,0 3. c8t2d0 <Sun-STK RAID INT-V1.0-136.61GB> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@2,0 4. c8t3d0 <Sun-STK RAID INT-V1.0-136.61GB> /pci@0,0/pci10de,375@f/pci108e,286@0/disk@3,0
Specify disk (enter its number): 1 selecting c8t1d0 [disk formatted] . . . format>
如果磁盘不具有 fdisk 分区,您将看到类似于以下内容的消息:
format> fdisk No Solaris fdisk partition found.
如果这样,请转至步骤 4 创建 fdisk 分区。
如果磁盘具有 EFI fdisk 或某些其他分区类型,请转至下一步创建 Solaris fdisk 分区。
如果磁盘具有 Solaris fdisk 分区,请转至步骤 9 为根池创建磁盘分片。
format> fdisk 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
如果使用 format 实用程序打印磁盘的分区表,并且看见该分区表指向第一个扇区和大小,那么这就是一个 EFI 分区。将需要按照以下操作创建 Solaris fdisk 分区:
从格式化选项中选择 fdisk。
# format -e c8t1d0 selecting c8t1d0 [disk formatted] format> fdisk
选择选项 3 删除现有 EFI 分区,删除分区。
Enter Selection: 3 Specify the partition number to delete (or enter 0 to exit): 1 Are you sure you want to delete partition 1? This will make all files and programs in this partition inaccessible (type "y" or "n"). y Partition 1 has been deleted.
选择选项 1 创建新的 Solaris 分区,创建分区。
Enter Selection: 1 Select the partition type to create: 1 Specify the percentage of disk to use for this partition (or type "c" to specify the size in cylinders). 100 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 Partition 1 is now the active partition.
更新磁盘配置并退出。
Enter Selection: 6 format>
显示 SMI 分区表。如果已应用缺省分区表,那么分片 0 的大小可能为 0,或者可能太小。请参见下一步。
format> partition partition> print
设置浮动分区,以使所有未分配的磁盘空间集中在分片 0 中。然后,按下 "return"(返回)键通过分片大小字段来创建一个大的分片 0。
partition> modify Select partitioning base: 0. Current partition table (default) 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 - 17829 136.58GB (17830/0/0) 286438950 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 8 boot wu 0 - 0 7.84MB (1/0/0) 16065 9 alternates wm 0 0 (0/0/0) 0 Do you wish to continue creating a new partition table based on above table[yes]? Free Hog partition[6]? 0 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]: Enter size of partition '7' [0b, 0c, 0.00mb, 0.00gb]: Part Tag Flag Cylinders Size Blocks 0 root wm 1 - 17829 136.58GB (17829/0/0) 286422885 1 swap wu 0 0 (0/0/0) 0 2 backup wu 0 - 17829 136.58GB (17830/0/0) 286438950 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 8 boot wu 0 - 0 7.84MB (1/0/0) 16065 9 alternates wm 0 0 (0/0/0) 0 Do you wish to continue creating a new partition table based on above table[yes]? yes Enter table name (remember quotes): "c8t1d0" Ready to label disk, continue? yes
# zpool replace rpool c8t1d0s0 # zpool online rpool c8t1d0s0
对于某些硬件,插入替换磁盘后不必使其联机。
如果正在附加新磁盘来创建镜像根池或附加较大的磁盘来替换较小的磁盘,请使用与以下语法类似的语法:
# zpool attach rpool c8t0d0s0 c8t1d0s0
对根池使用 zpool attach 命令时,将自动应用引导块。
例如:
# bootadm install-bootloader
仅在附加新磁盘来替换故障磁盘或较小磁盘时,本步骤才是必要步骤。
# zpool detach rpool c8t1d0s0
如果使用 zpool replace 命令替换根池磁盘,则必须安装引导装载程序。以下过程同时适用于 VTOC 和 EFI (GPT) 标签。
# bootadm install-bootloader
如果需要在备用根池中安装引导装载程序,则使用 -P(池)选项。
# bootadm install-bootloader -P rpool2
如果要安装 GRUB Legacy 引导装载程序,必须首先从系统中删除所有 GRUB 2 引导环境,然后再使用 installgrub命令。有关说明,请参见《引导和关闭 Oracle Solaris 11.1 系统》中的"在已安装 GRUB 2 的系统上安装 GRUB Legacy"。
# init 6
如果设置结合 ZFS 非根文件系统使用的磁盘,在创建池或将磁盘添加到池中时,会自动重新为该磁盘设置标签。如果使用整个磁盘创建池,或者在将整个磁盘添加到 ZFS 存储池时,则会应用标签 EFI。有关 EFI 磁盘标签的更多信息,请参见EFI (GPT) 磁盘标签。
通常,大多数现代的总线类型都支持热插拔。这说明可以将磁盘插入空槽中,而且系统识别该磁盘。有关热插拔设备的更多信息,请参见第 4 章。
有关详细信息,请参阅磁盘的硬件安装指南。
有些硬件要求您在尝试通过 zpool replace 操作替换故障磁盘之前,使磁盘脱机并取消其配置。例如:
# zpool offline tank c1t1d0 # cfgadm -c unconfigure c1::dsk/c1t1d0 <Physically remove failed disk c1t1d0> <Physically insert replacement disk c1t1d0> # cfgadm -c configure c1::dsk/c1t1d0
对于某些硬件,插入替换磁盘后不必对其进行重新配置。
检查 format 实用程序的输出来查看该磁盘是否列在 AVAILABLE DISK SELECTIONS(可用的磁盘选择)之下。然后,退出 format 实用程序。
# format
# zpool replace tank c1t1d0 # zpool online tank c1t1d0
确认新磁盘可重新同步。
# zpool status tank
例如:
# zpool attach tank mirror c1t0d0 c2t0d0
确认新磁盘可重新同步。
# zpool status tank
有关更多信息,请参见《Oracle Solaris 11.1 管理:ZFS 文件系统》中的第 3 章 "管理 Oracle Solaris ZFS 存储池"。