How to delete partitions on USB drive cmd?

Disk partitioning is the process of dividing a physical disk into multiple logical units called partitions. This allows you to organize and separate data on the same disk into different partitions. Some reasons why you may want to delete existing partitions on a USB drive include:

  • To consolidate space – Having multiple small partitions takes up more space compared to a single large partition.
  • To change the partition layout – Deleting partitions allows you to recreate them in a different layout.
  • Before reformatting – Existing partitions need to be deleted before the entire USB drive can be reformatted.
  • To remove unwanted data – Deleting a partition completely removes all data stored on that partition.

This guide will walk through the steps to view existing partitions on a USB drive and delete them using Command Prompt on Windows.

Prerequisites

The first step before deleting partitions on a USB drive using Command Prompt is to ensure you have administrative privileges on the Windows computer. By default, the administrator account on a Windows PC has full privileges to make changes to devices and system settings. If you are not already logged into an admin account, you will need to elevate your privileges.

To check your account privileges, open the Start menu and type “User Accounts”. Select “Change account type” and see if your account is listed as an Administrator. If not, you can grant admin privileges by going to Settings > Accounts > Family & other users, selecting your account, and changing the account type to Administrator. For more details, refer to this Microsoft guide on gaining admin rights: Create a local user or administrator account in Windows.

With administrative privileges enabled, you will be able to proceed with using Command Prompt to manage partitions on a connected USB drive.

Open Command Prompt

To open an elevated Command Prompt on Windows, you need to launch CMD with admin privileges. This allows you to run commands that affect the system with full permissions.

The easiest way is to use the Windows key + X keyboard shortcut, then select “Windows Terminal (Admin)” or “Command Prompt (Admin)” depending on your Windows version. You can also type cmd into the Windows search bar, right-click on Command Prompt, and choose “Run as administrator”.

Alternatively, you can press Windows key + R to open the Run dialog box. Type cmd and press Ctrl + Shift + Enter. Click yes on the User Account Control prompt to launch CMD with admin access.

On Windows 7, click Start, type cmd in the search bar, right-click on cmd.exe, and select “Run as administrator”. These methods will open an elevated command prompt with admin privileges.

Source: https://www.lifewire.com/how-to-open-an-elevated-command-prompt-2618088

List Partitions

To view the current partitions on the USB drive, we will use the diskpart utility in Command Prompt. Diskpart allows you to manage disks, partitions, and volumes from the command line.

First, open an elevated Command Prompt window by right-clicking on Start and selecting “Command Prompt (Admin)”.

Next, type the following command and press Enter:

diskpart

This will launch the diskpart utility. To view the partitions on your USB drive, type the following command:

list partition

This will display all the partitions on all disks connected to your computer. Identify the partitions on your USB drive based on the size. The partitions on the USB drive will likely be much smaller than the partitions on your main hard drive.

You can now select the partition you want to delete in the next step.

For more details, refer to: How to Use DiskPart Utility in Windows

Select Partition

To delete a partition, you first need to select the specific partition you want to delete. This is done using the select partition command in Diskpart [1]. The syntax is:

select partition [part]

Where [part] is the partition number of the partition you want to delete. To find the partition number, you can use the list partition command first to see all partitions and their associated numbers.

For example, to select partition 2 to delete, you would type:

select partition 2

This will shift focus in Diskpart to the specified partition, allowing you to then use the delete partition command to remove it.

Delete Partition

To delete a partition in Diskpart, you’ll need to use the “delete partition override” command. This allows you to force delete partitions, even if they are system protected or in use.

The syntax is:

delete partition override

For example:

select partition 2
delete partition override

This will forcibly delete partition 2, overriding any protection or restrictions. The “override” parameter is key to forcing the deletion.

According to Diskpart: Delete Partition Force in Windows 11,10, 8, 7, the override command allows you to “delete hidden or protected partitions through the “delete partition override” command”. However, you need to be careful not to “delete a wrong partition and cause data loss.”

If you attempt to delete a protected partition without the override parameter, you’ll get an error like “cannot delete a protected partition without the force protected parameter set.” The override command is required to bypass this protection.

Create New Partition

Once you have deleted the existing partition, you may need to create a new partition layout. This can be done using the create partition command in diskpart.

The basic syntax is:

create partition primary [size=X]

Where X is the size of the partition in MB. For example:

create partition primary size=50000

This will create a 50GB primary partition. You can also specify the partition as extended if needed.

To create multiple partitions, run the create partition command multiple times with the desired sizes. For example:

create partition primary size=100000
create partition extended

create partition logical size=50000

This will create a 100GB primary partition, an extended partition, and a 50GB logical drive within the extended partition.

Refer to Intel’s guide for more details on creating partitions with diskpart.

Format Partition

Once the partition is deleted, the next step is to format the newly created partition. Formatting prepares the partition for use by creating a filesystem on the drive. The most common filesystem to use is NTFS (NT File System).

To format the partition, use the “format” command in diskpart. The basic syntax is:

format fs=ntfs [label=[label name]] [quick]

For example, to quickly format the partition to NTFS without a label:

format fs=ntfs quick

To format with a volume label:

format fs=ntfs label=”Data” quick

The “quick” parameter performs a quick format which is faster, while omitting a full sector-by-sector check for bad sectors. For most uses, a quick format is fine.

See this guide for more details on using the format command: Diskpart: Format Drive to NTFS in Windows 11, 10, 8, 7

Once the format is complete, the partition will be ready to use.

Assign Drive Letter

After formatting the partition, the next step is to assign it a drive letter so that it can be accessed in Windows. To do this, use the “assign letter” command in diskpart.

Type the following command, replacing X with the letter you want to assign (make sure it is an unused letter):

assign letter=X

For example:

assign letter=F

This will assign the drive letter F to the partition. You can now access the drive in Windows Explorer and start storing files on it.

If the partition already had a drive letter assigned that you want to change, use the following command instead:

assign letter=X

This will change the existing drive letter to X. The new drive letter will take effect immediately without needing to reboot.

Be careful not to assign a drive letter already in use on your system, as this can lead to conflicts. You can run “list volume” in diskpart first to see which letters are available.

Once the drive letter is assigned, the USB partition will be fully accessible and ready to use!

Conclusion

In summary, deleting partitions on a USB drive in Command Prompt involves a few simple steps:

  • Open the Command Prompt application
  • List the existing partitions on the USB drive using the ‘list disk’ and ‘list volume’ commands
  • Select the partition to delete using the ‘select volume’ command
  • Delete the partition with the ‘clean’ command
  • Optionally create a new partition using the ‘create partition primary’ command
  • Format the partition using the ‘format’ command
  • Assign a drive letter if needed with the ‘assign’ command

Following this straightforward process allows you to cleanly remove partitions from a USB drive and reformat it for reuse via the Command Prompt in Windows.

Leave a Comment