How to create a partition on a USB using command prompt?

Creating partitions on a USB drive allows you to organize and separate data on the drive into different sections. This can be useful for keeping different types of files or operating systems separated. For example, you may want to create multiple partitions on a USB drive to install Linux and Windows bootable images, or to keep personal files separate from work files.

Partitions can be created on a USB drive using the command prompt in Windows. The command prompt provides access to the diskpart utility which can create, delete, clean, and manage partitions and volumes on a drive. In this guide, we will walk through the steps to create a partition on a USB flash drive using the command prompt.


Before creating a partition on your USB drive, make sure you have the following:

  • A USB flash drive with enough storage space for the partitions you want to create. The drive should have no important data on it, as partitioning will erase all existing data.
  • Computer running Windows OS (Vista, 7, 8, 10 etc).
  • Administrative access to be able to use the command prompt.

Step 1 – Open Command Prompt as Administrator

The first step is to open a command prompt window as an administrator. This provides full access to use the diskpart utility.

Follow these steps to open an elevated command prompt:

  1. Click the Windows Start Menu and search for “Command Prompt”
  2. Right click on the Command Prompt result and select “Run as administrator”
  3. Click Yes on the User Account Control prompt

This will open a command prompt window with admin privileges.

Step 2 – Identify USB Drive

Before creating partitions, we need to identify the correct disk number for the USB drive. This ensures the partition commands affect the USB drive and not your system drive.

Type the following command to list all available disks:

list disk

This will display all connected drives with their disk numbers. Look for your USB drive in the list and note down its disk number. The size listed can help identify the correct USB disk.

For example, if your 16 GB USB drive shows up as Disk 2, then 2 is the disk number you should use for the USB disk when creating partitions.

Step 3 – Select USB Drive

With the disk number identified, type the following command to select the USB drive:

select disk [disk_number] 

For example:

select disk 2

This selects Disk 2 as the current disk that will be affected by the subsequent diskpart commands.

Step 4 – Clean the Drive

Before creating a partition, we should clean the disk to remove any existing partitions and format it.

Type the following command to clean the selected USB disk:


This will remove all partitions and data from the USB drive and prepare it for the new partition setup.

Step 5 – Create New Partition

With the USB drive cleaned, you can go ahead and create a new partition on it.

To create a primary partition, use the create partition primary command along with the desired size in MB.

For example, to create a 3000 MB partition, type:

create partition primary size=3000

This will create a 3000 MB partition on the USB drive.

You can repeat this command to create multiple partitions by specifying different sizes. Make sure the total size does not exceed the available space on your USB drive.

Step 6 – Select Partition

After creating the partition, you need to select it as the current partition to format it.

Type the following command to view list of partitions and note the partition number:

list partition

Then select the partition number, for example:

select partition 1

This selects the first primary partition you created as the current partition.

Step 7 – Format Partition

With the new partition selected, format it by typing:

format fs=fat32 quick

This formats the partition with FAT32 filesystem for compatibility with all operating systems. Change fs=ntfs if you want NTFS file system instead.

Repeat this step to format all the partitions you created.

Step 8 – Assign Drive Letter

To access the new partition in Windows Explorer, you need to assign a drive letter to it.

Type the following command to assign the next available drive letter to the partition:

assign letter=y

This will assign drive letter y to the selected partition. Replace y with your desired drive letter.

Repeat this for all partitions to assign unique drive letters.

Step 9 – Exit

You have now successfully created and formatted the partitions on your USB drive.

Type the following to safely exit diskpart:


This will close the diskpart utility and return you to the command prompt.


By following the steps above you can use the command prompt in Windows to easily create and manage partitions on a USB drive. The diskpart commands give you precise control to setup the drive as per your needs.

Some key points to remember:

  • Open command prompt as admin to use diskpart
  • Use list disk to identify the USB drive disk number
  • Select the USB disk before executing partition commands
  • Clean the disk first to erase any existing partitions
  • Create desired partition sizes with create partition primary
  • Assign drive letters to access the partitions in Windows Explorer

With a partitioned USB drive you can efficiently organize and use the storage space for carrying different types of files and operating systems.

Frequently Asked Questions

How do I remove a partition?

To remove a partition, first select the partition with select partition [number], then type delete partition override to delete it.

Can I create extended partitions?

Yes, you can type create partition extended to create an extended partition instead of a primary partition. This allows creating multiple logical drives in the extended partition.

How do I assign a volume label to the partition?

Use the command assign letter=[letter] label=[label] to assign a drive letter and label to the partition in one step.

What file system should I use to format the partition?

FAT32 is compatible with all operating systems. NTFS is optimized for Windows but has better performance. exFAT is compatible with MacOS and Windows but has no journaling like NTFS.

Can I restore the USB drive to default settings?

Yes, just clean the disk again to remove all partitions and format it back to default settings.

Leave a Comment