diskpart interview questions
Top diskpart frequently asked interview questions
I have a USB Thumb Drive that I was going to use to install Windows 7 with. While formatting the drive with the Windows 7 USB/DVD download tool it failed leaving my USB drive in an unusable state.
I can see the drive with the Windows Disk Manager, but it shows that it has a RAW file system, and any time I try to reformat it a second time, it simply says that It can't find the file or partition. Using DiskPart I've also not had very much luck as trying to use the FORMAT
command results in an error. These are the commands I'm using and their output.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>diskpart
Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: DYGEAR-PC
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 14 GB 0 B
Disk 1 Online 74 GB 0 B
Disk 2 Online 698 GB 0 B *
Disk 3 Online 15 GB 0 B
DISKPART> select disk 3
Disk 3 is now the selected disk.
DISKPART> detail disk
Corsair Voyager Mini USB Device
Disk ID: 00000000
Type : USB
Status : Online
Path : 0
Target : 0
LUN ID : 0
Location Path : UNAVAILABLE
Current Read-only State : No
Read-only : No
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : No
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 4 Removable 15 GB Healthy
DISKPART> select volume 4
Volume 4 is the selected volume.
DISKPART> FORMAT RECOMMENDED OVERRIDE
DiskPart has encountered an error: The system cannot find the file specified.
See the System Event Log for more information.
DISKPART> FORMAT FS=NTFS LABEL="Windows7" QUICK COMPRESS
DiskPart has encountered an error: The system cannot find the file specified.
See the System Event Log for more information.
DISKPART>
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 14 GB 0 B
Disk 1 Online 74 GB 0 B
Disk 2 Online 698 GB 0 B *
Disk 3 Online 15 GB 0 B
DISKPART> select disk 3
Disk 3 is now the selected disk.
DISKPART> clean all
DiskPart has encountered an error: Incorrect function.
See the System Event Log for more information.
DISKPART> list partition
There are no partitions on this disk to show.
DISKPART> online disk
Virtual Disk Service error:
This disk is already online.
DISKPART> attributes disk clear readonly
Disk attributes cleared successfully.
DISKPART> clean
DiskPart has encountered an error: Incorrect function.
See the System Event Log for more information.
DISKPART> convert mbr
DiskPart successfully converted the selected disk to MBR format.
DISKPART> create partition primary
DiskPart succeeded in creating the specified partition.
DISKPART> select part 1
Partition 1 is now the selected partition.
DISKPART> active
DiskPart marked the current partition as active.
DISKPART> format fs=NTFS label=USB quick
DiskPart has encountered an error: The system cannot find the file specified.
See the System Event Log for more information.
DISKPART> format quick
DiskPart has encountered an error: The system cannot find the file specified.
See the System Event Log for more information.
DISKPART> assign letter F
DiskPart has encountered an error: The system cannot find the file specified.
See the System Event Log for more information.
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 V Video NTFS Simple 698 GB Healthy
Volume 1 D SSD NTFS Partition 14 GB Healthy
Volume 2 System Rese NTFS Partition 100 MB Healthy System
Volume 3 C NTFS Partition 74 GB Healthy Boot
* Volume 4 Removable 15 GB Healthy
DISKPART>
Source: (StackOverflow)
I use software RAID on my Windows 7 ultimate box media center. Unfortunately, Windows decides it needs to rebuild my software RAID pair much more often than I'd like. The most common way to see the progress of rebuilding the RAID is to use diskmgmt.msc
. However, this is very slow to start up and requires me to either be on the machine directly or use remote desktop to view the results.
I'd like to use diskpart
to check the status of my RAID rebuild as it runs much faster and I can SSH into the machine ( to BitVise SSHD) and check the status -- something that is very helpful when the display is active with a movie or TV show. However, it only says whether or not the RAID is rebuilding, not the progress of the rebuild:
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 C NTFS Mirror 1862 GB Rebuild Boot
Volume 1 System Rese NTFS Mirror 100 MB Healthy System
Volume 2 D DVD-ROM 0 B No Media
This shows that Volume 0 is currently in a rebuild process, so I select it for more information:
DISKPART> select volume 0
Volume 0 is the selected volume.
DISKPART> detail volume
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 1863 GB 0 B *
Disk 1 Online 1863 GB 0 B *
Read-only : No
Hidden : No
No Default Drive Letter: No
Shadow Copy : No
Offline : No
BitLocker Encrypted : No
Installable : Yes
Volume Capacity : 1862 GB
Volume Free Space : 229 GB
As you can see, this provides more information on the volume, but does not provide any insight into the progress of the rebuild.
Any hints on how to get the progress of the rebuilt from diskpart
or other command line tool?
Source: (StackOverflow)
I feel like this is a really simple and fundamental function that Windows should have, but so far Google has been telling me it isn't possible. How can I mount an NTFS partition read-only in Windows?
Everett's answer works! (Thanks.)
Additional info about diskpart
:
If you have multiple volumes in a disk, neither detail vol
nor attr vol
shows the correct read-only status. It shows the read-only status of the last modified volume. Try these: sel vol 1
, attr vol set readonly
, sel vol 2
, attr vol clear readonly
, sel vol 1
. Now detail vol
shows that volume 1 is not read-only, but it actually is.
If you modify a volume with Linux's ntfs-3g
and then bring it to Windows, it cannot be mount read-only.
If you run attr disk set readonly
, none of the disk's volume can be mounted.
Source: (StackOverflow)
I have a USB flash drive, which I may have mucked up, so I used DISKPART
's CLEAN
to clean it up. I created a simple volume, and tried to format it. (This is all using Windows' disk management.) I was told The system cannot find the file specified
.
So I tried using DISKPART
(as an admin):
DISKPART> select volume 9
Volume 9 is the selected volume.
DISKPART> format recommended
DiskPart has encountered an error: The system cannot find the file specified.
See the System Event Log for more information.
DISKPART>
As you can see, no luck.
When I plug the drive in, the computer makes a beep noise as though it has recognised something, but nothing appears in My Computer
How can I format the disk so I can use it again?
Source: (StackOverflow)
I'm trying to use DiskPart
to create two partitions on my flash drive. One for storage and one for a bootable OS. I've used BootIt as suggested in this question/answer, however it doesn't seem to help one way or the other. Perhaps it's out of date for Windows 7, the OS I'm working on, and yes I tried running BootIt in compatibility mode with admin privileges.

From Disk Management
I wasn't able to do anything but format the current partition, change drive letter, and change drive label.
I then used DiskPart
, which seems to be the best option, to create the first partition. I can see the unallocated space available in Disk Management
after doing this, but when I try to create another partition I get an error.


UPDATE:
Tried using extended
and got the same error message as above. Retried from scratch using offset
and received a different error.

Source: (StackOverflow)
Are there some applications that are embedded in Windows (such as diskpart) to resize partitions?
Source: (StackOverflow)
So 3 months ago I built a PC, but had the opportunity to borrow an SSD from my place of employment. I originally installed windows 7 trial mode on that SSD, and then after a few weeks upgraded to windows 8, but installed it on a second hard drive. I then wiped the SSD (at least I thought i did the whole drive), and used it as a data drive in windows 8.
Today I took the SSD out of my system to take back to work, and immediately formatted the whole thing to put ubuntu server on it for work. Now I'm back home and the windows 8 drive can't boot anymore. Apparently when windows 8 was installed, it just replaced windows 7's boot loader with its own, but on the ssd.
So For the past 2.5 months I've been booting to the ssd, which has then been forwarding to the hard drive's OS sector. Now that the SSD is gone (and completely wiped), the chain is broken and I don't have a boot sector. How do I create one without re-installing windows entirely?
I have a windows 8 installation USB key that I can get into recovery mode with. Here's some stuff from diskpart that i've transposed from photos:
DISKPART> LIST VOL
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 NTFS Partition 465 GB Healthy
Volume 1 C ESD-USB FAT32 Removable 14 GB Healthy
DISKPART> LIST DISK
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
* Disk 0 Online 465 GB 0 B *
Disk 1 Online 14 GB 0 B
DISKPART> LIST PARTITION
Partition ### Type Size Offset
------------- ---------------- ------- -------
* Partition 1 Reserved 128 MB 1024 KB
Partition 2 Primary 465 GB 128 MB
DISKPART> ACTIVE
The selected disk is not a fixed MBR disk.
The ACTIVE command can only be used on fixed MBR disks.
It looks like there's space for a boot sector there, but I can't assign that reserved partition a drive letter, which is as far as I could get with http://superuser.com/a/504360
I can't set that partition as active either, cus the drive table isn't mbt.
Thanks.
Source: (StackOverflow)
I'm trying to fix a USB flash drive to format to the full capacity. When I use diskpart I cannot delete the primary partition.
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 0 B *
Disk 1 Online 18 GB 1024 KB *
Disk 2 Online 7720 MB 0 B
DISKPART> select disk 2
Disk 2 is now the selected disk.
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
* Partition 1 Primary 24 MB 0 B
Although diskpart shows that Partition 1 is selected by the asterisk I cannot delete the partition.
DISKPART> delete partition
There are no partitions selected.
Please select a partition, and try again.
So I try to select the partition and this is where I am having trouble.
DISKPART> select partition 1
There is no partition selected.
Source: (StackOverflow)
I have a 4GB HP USB flash drive that I had written a Chromium OS image to with Win32DiskImager. Now I am trying to reformat it but I can't. Everything tells me the disk is write protected. Being a USB flash drive, there is no write-protect switch. I have tried the standard windows format thing, disk management, diskpart and HP USB Disk Storage Format Tool. I also tried the registry modification. Any ideas? Here is the results of trying to use diskpart:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>diskpart
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: BRANDON-PC
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 931 GB 1024 KB
Disk 1 No Media 0 B 0 B
Disk 2 No Media 0 B 0 B
Disk 3 No Media 0 B 0 B
Disk 4 No Media 0 B 0 B
Disk 5 No Media 0 B 0 B
Disk 6 Online 3824 MB 0 B
DISKPART> select disk 6
Disk 6 is now the selected disk.
DISKPART> attributes disk clear readonly
Disk attributes cleared successfully.
DISKPART> clean
DiskPart has encountered an error: Incorrect function.
See the System Event Log for more information.
DISKPART> create partition primary
DiskPart succeeded in creating the specified partition.
DISKPART> format fs=fat32
0 percent completed
Virtual Disk Service error:
The media is write protected.
DISKPART> exit
Leaving DiskPart...
C:\WINDOWS\system32>
Even after using "attributes disk clear readonly" it still says the media is write protected. I think it's because the clean operation fails.
Source: (StackOverflow)
I want to install windows 7 on an unallocated space made by shrinking an extended partition. the problem is that windows setup can't create new partition on unallocated space. how I can create a partition there using diskpart while that space is not shown by "list partition" of diskpart?
Source: (StackOverflow)
I saw your answer to a question which has somewhat similar details like mine in this thread: Recovering a Partially Formatted USB Thumb Drive.
However, in my case, my usb is write- protected. Can you help me with it?

As you can see, there is a part in the picture above saying, Current Read-only State: Yes
, and I think it's because my USB is write- protected. I tried entering a command, attributes disk clear readonly
, and it replied Disk attributes cleared successfully.
. Ensuring that I can format the USB now since the write- protection is gone, I entered, detail disk
, but it only gave me the same results.

Even though it gave the same results, I continued following your solution. I entered, FORMAT RECOMMENDED OVERRIDE
, but still, it gave me a reply saying The media is write protected.
Seeing this result, I did not continue the following solutions, thinking it would just worsen the state of my USB and I would just obtain the same results. What can I do? Also, I still want my USB file system to be FAT32.

Here is the view of my USB drive in My Computer when I mounted it.
In addition, my USB doesn't have a switch.
My question with complete details is here, since I can't post more than 2 links and I can't upload images:
http://swampertblaziken.wordpress.com/2013/10/18/how-to-make-a-write-protected-usb-drive-usable-using-diskpart/
Source: (StackOverflow)
When using DISKPART I accidentally used the CLEAN command on my portable WD 500gb HDD. Now it is not showing as a drive in my computer, though shows as unallocated space in Disk Management.
Thanks for your help
Source: (StackOverflow)
I want to extend my volume. However the unallocated space lies ahead of the volume. Is it possible to extend this volume without converting it to a dynamic volume?
Large Image
I tried to use diskpart with the extend command but it doesn't work. Makes sense because the instructions says that the unallocated space has to be behind the volume.
Source: (StackOverflow)
I'm trying to get a bootable external USB drive, from which to install Server 2008 R2, but all the online help I find includes a FORMAT comment in the DISKPART session. My diskpart displays a list of commands in response to the format command, i.e. there is no format command. Here is an example of the command sequence I'm trying to run on XP SP 3:
DISKPART> select disk 1
DISKPART> clean
DISKPART> create partition primary
DISKPART> select partition 1
DISKPART> active
DISKPART> format fs=fat32
DISKPART> assign
DISKPART> exit
Source: (StackOverflow)