在 Oracle® Solaris 11.2 中管理设备

退出打印视图

更新时间: 2014 年 7 月
 
 

修改分片或分区

在大多数情况下,制造商已对磁盘进行了格式化和分区。因此,如果要修改分区配置,请通过更改分片或分区大小或者通过更改分区类型来配置分区或分片。

SPARC: 使用 partition 选项

Format 实用程序的 partition 选项可用于在基于 SPARC 的系统上配置磁盘分片。本节提供有关 partition 选项的用法的示例。

示例 6-15  SPARC: 调整磁盘分片的大小

在本示例中,根池磁盘的大小不足。为实现最佳大小,大部分磁盘空间必须位于分片 0 中。可通过修改当前分区来更改分区大小。

...Format Menu
format> partition
partition> print
Current partition table (default):
Total disk cylinders available: 14085 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
0       root    wm       1 -    13      129.19MB    (13/0/0)       264576
1       swap    wu      14 -    26      129.19MB    (13/0/0)       264576
2     backup    wu       0 - 14086      136.71GB    (14087/0/0) 286698624
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      27 - 14084      136.43GB    (14058/0/0) 286108416
7 unassigned    wm       0                0         (0/0/0)             0
8       boot    wu       0 -     0        9.94MB    (1/0/0)         20352
9 alternates    wm       0                0         (0/0/0)             0

partition> modifyChange partition size.
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 - 14084      136.69GB    (14085/0/0) 286657920
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        9.94MB    (1/0/0)         20352
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
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 - 14084      136.68GB    (14084/0/0) 286637568
1       swap    wu       0                0         (0/0/0)             0
2     backup    wu       0 - 14084      136.69GB    (14085/0/0) 286657920
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        9.94MB    (1/0/0)         20352
9 alternates    wm       0                0         (0/0/0)             0

Okay to make this the current partition table[yes]? yes
Enter table name (remember quotes): "c2t0d0"
Ready to label disk, continue? yes
partition> q
format> q

x86: 使用 fdisk 选项

可以使用 Format 实用程序的 fdisk 选项管理基于 x86 的系统上的 fdisk 分区。

假如满足以下要求,则可以将 x86 类型的磁盘用于 ZFS 存储池:

  • 如果磁盘具有多个分区,其中一个分区必须是 Solaris 分区。

    可以使用 fdisk 选项确定是否存在 Solaris 分区。如果不存在,请创建一个,如Example 6–16 中所示

  • Solaris 分区必须是磁盘上的活动分区。

    活动分区是指其操作系统在缺省情况下在系统启动时引导的分区。

  • Solaris fdisk 分区必须在柱面边界开始。

    Solaris fdisk 分区不得从第一个磁盘的柱面 0 开始,因为该柱面保留用于存储附加引导信息(包括主引导记录)。

  • Solaris fdisk 分区可以是整个磁盘,也可以只是磁盘的一部分(以便为其他分区保留空间)。

    假如磁盘具有足够空间,则不必重新配置该磁盘上的现有分区即可创建新分区。

所有 fdisk 分区都具有标识符。Solaris 分区具有以下两种标识符:

  • Solaris 使用 0x82 标识符。

  • Solaris2 使用 0xbf 标识符。

所有 Oracle Solaris 命令、实用程序和驱动程序都已更新,可以与任意一种标识符协同工作而不会对 fdisk 功能造成任何影响。因此,可通过从 fdisk 菜单中选择相应选项在这两种标识符之间切换,如下所示:

format > fdisk
...
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 IDsToggle between identifiers
5. Edit/View extended partitions
6. Exit (update disk configuration and exit)
7. Cancel (exit without updating disk configuration)

注 -  即使文件系统位于已挂载的分区中,也可以更改 fdisk 标识符。
示例 6-16  x86: 创建一个跨整个驱动器的 Solaris fdisk 分区

以下示例显示了如何创建跨整个 c8t3d0 驱动器的 Solaris fdisk 分区。

# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c8t0d0 <SEAGATE-ST973401LSUN72G-0556 cyl 8921 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7458@11/pci1000,3060@4/sd@0,0
/dev/chassis/SYS/HD0/disk
1. c8t1d0 <SEAGATE-ST973401LSUN72G-0556 cyl 8921 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7458@11/pci1000,3060@4/sd@1,0
/dev/chassis/SYS/HD1/disk
2. c8t2d0 <SEAGATE-ST973401LSUN72G-0556-68.37GB>
/pci@0,0/pci1022,7458@11/pci1000,3060@4/sd@2,0
/dev/chassis/SYS/HD2/disk
3. c8t3d0 <SEAGATE-ST973401LSUN72G-0556 cyl 14087 alt 2 hd 24 sec 424>
/pci@0,0/pci1022,7458@11/pci1000,3060@4/sd@3,0
/dev/chassis/SYS/HD3/disk
Specify disk (enter its number): 3
selecting c8t3d0
[disk formatted]
No Solaris fdisk partition found.
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
示例 6-17  x86: 将 x86 分区转换为 Solaris 分区

本示例显示了如何将现有分区转换为 Solaris 分区。缺省情况下,大多数基于 x86 的系统上的磁盘都带有 EFI 标签。要更改分区类型,请先销毁现有分区类型。更改分区类型后,标签也会随之更改。由于磁盘的原始类型为 EFI,因此可使用 format –e 命令启动 Format 实用程序。

# format -e
...
format> fdisk
FORMAT MENU:
disk       - select a disk
type       - select (define) a disk type
Total disk size is 17833 cylinders
Cylinder size is 16065 (512 byte) blocks

Cylinders
Partition   Status    Type          Start   End    Length    %
=========   ======    ============  =====   ===    ======   ===
1                     EFI           0       17833  17834    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. Edit/View extended partitions
6. Exit (update disk configuration and exit)
7. Cancel (exit without updating disk configuration)
Enter Selection: 3
Specify the partition number to delete (or enter 0 to exit): 1
This will make all files and
programs in this partition inaccessible (type "y" or "n"). y
Enter Selection: 1
Select the partition type 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 (Protective)
G=EFI_SYS    0=Exit? 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
Enter Selection: 6
Partition 1 is now the active partition.