Diskpart is a powerful command-line tool used for managing disks, partitions, and volumes in Windows. Below is a comprehensive guide on the Diskpart and Format commands, including common operations and their responses.
1. Launching Diskpart
To open Diskpart, follow these steps:
1. Press Windows + R, type cmd, and hit Enter.
2. In the Command Prompt window, type diskpart and press Enter. This launches the Diskpart utility.
2. Common Diskpart Commands and Responses
a. List available disks:
list disk
Response: Displays a list of all disks available on the system, showing their size, used space, and status.
b. Select a disk:
select disk <disk_number>
Response: Selects the specified disk for further actions (e.g., formatting, partitioning).
c. List partitions on a disk:
list partition
Response: Lists all partitions on the selected disk, including their size, type, and status.
d. Select a partition:
select partition <partition_number>
Response: Selects a specific partition on the chosen disk.
e. Create a new partition:
create partition primary size=<size_in_MB>
Response: Creates a primary partition with the specified size.
f. Delete a partition:
delete partition
Response: Deletes the selected partition on the disk.
g. Clean a disk:
clean
Response: Removes all partitions and data from the selected disk, effectively wiping it.
h. Convert a disk to GPT:
convert gpt
Response: Converts the selected disk to the GPT partition style. It will not work if the disk already contains data.
i. Convert a disk to MBR:
convert mbr
Response: Converts the selected disk to the MBR partition style. It will also erase all data on the disk.
💥🛰
3. Format Command
After creating a partition, you can use the format command to prepare it for use by writing a file system to it.
a. Format a partition:
format fs=<file_system> label=<partition_label> quick
Parameters:
<file_system>: The file system to format (e.g., NTFS, FAT32, exFAT).
<partition_label>: A name for the partition (optional).
quick: Performs a quick format (no full surface scan).
Example:
format fs=NTFS label=MyDrive quick
Response: The partition is formatted with the specified file system and label. The quick format option speeds up the process.
🛰🪐
4. Additional Format Options
a. Format with a specific allocation unit size:
format fs=NTFS unit=<size_in_bytes> label=<partition_label> quick
Example:
format fs=NTFS unit=4096 label=MyDrive quick
Response: Formats the partition using the specified unit size (e.g., 4096 bytes).
b. Format a partition without quick option (Full format):
format fs=NTFS label=MyDrive
Response: Performs a full format that includes a surface scan for bad sectors. This can take significantly longer than the quick format.
🛰🪐
5. Assigning a Drive Letter
a. Assign a drive letter to a partition:
assign letter=<drive_letter>
Example:
assign letter=F
Response: Assigns the specified drive letter (e.g., F) to the selected partition.
🌐🛰
6. Exit Diskpart
Once done with your disk management tasks, you can exit Diskpart by typing:
exit
Response: Closes the Diskpart utility and returns to the Command Prompt.
🪐
7. Sample Full Workflow Example
1. Open Command Prompt as Administrator.
2. Launch Diskpart:
diskpart
3. List available disks:
list disk
4. Select the disk to work with:
select disk 1
5. Clean the disk (if necessary):
clean
6. Create a new partition:
create partition primary size=50000
7. Format the partition:
format fs=NTFS label=MyDrive quick
8. Assign a drive letter:
assign letter=F
9. Exit Diskpart:
exit
💥
8. Important Notes
Diskpart operations are destructive: Some commands (e.g., clean, delete partition, convert) can permanently erase data. Always back up important files before proceeding.
Disk Management utility: While Diskpart is powerful, it's more user-friendly to use the built-in "Disk Management" tool for non-advanced operations.
Quick Format: The quick format option doesn't check the disk for errors or bad sectors. If you want to check the disk thoroughly, skip the quick flag.
🙌💥
Conclusion
Diskpart and Format commands are essential for managing and preparing storage drives in Windows. It is crucial to understand the available commands and their implications, as improper usage can result in data loss. Always ensure that you're performing actions on the correct disk and partition to avoid mistakes.