Scroll To Top

How to Manage Hard Disk with Command in Windows 10?

Posted in Windows1 week ago • Written by Shams1 Comment

The storage management or hard disk management is easy with the command line as GUI disk management on Windows. Here we just focus on this topic to manage hard disk using command on Windows 10 and other Windows operating systems. Manage Hard disk with command line tool DiskPart.

The Disk Partition Utility (Diskpart) is a command-line tool for managing hard disk in Windows operating system. Diskpart has replaced with FDisk command-line tool which works with the MS-DOS-based operating system.

Manage Hard Disk using Command Line

Diskpart can be used on both command prompt and PowerShell. But, you must well be understanding what you are doing when using Diskpart. It might happen much time which formatted the entire disk with one command. The last one was a Laptop of my friend with lots of memorial photos and videos. Fortunately, we had recovered all data successfully with data recovery software. But take too us much time.

Manage Hard Disk using Command Line in Windows 10: 

  1. Open command line or PowerShell.
  2. Run DiskPart as Administrator privilege.
  3. Clean Hard Disk with Command Line.
  4. Create Partition with Command.
  5. Format Hard Disk with Command.
  6. Delete Partition.
  7. Extend Partition with Command Line.
  8. Shrink Partition with Command.

That’s all you will learn from reading this article about tips to manage hard disk using command line in Windows environment. Let’s start it with running DiskPart as administrator privilege on Windows 10. You can use this command on other Windows operating systems as well.

  1. Press Windows+R to open the Run and type “diskpart” then press enter to run the DiskPart utility.
  2. Click Yes to User Account Control prompt.
Manage Hard Disk using Command Line in Windows 10 - Technig

Run DiskPart on Windows 10 – Technig

1. Create Partition with Command

You may want to list installed hard disks of the system. Just type ‘list disk’ then press enter to display all connected hard disks of your PC. The List disk command only shows the normal hard disks on your computer. If your hard disk is corrupted, it’s not possible to display with DiskPart List Disk command.

1. Type “List Disk” to view all hard disks.

How do I list drives in command prompt? - Technig

How do I list drives in command prompt? – Technig

2. In this PC we have two hard disks. You must select the correct disk you want to manage with the command line. Choose the disk with select disk command.

For example, you want to select disk 1. Type “select disk 1” command and press enter. Now the disk one has chosen as the disk you want to manage it with the command line.

Select Hard Disk

Select Hard Disk

To see whether the disk has selected or not, just type “list disk” and see the result. The strick in front of Disk 1 shows that the disk one is selected and ready for management.

2. Clean a Partition Using DiskPart

Now clean the disk by ‘Clean’ command.

  1. Type “clean” and press enter to clean disk with command.
How to Clean a Partition using diskpart - Technig

How to Clean a Partition using DiskPart – Technig

That’s all command to clean a disk with DiskPart command. Let’s create a new partition with command.

3. Create a Partition with Command

To create a partition with command just type “Create partition primary size=40000″ and press enter. This command will create a 40 GB primary partition from disk 1. You can assign the size of your partition according to your hard disk capacity.

1. Type “create part primary size=50000” then press enter.

How to Create Partition using Command Prompt - DiskPart Create Partition Windows 10

How to Create Partition using Command Prompt – DiskPart Create Partition Windows 10

2. To check the created partition type ‘List vol’ command. The command will list all volumes. On the below screenshot Volume 3 is the created partition with 39 GB space.

List all Hard disk Volumes - DiskPart List Volume Windows 10 - Technig

List all Hard disk Volumes – DiskPart List Volume Windows 10 – Technig

The last Volume 3 is the newly created partition. It is selected and ready to format it.

4. How to Format Partition with Command?

  1. Type ‘format fs=ntfs quick’ to format the partition, and type ‘list vol’ to see the formatted partition with NTFS file system.
DiskPart Format Partition - How to Format Partition with Command Line - Technig

DiskPart Format Partition – How to Format Partition with Command Line – Technig

You can see the result of Diskpart format partition. It shows volume 3 has formatted as NTFS type. Next, assign a letter to the newly formatted partition.

2. Just type “assign letter=f” and press enter. The F letter has assigned to volume 3. Now it appears as F local drive on File Explorer.

Assign letter to a volume with Command Line - Technig

Assign letter to a volume with Command Line – Technig

Now you have learned creating, formatting and some diskpart commands for managing hard disk with the command line in Windows 10. The next step is using some more DiskPart command to get expert on Diskpart disk management tool.

5. How to Delete a Partition with Command? 

  1. To delete a partition or volume with command first select volume then type “delete partition.” Like screenshot.
DiskPart delete Partition - How to Delete a Partition with Command Line in Windows 10 - Technig

DiskPart delete Partition – How to Delete a Partition with Command Line in Windows 10 – Technig

Yes, you can see the result, the partition ‘Volume 3’ has deleted successfully.

6. How to Extend a Partition with Command?

The extended process is to add some more space to existing partition from the free space of a hard disk. To do this, just follow the screenshot.

  1. List the volumes with “List vol” command.
  2. Type “extend size=10000” to add extra 10 GB to volume 3 from the free spaces of the hard disk.
DiskPart Extend Partition - How to Extend Partition with Command Line in Windows 10 - Technig

DiskPart Extend Partition – How to Extend Partition with Command Line in Windows 10 – Technig

The ‘Extend size=10000’ will add 10 GB to the Volume 3 partition. If you don’t mention the size, the system will add all free space.

6. How to Shrink a Partition with Command?

It is the best option for a newly purchased laptop that only has one drive on its hard disk. You can use DiskPart shrink command to shrink the extra free spaces of a drive. Shrink a volume is to create unallocated space from free spaces of an existing partition.

  1. Type “List vol” to see all volumes.
  2. Just type “shrink desired=20000 minimum=10000” then press enter.
Sharink a Partition

Shrink a Partition

The Diskpart shrink command has shrunk 19 GB from the Volume 3 successfully.

Finally, I hope this article helps you manage hard disk using command line easy. If you have any issue with disk management or DiskPart commands, please comment us.


TAGS: , , , , , , , , ,
About this Author
Shams

I’m the internet geek’s of my town. Working as assistant with CEO of JowGroups Internet Marketing Team and content creator in Technig.com

L

1 Comment so far. Feel free to join this conversation.

  1. Hyper V Windows 10 SupportNovember 9, 2017 at 7:29 pm - Reply

    Thanks for this useful tutorial.

Leave A Response