大小 (diskconfiguration-createpartitions-createpartition-size) Size (microsoft-windows-setup-diskconfiguration-disk-createpartitions-createpartition-size)

Size 指定要创建的分区大小,以兆字节 (MB) 为单位。Size specifies the size of the partition to create, in megabytes (MB).

Values

size_in_megabytessize_in_megabytes

指定所创建的分区的大小(mb)。Specifies the size of the partition that you create, in megabytes.

例如,若要创建2千兆字节 (GB) 分区,请将设置 Size 为2000。For example, to create a 2 gigabyte (GB) partition, set Size to 2000.

注意Note
请勿创建 Size 完全填充或超过可用空间的值,因为 Windows 预留了少量空间来管理分区。Do not create a value for Size that entirely fills or exceeds the available space, because Windows reserves a small amount of space to manage partitions. 例如,如果创建 2000 MB 的扩展分区,并使用每个大小分别为 1000 MB 的逻辑分区,则不会创建第二个分区。For example, if you create an extended partition with 2000 MB, and you create two logical partitions with the size of 1000 MB each inside that partition, the second partition is not created. 将记录一个错误,并且安装将终止。An error is logged, and installation is terminated.

  • 若要使用主分区填充驱动器上的可用空间,请使用 CreatePartition:扩展 设置。To fill the available space on the drive with a primary partition, use the CreatePartition:Extend setting. 不要设置 CreatePartition: SizeDo not set CreatePartition:Size.

  • 若要使用逻辑分区填充扩展分区上的可用空间,请将 CreatePartition:设置 Size 为较小的值,例如 100To fill the available space on an extended partition with a logical partition, set CreatePartition:Size to a small value, such as 100. Set ModifyPartition:扩展trueSet ModifyPartition:Extend to true. 不要设置 CreatePartition:扩展Do not set CreatePartition:Extend. 有关详细信息,请参阅 如何在 BIOS-Based 硬盘上配置四个以上的分区For more information, see How to Configure More than Four Partitions on a BIOS-Based Hard Disk.

  • 请勿同时设置 CreatePartition: Size 和 CreatePartition:ExtendDo not set both CreatePartition:Size and CreatePartition:Extend. 如果指定了的值 Size 并且 CreatePartition: Extend 设置为 true,则不创建分区。If a value for Size is specified and CreatePartition:Extend is set to true, no partition is created. 将记录一个错误,并且安装将终止。An error is logged, and installation is terminated.

有效的配置阶段Valid Configuration Passes

windowsPEwindowsPE

父层次结构Parent Hierarchy

microsoft-windows-设置- | DiskConfiguration | 磁盘 | CreatePartitions | CreatePartition | 大小microsoft-windows-setup- | DiskConfiguration | Disk | CreatePartitions | CreatePartition | Size

适用于Applies To

有关此组件支持的受支持的 Windows 版本和体系结构的列表,请参阅 microsoft-安装-For a list of supported Windows editions and architectures that this component supports, see microsoft-windows-setup-.

XML 示例XML Example

设置主分区以填充驱动器上的可用空间Setting a Primary Partition to Fill the Available Space on a Drive

以下设置的 XML 输出 DiskConfiguration 显示了如何在基于 BIOS 的系统上的硬盘驱动器上创建两个分区。The following XML output for the DiskConfiguration setting shows how to create two partitions on a hard drive on a BIOS-based system. 第一个分区为 300 MB。The first partition is 300 MB. 第二个分区扩展以填充硬盘的其余部分。The second partition extends to fill the remainder of the hard disk.

<DiskConfiguration>

  <Disk wcm:action="add">
    <DiskID>0</DiskID> 
    <WillWipeDisk>true</WillWipeDisk> 
    <CreatePartitions>

      <!-- System partition -->
      <CreatePartition wcm:action="add">
        <Order>1</Order> 
        <Type>Primary</Type> 
        <Size>300</Size> 
      </CreatePartition>

      <!-- Windows partition -->
      <CreatePartition wcm:action="add">
        <Order>2</Order> 
        <Type>Primary</Type> 
        <Extend>true</Extend> 
      </CreatePartition>

    </CreatePartitions>
    <ModifyPartitions>

      <!-- System partition -->
      <ModifyPartition wcm:action="add">
        <Order>1</Order> 
        <PartitionID>1</PartitionID> 
        <Label>System</Label> 
        <Format>NTFS</Format> 
        <Active>true</Active> 
      </ModifyPartition>

      <!-- Windows partition -->
      <ModifyPartition wcm:action="add">
        <Order>2</Order> 
        <PartitionID>2</PartitionID> 
        <Label>Windows</Label> 
        <Letter>C</Letter> 
        <Format>NTFS</Format> 
      </ModifyPartition>
    </ModifyPartitions>
  </Disk>


  <WillShowUI>OnError</WillShowUI> 
</DiskConfiguration>


<ImageInstall>
  <OSImage>
    <InstallTo>
      <DiskID>0</DiskID> 
      <PartitionID>2</PartitionID> 
    </InstallTo>
  </OSImage>
