Among the roles that we have as IT support personnel is to have useful tools for a correct control of the managed operating system. The hard disk helps us both in initial tasks of starting the Operating System and in file management and storage tasks . That is why it is important to know how to manage and take care of them, within the options you also have the possibility of repairing them easily by command..
Windows operating systems come by default with useful tools, some simple others not so much, to manage elements such as disks, users, network, folders, all with the aim of making the system reliable and safe.
One of these many tools is Diskpart which many times we leave behind and we do not know the potential and use that we can get from it in terms of disk management. For this reason, this tutorial has been carried out with the intention of using Diskpart in a more efficient way, in this case Windows 10, but the process is identical in Windows 7 and 8..
If before or during the administration of your disks some type of problem occurs, you can consult this video to see how to fix and format them by commands in Windows 10, 8 or 7.
To stay up to date, remember to subscribe to our YouTube channel! SUBSCRIBE
What is Diskpart
Disk Partition Utility (Diskpart) is a command line tool used to manage the hard disk in Windows operating systems.
Diskpart has been replaced with the FDisk command line tool that works with the MS-DOS based operating system.
This tool offers us the possibility of managing objects (disks, partitions or volumes) through scripts or directly at the command prompt..
Diskpart can be used both in the command prompt and in PowerShell, but we must be careful in the way we manage it since some badly executed command can seriously affect the behavior of the hard disk as it can happen with many other commands.
How to use Diskpart
To use Diskpart we have two options:
- Use the following key combination and in the displayed window run diskpart, press Enter or OK
+ R
- Access the command prompt as administrators and from there run diskpart
Once we execute the command we will see the following. At this point we will be ready to work hard drives in Windows using Diskpart
We also leave you the video tutorial with the steps to manage a hard drive by commands from Windows 10.
To stay up to date, remember to subscribe to our YouTube channel! SUBSCRIBE
1. List and clean disk in Windows 10, 8, 7
It is possible that before executing the respective command, list the installed hard drives of the system. To do this, we must type list disk and press Enter to show all the hard drives connected to the computer.
List discs
The List disk command only shows the normal hard disks on the computer, so if a hard disk is damaged, it will not be possible to view it with the list disk command, this will be the result:
There the current disks of the equipment will be displayed, we must select the correct disk that we want to manage with the command line through the execution of the following syntax.
select disk
To verify if the disk has been selected or not, we must write the list disk command again and see the result. The * sign in front of Disk 1 shows that disk one is selected and ready for administration.
Clean hard drive
The next step is to run the clean command to clean the selected disk. At the time of running clean we will see the following message:
Once the disk is clean we can create the partition on it.
2. Create a disk partition using Diskpart in Windows 10, 8, 7
To create a partition on the selected hard drive, simply enter the line "create partition primary size = (Size)" and press enter. This command is the one that helps us create a primary partition based on the size indicated on disk 1. We can assign the size of the partition according to the capacity of the hard disk and what we need to place depending on what we need.
Step 1
In this case we will create a 5 Gb partition so we execute the following:
create partition primary size = 5000
Step 2
Pressing Enter we can see that Diskpart creates the partition correctly:
Step 3
To verify the created partition, we run the List vol command, this command will display a list of all available volumes on the selected disk. We can see that the created partition is selected and marked as volume 3.
3. Format disk partition in Windows 10, 8, 7
Once the partition is created, the next step is to format it so that it is usable and write data to it.
Step 1
We can see that until now the volume format is RAW, which is not recognized by the system, to apply the native Windows format, NTFS, we will execute the following line:
format fs = ntfs quick
Step 2
The fs line refers to the file system to apply (File System)
Step 3
We see that the volume was formatted correctly, to verify that it is NTFS we run list vol again and we will see that volume 3 already has the NTFS file system:
Step 4
We can see that we need to assign a letter to said volume, we can execute the line assign letter = (Letter) and press enter. The indicated letter has been assigned to volume 3. It will now appear with that letter in File Explorer.
assign letter = s
Step 5
We verify in the explorer said unit:
4. Erase Disk Partition in Windows 10, 8, 7
To delete a partition in Windows using the command line, we must first select the volume to delete and then execute the delete partition line:
5. Extend disk partition in Windows 10, 8, 7
Another action we can take is to increase the capacity of a unit.
For this, first, we run list vol to view the current volumes of the system and see if the correct one is selected.
Step 1
Subsequently, once the volume is selected, we execute the following syntax:
extend size = (Space)
Step 2
In this example we will add 3 GB more. When we run list vol again we can see that volume 3 went from 5 GB to 8 GB.
extend size = 3000
6. Reduce size of a volume in Windows 10, 8, 7
The final task is to reduce the size of a volume.
Shrinking a volume is creating unallocated space of free spaces from an existing partition.
To carry out this, after selecting the desired volume, we execute the following line:
shrink desired = 5000 minimum = 4000
7. Change or delete disk drive letter with command diskpart Windows 10, 8, 7
To change the letter of a disk by commands we can do the following:
Step 1
We open the Run command using the following combination
+ R
Step 2
We write diskpart to open the utility
Step 3
Once inside the Diskpart tool we must see the list of available volumes:
List volume
Step 4
Now we look at the volume that we want to edit its letter and select it. If our volume is K we will:
Select volume K
Step 5
Since we already have the volume selected, select either of these two commands in order to assign a new letter:
assign letter = ”Letter” assign letter ”Letter”
Note
If we attribute a letter to a volume that is already in use, it will warn us that we cannot use it.
Step 6
We will see that the new unit with the changed letter has been added.
Step 7
If we want to eliminate the letter of a unit, when we have it selected (step 4) we will execute the following syntax:
Remove letter = letter Remove letter = K
To stay up to date, remember to subscribe to our YouTube channel! SUBSCRIBE
8. Check disk errors in Windows 10, 8, 7
Our hard drive is the cradle where we store information that is of value to us. In addition to being our personal warehouse, the hard disk intervenes in the startup of our equipment. If our hard drive crashes or breaks, we will lose the option to start our computer and possibly also our data.
In order to make an optimal repair of our hard drives we have the chkdsk or Check Disk command , a tool that allows us to analyze, verify and repair the state of our drives to repair them and improve their operation. With a single command we will have the possibility to review disks and solve possible logical errors.
Although it is a tool that can be slow in its analysis, it offers us really interesting functions, being able to verify the complete state of files and metadata as well as correcting them. It also allows analyzing each sector to find those that are damaged and thus repair them.
In this video you can see more ways to analyze and repair your disks in case of failures using the CHKDSK command and see their parameters:
To stay up to date, remember to subscribe to our YouTube channel! SUBSCRIBE
We have seen how Diskpart becomes a practical and simple solution for managing hard drives in Windows environments and, as we have indicated, it is careful since we will never receive a warning message and all the actions carried out are automatically executed.