Windows - Create partition using command line
To create a partition or logical drive
• Using the Windows interface
• Using a command line
Using the Windows interface
1. Open Computer Management (Local).
2. In the console tree, click Computer Management (Local), click Storage, and then click Disk Management.
3. Right-click an unallocated region of a basic disk, and then click New Partition, or right-click free space in an extended partition, and then click New Logical Drive.
4. In the New Partition wizard, click Next, click Primary partition, Extended partition, or Logical drive, and then follow the instructions on your screen.
Notes
• To perform this procedure on a local computer, you must be a member of the Backup Operators group or Administrators group on the local computer, or you must have been delegated the appropriate authority. To perform this procedure remotely, you must be a member of the Backup Operators group or Administrators group on the remote computer. If the computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. As a security best practice, consider using Run as to perform this procedure. For more information, see Default local groups, Default groups, and Using Run as.
• To open Computer Management, click Start, click Control Panel, double-click Administrative Tools, and then double-click Computer Management.
• You can create primary partitions, extended partitions, and logical drives only on basic disks. You should create basic volumes instead of dynamic volumes if this computer also runs MS-DOS, Windows 95, Windows 98, Windows Millennium Edition, Windows NT 4.0, or Windows XP Home Edition.
• On a master boot record (MBR) disk, you can create up to four primary partitions, or three primary partitions, one extended partition, and unlimited logical drives.
• On a GUID partition table (GPT) disk, you can create up to 128 primary partitions.
Using a command line
1. Open Command Prompt.
2. Type:
diskpart
3. At the DISKPART prompt, type:
list disk
Make note of the disk number of the disk on which you want to create a primary or extended partition.
4. At the DISKPART prompt, type:
select diskn
Select the disk n where you want to create the primary or extended partition.
5. At the DISKPART prompt, type one of the following:
create partition primary [size=n] [offset=n] [ID=byte | GUID] [noerr]
or
create partition extended [size=n] [offset=n] [noerr]
or
create partition logical [size=n] [offset=n] [noerr]
6. At the DISKPART prompt, type:
assign letter=D
Parameters
Parameter | Description | ||
size=<n> | Specifies the size of the partition in megabytes (MB). If no size is given, the partition continues until there is no more unallocated space in the current region. | ||
offset=<n> | The offset in kilobytes (KB), at which the partition is created. If no offset is given, the partition will start at the beginning of the largest disk extent that is large enough to hold it. | ||
align=<n> | Aligns all partition extents to the closest alignment boundary. Typically used with hardware RAID Logical Unit Number (LUN) arrays to improve performance. <n> is the number of kilobytes (KB) from the beginning of the disk to the closest alignment boundary. | ||
id={ <byte> | <guid> } | Specifies the partition type. This parameter is intended for original equipment manufacturer (OEM) use only. Any partition type byte or GUID can be specified with this parameter. DiskPart does not check the partition type for validity except to ensure that it is a byte in hexadecimal form or a GUID.
If this parameter is not specified for a GPT disk, the command creates a basic data partition. | ||
noerr | For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without the noerr parameter, an error causes DiskPart to exit with an error code. |