0% found this document useful (0 votes)
26 views

How To Use Diskpart, CHKDSK, Defrag and Other Disk-Related Commands - Digital Citizen

This document provides instructions for using various disk management commands from the command prompt or PowerShell to manage disks and partitions. It explains how to use diskpart to create partitions, chkdsk to check for errors, and defrag to defragment disks. Administrative privileges are required, and backups should be made before modifying disk structures due to risk of data loss if commands are misused.

Uploaded by

Na-sy Nti RH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

How To Use Diskpart, CHKDSK, Defrag and Other Disk-Related Commands - Digital Citizen

This document provides instructions for using various disk management commands from the command prompt or PowerShell to manage disks and partitions. It explains how to use diskpart to create partitions, chkdsk to check for errors, and defrag to defragment disks. Administrative privileges are required, and backups should be made before modifying disk structures due to risk of data loss if commands are misused.

Uploaded by

Na-sy Nti RH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

How to use diskpart, chkdsk, defrag and other disk- POPULAR ARTICLES

related commands
What are drivers? What does a
driver do?
TUTORIAL by Codrut Neagu published on 12/04/2018 Share:
MISC Codrut Neagu 02.04.2021
One of the easiest and most straightforward ways to manage If you have used a computer, then you have probably
your disks is to use the Disk Management tool from Windows. heard about drivers However, do you know what a driver is

But hey, Disk Management is a visual tool and some of us like Moreover, what does it do that makes it so crucial to a
f
command-based interfaces a whole lot more. That is why we
thought it would be a great idea to see how several disk Best free file recovery software:
management actions can be done from the Command Prompt or PowerShell, using diskpart, chkdsk, Recuva vs. the competition
defrag, and other command-line tools. In this article we show you how to create, format, delete,
MISC Codrut Neagu 02.02.2021
THIS SITE USES COOKIES
hide and unhide, defragment and check your partitions for errors, directly from the Command In this
This site, like many others, uses small files called cookies to help us improve and customize your experience. Learn moreday andcookie
in our age, you can find many apps that promise
policy.
Prompt. Let’s get started: to help you recover deleted files It is great to have lots of
Choose cookies: Functional Analytics Marketing OK
options, but the question is, which programs are good at
Important aspects to consider before moving forward
To be able to perform any actions presented in this article, you need to have administrative rights
How to delete a page in Word (6
and run the Command Prompt or PowerShell as administrator. Read one of the following articles,
ways)
depending on what you want to use:
TUTORIAL Codrut Neagu 02.01.2021
10 ways to launch the Command Prompt in Windows
Microsoft Word is one of the best and most popular tools
9 ways to launch PowerShell in Windows (including as admin)
for writing and editing documents It’s also designed to be

It is also important for you to acknowledge the fact that, if you misuse the commands listed in this easy to use and offer an intuitive interface Be that as it

article, you risk losing your data. Be careful and make a backup of your data before going ahead. If
anything bad should happen, we did warn you!
POPULAR REVIEWS
1. How to use diskpart to create a partition from the Command Prompt
Security for everyone – Review
or PowerShell ESET Smart Security Premium
In Command Prompt or PowerShell, type diskpart to access the Windows tool called Diskpart.
REVIEW Codrut Neagu 01.26.2021
ESET develops many security products, both for consumers
and businesses, from one of the friendliest antiviruses for
home users, to large corporate security products designed

Samsung Galaxy S20 FE 5G


review: 2020’s best Samsung
smartphone?
REVIEW Codrut Neagu 01.13.2021
Samsung did a great job with its S20 lineup of Android
smartphones, all of them featuring top-notch hardware,
beautiful design, excellent cameras, and good software
f

TP-Link Archer AX10 (AX1500)


review – Affordable Wi-Fi 6 for
Launching diskpart in Command Prompt
everyone!
After you have launched diskpart it is time to establish which hard disk or solid state drive you want REVIEW Ciprian Adrian Rusen 01.04.2021

to use for creating a new partition. You can select the drive with the select command. To view the TP-Link Archer AX10 or TP-Link Archer AX1500 has a
different name depending on the country and the shop
available disks on your system, run the command list disk.
you buy it from However, it is the same router, with the
f

SEARCH

Enter search terms

SUBSCRIBE

CATEGORIES OTHER
PRODUCTIVITY SUBSCRIPTION OPTIONS
Using diskpart to list the drives from a PC

ENTERTAINMENT ABOUT DIGITAL CITIZEN


To select the disk you want to work with, type select disk followed by the number of the hard disk
SECURITY NEWSLETTER
you want to use.
SMARTPHONE TERMS AND CONDITIONS

SMARTHOME COOKIES

HEALTH CONTACT US

Using diskpart to select the disk on which the following commands are applied to

