0% found this document useful (0 votes)
82 views2 pages

Used To Create or Delete Partitions On Hard Drives.: Diskpart

Diskpart is a command line tool in Windows that allows managing partitions and volumes on hard drives. It can be used to create, delete, format partitions, change drive letters, and more. The diskpart commands available include add, delete, list, select, attributes and others. Diskpart provides powerful but complex disk and partition management capabilities from the Windows command line.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views2 pages

Used To Create or Delete Partitions On Hard Drives.: Diskpart

Diskpart is a command line tool in Windows that allows managing partitions and volumes on hard drives. It can be used to create, delete, format partitions, change drive letters, and more. The diskpart commands available include add, delete, list, select, attributes and others. Diskpart provides powerful but complex disk and partition management capabilities from the Windows command line.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1

DISKPART used to create or delete partitions on hard drives.

The diskpart command is available from within the Command Prompt in Windows


operating systems, including Windows 11, 10, 8, etc.

You can also access this command from the Recovery Console in Windows 2000 and
Windows XP.

NOTE: Managing partitions is also possible without the use of a command from within
any version of Windows using the Disk Management tool.

NOTE: The availability of certain diskpart command switches and other syntax may


differ from operating system to operating system. See How to Read Command
Syntax if you're not sure how to read the syntax as it's described in this table.
Diskpart Command Parameters
Item Description
active Marks the disk's partition with focus, as active.
add Creates a new partition on the specified hard drive.
assign Assigns a drive letter or mount point to the volume with focus.
attach Attaches (sometimes called mounts or surfaces) a virtual hard disk (VHD) so
vdisk that it appears on the host computer as a local hard disk drive.
attributes Displays, sets, or clears the attributes of a disk or volume.
automount Enables or disables the automount feature.
break Breaks the mirrored volume with focus into two simple volumes.
clean Removes any and all partition or volume formatting from the disk with focus.
compact Reduces the physical size of a dynamically expanding virtual hard disk (VHD)
vdisk file.
convert Converts file allocation table (FAT) and FAT32 volumes to the NTFS file
system, leaving existing files and directories intact.
create Creates a partition on a disk, a volume on one or more disks, or a virtual hard
disk (VHD).
delete Removes a specified partition on a specified hard drive.
detach Stops the selected virtual hard disk (VHD) from appearing as a local hard disk
vdisk drive on the host computer.
detail Displays information about the selected disk, partition, volume, or virtual hard
disk (VHD).
exit Exits the diskpart command interpreter.
expand Expands a virtual hard disk (VHD) to the size that you specify.
vdisk
extend Extends the volume or partition with focus, along with its file system, into free
(unallocated) space on a disk.
filesystems Displays information about the current file system of the volume with focus
and lists the file systems that are supported for formatting the volume.
format Formats a disk to accept Windows files.
gpt Assigns the gpt attribute(s) to the partition with focus on basic GUID partition
table (gpt) disks.
help Displays a list of the available commands or detailed help information on a
specified command.
import Imports a foreign disk group into the disk group of the local computer.
2

Diskpart Command Parameters


inactive Marks the system partition or boot partition with focus as inactive on basic
master boot record (MBR) disks.
list Displays a list of disks, of partitions in a disk, of volumes in a disk, or of virtual
hard disks (VHDs).
Merge Merges a differencing virtual hard disk (VHD) with its corresponding parent
vdisk VHD.
offline Takes an online disk or volume to the offline state.
online Takes an offline disk or volume to the online state.
recover Refreshes the state of all disks in a disk group, attempt to recover disks in an
invalid disk group, and resynchronizes mirrored volumes and RAID-5 volumes
that have stale data.
rem Provides a way to add comments to a script.
remove Removes a drive letter or mount point from a volume.
repair Repairs the RAID-5 volume with focus by replacing the failed disk region with
the specified dynamic disk.
rescan Locates new disks that may have been added to the computer.
retain Prepares an existing dynamic simple volume to be used as a boot or system
volume.
san Displays or sets the storage area network (san) policy for the operating
system.
select Shifts the focus to a disk, partition, volume, or virtual hard disk (VHD).
set id Changes the partition type field for the partition with focus.
shrink Reduces the size of the selected volume by the amount you specify.
uniqueid Displays or sets the GUID partition table (GPT) identifier or master boot record
(MBR) signature for the disk with focus.

Diskpart Command Examples


diskpart /add \Device\HardDisk0 5000

In the above example, the diskpart command creates a 5,000 MB partition on the
hard drive located at \Device\HardDisk0.
diskpart /delete \Device\HardDisk0\Partition1

For this one, the diskpart command will remove the Partition1 partition located on the
hard drive \Device\HardDisk0.
diskpart /delete G:

This command will remove the partition currently assigned the drive letter G.
diskpart
list disk
select disk 1
attributes disk clear readonly
exit

Finally, in this multi-part command, diskpart is being used to select a particular


disk, disk 1 in this example, so that we can remove the readonly attribute that's been
set on it.

You might also like