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

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 文件系统