To create a new partition, you need to use the create partition command followed by the partition
type and size. Note that the list command used previously also displays the available free space on
each hard disk. Your partition must be of a size equal or less to the amount of available free space.
For instance, to make a new primary partition with the size of 10240 MB (10 GB), you must type
“create partition primary size=10240”. Use the same command and change the size according to
your needs and the available free space on your hard disk.

Using diskpart to create a primary partition

2. How to use diskpart to assign a letter to a partition from the


Command Prompt or PowerShell
You can and probably want to also assign a letter to the newly created volume. Assigning a letter
to a partition makes it visible in File Explorer so that you can easily access it. To assign a letter to a
partition use the assign command.
For instance, if you wanted to assign the R letter to the partition you just created, you should type
“assign letter = R”.

Using diskpart to assign a letter to a partition (unhide a partition)

Please remember that before assigning a drive letter, you need to start Diskpart and select the disk
for which you want to assign the letter.

3. How to use diskpart to remove the letter of a partition from the


Command Prompt or PowerShell (hide a partition)
If you have a partition that contains private information that you do not want to be seen by apps
and people, you might want to hide it from File Explorer. To do so, you can remove its partition
letter and Windows stops making it easily accessible. To hide a partition, run diskpart in Command
Prompt or PowerShell and select the volume that you want hidden. Then, run the command remove
letter=R where R is that partition’s assigned letter. That is all: now the partition is not visible in File
Explorer anymore.

Using diskpart commands to hide a partition by removing its drive letter

4. How to use diskpart to format a partition from the Command Prompt


and PowerShell
Although you now have a new partition created on your computer or device and it also has a letter
assigned so it is easy to access it, you are still unable to use it until you also format that partition.
To do that too, use the command “format fs=ntfs quick”. Use help format to find out more about
this command.

Formatting a partition with diskpart, in Command Prompt

This command should be used after you start diskpart and select the disk that you want to format.

5. How to use diskpart to delete a partition from the Command Prompt


or PowerShell
When you need to delete a drive from your computer, the procedure is quite simple. First, open the
diskpart application. Then, select the partition that you want to delete and type the delete partition
command.
You can see an example of how the delete operation works, below. It is a matter of selecting the
disk where the partition is found, then selecting the volume to be deleted and running the delete
command.

Using diskpart in Command Prompt to delete a partition

When you are done working with diskpart, type the exit command to close the program.

Exiting diskpart in Command Prompt

6. How to use chkdsk to check a drive for errors from the Command
Prompt or PowerShell
To check a disk for errors you have to use the chkdsk command. Type chkdsk followed by the
drive’s letter. We recommend that you always use this command in combination with the /f
parameter. This enables the tool to automatically fix any errors it finds.
As an example, we are scanning the R: drive for errors by typing chkdsk /f r: and pressing Enter. The
scan process starts immediately.

Using the chkdsk command to check a drive for errors

After the scan is finished you see a report similar to the one from the picture below.

A report from the chkdsk command

This summarizes how much disk space the partition has, how many files are in use by the system,
how much free space is available on the disk, how many bad sectors were identified and so on.

7. How to use defrag to optimize a drive from the Command Prompt or


PowerShell
Command Prompt and PowerShell also give you a way of optimizing (trimming or defragmenting) a
partition. All you have to do is type the command defrag followed by the drive’s letter. If you
wanted to optimize the R: partition, for example, you would use “defrag r:”. If everything worked
well, you should get a report like the one below, after the volume you selected has been optimized
(trimmed if it is an SSD, or defragmented if it is a hard disk).

Running defrag to trim an SSD or defragment an HDD

The report includes information prior to the optimization process and after it was completed, like
the volume size, free space, total fragmented space, and the largest free space size.

Have you found this guide useful?


Even though you might think it is hard to manage your partitions through the Command Prompt or
PowerShell, we hope that we managed to prove that it is not that difficult. The procedures involved
are not complicated at all and, once you learn how to use diskpart and know the correct
commands, using the Command Prompt or PowerShell can be a lot faster than using other tools
like Disk Management. If you have any questions, feel free to leave a comment below.

NEWSLETTER: DAILY WEEKLY

Receive our daily newsletter. You may unsubscribe at any time. For details read the Privacy policy.

Email

Check this if you wish to receive our messages.

SUBSCRIBE!

DISCOVER: PRODUCTIVITY COMMAND PROMPT PROGRAMS RECOMMENDED


SYSTEM AND SECURITY TUTORIALS WINDOWS

Share: View comments Add comment

Related articles

2 ways to resize a Two ways of deleting a 3 reasons to create How to change the
partition in Windows partition, in Windows, more than one partition letter of any drive or
(all versions) without third-party on your PC partition, in Windows
apps

You might also like