</ImageInstall>

设置逻辑分区以填充扩展分区中的可用空间Setting a Logical Partition to Fill the Available Space in an Extended Partition

以下设置的 XML 输出 DiskConfiguration 显示了如何创建一个扩展分区,以便在基于 BIOS 的系统上填充驱动器的剩余部分。The following XML output for the DiskConfiguration setting shows how to create an extended partition that fills the remainder of the drive on a BIOS-based system. 扩展分区包括两个逻辑分区。The extended partition includes two logical partitions. 第一个逻辑分区为 15 GB。The first logical partition is 15 GB. 第二个逻辑分区扩展以填充扩展分区的剩余部分。The second logical partition extends to fill the remainder of the extended partition.

<DiskConfiguration>

  <Disk wcm:action="add">
    <DiskID>0</DiskID> 
    <WillWipeDisk>true</WillWipeDisk> 
    <CreatePartitions>

      <!-- Recovery partition -->
      <CreatePartition wcm:action="add">
        <Order>1</Order> 
        <Type>Primary</Type> 
        <Size>3000</Size> 
      </CreatePartition>

      <!-- Utility2 partition -->
      <CreatePartition wcm:action="add">
        <Order>2</Order> 
        <Type>Primary</Type> 
        <Size>250</Size> 
      </CreatePartition>

      <!-- System partition -->
      <CreatePartition wcm:action="add">
        <Order>3</Order> 
        <Type>Primary</Type> 
        <Size>100</Size> 
      </CreatePartition>

      <!-- Extended partition -->
      <CreatePartition wcm:action="add">
        <Order>4</Order> 
        <Type>Extended</Type> 
        <Extend>true</Extend> 
      </CreatePartition>

      <!-- Windows partition -->
      <CreatePartition wcm:action="add">
        <Order>5</Order> 
        <Type>Logical</Type> 
        <Size>15000</Size> 
      </CreatePartition>

      <!-- Logical2 partition -->
      <CreatePartition wcm:action="add">
        <Order>6</Order> 
        <Type>Logical</Type> 
        <Size>100</Size> 
          <!-- Note: To create a logical partition that fills 
                     the rest of the extended partition, create the 
                     data partition with an initial size of 100 MB.
                     This will be changed in the ModifyPartition section. -->
      </CreatePartition>

    </CreatePartitions>
    <ModifyPartitions>

      <!-- Recovery partition -->
      <ModifyPartition wcm:action="add">
        <Order>1</Order> 
        <PartitionID>1</PartitionID> 
        <Label>Recovery</Label> 
        <Format>NTFS</Format> 
        <TypeID>0x27</TypeID>
      </ModifyPartition>

      <!-- Utility2 partition -->
      <ModifyPartition wcm:action="add">
        <Order>2</Order> 
        <PartitionID>2</PartitionID> 
        <Label>Utility2</Label> 
        <Letter>U</Letter> 
        <Format>NTFS</Format> 
        <TypeID>0x27</TypeID>
      </ModifyPartition>

      <!-- System partition -->
      <ModifyPartition wcm:action="add">
        <Order>3</Order> 
        <PartitionID>3</PartitionID> 
        <Label>System</Label>
        <Format>NTFS</Format> 
        <Active>true</Active> 
      </ModifyPartition>

      <!-- Extended partition:
           This partition does not need receive a partition number, 
           nor does it need to be modified -->

      <!-- Windows partition -->
      <ModifyPartition wcm:action="add">
        <Order>4</Order>
        <PartitionID>4</PartitionID> 
        <Label>Windows</Label> 
        <Letter>C</Letter> 
        <Format>NTFS</Format> 
      </ModifyPartition>

      <!-- Logical2 partition -->
      <ModifyPartition wcm:action="add">
        <Order>5</Order> 
        <PartitionID>5</PartitionID> 
        <Label>Logical2</Label> 
        <Letter>L</Letter> 
        <Format>NTFS</Format> 
        <Extend>true</Extend>
          <!-- Note: When modifying a logical partition, setting
                     "ModifyPartition|Extend=true" sets the partition to  
                     fill the remainder of the extended partition.
                     This overrides the "CreatePartition|Size" value. -->
      </ModifyPartition>

    </ModifyPartitions>
  </Disk>
  <WillShowUI>OnError</WillShowUI> 
</DiskConfiguration>


<ImageInstall>
  <OSImage>
    <InstallTo>
      <DiskID>0</DiskID> 
      <PartitionID>4</PartitionID> 
    </InstallTo>
  </OSImage>
</ImageInstall>

有关完整的 XML 示例和推荐的分区配置,请参阅 如何配置基于 UEFI/GPT 的硬盘分区如何配置基于 BIOS/MBR 的硬盘分区For full XML examples and recommended partition configurations, see How to Configure UEFI/GPT-Based Hard Disk Partitions or How to Configure BIOS/MBR-Based Hard Disk Partitions.

CreatePartitionCreatePartition

如何在 BIOS-Based 硬盘上配置四个以上的分区How to Configure More than Four Partitions on a BIOS-Based Hard Disk