55

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?

ACarter
  • 1,374
  • 3
  • 14
  • 27
  • is anything showing up in Device Manager? Try different usb port... – Logman Nov 24 '12 at 14:42
  • @Logman I tried a different port, formatting still failed. The device appears under Disk Drives in Device Manager (properties says it's working properly), but still nothing in My Computer, and no formatting – ACarter Nov 24 '12 at 15:06
  • try running CheckDisk? >chkdsk /r /f – Logman Nov 24 '12 at 20:17
  • The excerpt you posted does not show the error message you quote, and just shows DISKPART telling you, rightly, that you need to select a volume before you can format it. What's up? – kreemoweet Nov 24 '12 at 20:27
  • 1
    In DiskPart do: 'SELECT VOLUME 6' then 'FORMAT RECOMMENDED', you format a volume, not a disk. – Peter Hahndorf Nov 24 '12 at 21:24
  • @kreemoweet this is why I asked the question, I don't know – ACarter Nov 24 '12 at 21:57
  • @PeterHahndorf thanks for that, I did so, but I got the same `The system cannot find the file specified` as I got in disk management :( – ACarter Nov 24 '12 at 21:57
  • So what does the Event Log say? Win+R, type 'eventvrw', then select the System log under 'Windows Logs' and look for any errors. – Peter Hahndorf Nov 25 '12 at 09:08
  • 1
    @PeterHahndorf you mean `eventvwr`. – joneshf Sep 20 '13 at 15:56
  • `When I plug the drive in, the computer makes a beep noise as though it has recogni[s]ed something, but nothing appears in My Computer` Seems to imply there's something wrong with the bus itself. Physically disconnect the drive, go into Device Manager and remove your USB controller components and right-click on your computer name and select, `Scan for Hardware Changes` to force the USB controller hardware to reinitialize. – DJ Chateau Mar 18 '14 at 18:09
  • http://superuser.com/questions/338059/recovering-a-partially-formatted-usb-thumb-drive –  Nov 15 '14 at 17:41
  • Just found a SD cart tool to reformat to "factory": https://www.sdcard.org/downloads/formatter/ Diskpart etc. all didn't work for me while this worked like a charm! – Jory Hogeveen Jan 19 '20 at 02:47

10 Answers10

109

Run diskpart and perform these commands:

LIST DISK
SELECT DISK x
CLEAN 

(x being the number returned in the first command for the USB disk.)

Close diskpart.

Open Windows DiskAdministrator GUI.

You should now see the USB disk as an empty hard drive and be able to partition and format the USB disk as normal.

That Brazilian Guy
  • 6,834
  • 10
  • 64
  • 102
Tonny
  • 29,601
  • 7
  • 52
  • 84
  • This worked for me on Windows Server 2012R2. – Eris Aug 19 '14 at 18:06
  • Thanks, this worked a charm. Had to use LIST DISK instead of SHOW DISK on Windows 8.1 though. – Matt Dec 16 '14 at 22:16
  • @Matt It is LIST on all Windows versions. My mistake. Will edit answer. – Tonny Dec 18 '14 at 22:57
  • 9
    Want to confirm that this is worked in windows 10 too. Had to try few times, `CLEAN` command error with Access Denied at the first try. Thanks! – fudanchii Aug 03 '15 at 01:39
  • Gparted failed to help as did everything else I tried. Diskpart worked. Thanks. – johnny Aug 11 '16 at 21:35
  • 8
    `clean` did the trick! Awesome, I was almost throwing away the USB drive. – sunside Sep 20 '16 at 20:25
  • I get "The system cannot find the file specified" when I do CLEAN. This isn't a USB btw, it's the same error on an HDD. – Robinson Aug 19 '17 at 00:17
  • Still works like a charm on Win 10 in 2018! Thank you! ^^ – Alex Aug 21 '18 at 07:29
  • 7
    Doesn't work for me: `clean` says *"DiskPart has encountered an error: Access is denied."* even though I'm running diskpart as administrator. – BenMorel Sep 06 '19 at 11:13
  • 1
    @benjamin Windows can be a bit finicky at times. Keeping a lock on the disk while you are attempting to clean it. (Some virusscanners can cause this too.) You will have to try it a couple of times with a minute or 2 between attempts. See also the comment by fudanchii – Tonny Sep 06 '19 at 21:48
  • I was able to use my USB stick again after following these instructions: https://tabernusupport.freshdesk.com/support/solutions/articles/3000002552-using-diskpart-to-re-partition-a-usb-stick – Gilfoyle Oct 30 '19 at 14:24
  • @Samuel That is exactly the same procedure as in my answer. Only difference is that the partition/format step is done from within Diskpart in stead of the DiskAdmin Gui. The actual CLEAN command is the important bit and that is the same. – Tonny Oct 30 '19 at 16:13
  • @Tonny I followd exactly your instructions. However, using the Windows DiskAdministrator GUI did not work in my case. Mybe you can add these instructions to your answer and I can delete my comment. – Gilfoyle Oct 30 '19 at 17:27
  • @Samuel The GUI should work, but it is possible you'll need to unplug the USB stick and put it back in before the GUI realizes the stick has been modified by diskpart. (That is not specific to this. That is always an issue when using multiple programs doing low-level access on the same media in Windows.) – Tonny Oct 30 '19 at 19:10
  • Thanks! You save my USB <3 – walterhuang Nov 05 '21 at 05:20
27

I had this issue when the USB key had been formatted with a linux install iso previously. To fix it, I ran the linux fdisk utility, removed all partitions, and then ran:

dd if=/dev/zero of=/dev/XXX count=1 bs=4096

where XXX was sdb in my case.

This wiped the partition table completely, and on new insertion on windows, it was able to do a standard format. I clued in that it had something to do with the partition table, since windows disk manager showed the old partition layout after attempting to create a volume+format, despite the fact that I'd picked a different volume and file system size (i.e. attempting to create a 4G volume and filesystem restored the previous 2G partition in the disk manager display, despite starting from a non-partitioned state).

Peeter Joot
  • 411
  • 5
  • 9
  • 2
    Perfect! This one's going in my permanent reference file. – Tyr Jan 03 '17 at 08:47
  • 1
    I'm not sure I understand why that worked instead of being able to delete and create a partition in DISKPART or FDISK, but the SD card works in Windows now. – James Feb 03 '17 at 07:25
  • 8
    Yet another case of turning to Linux tools to fix issues in Windows, thanks buddy. – JazzCat May 15 '17 at 16:44
  • 1
    For me the problem occurred after creating a linux install usb stick with "Win32 Disk Imager" and the solution from this post worked for me. – Knitschi Dec 22 '18 at 13:34
  • I used the usb drive to flash a DeepinOS iso and install deepinOS in another machine. This solution was the only one that worked for me. Cheers! – Sergio Gonzalez Jul 27 '20 at 16:45
  • I have the OP's problem but I don't have a Linux computer handy. I'm lazy to do a liveboot to Linux just for this. I do have a MacBook on hand. Would this same command work unaltered on macOS? I know macOS uses 'dd' as well. – Daniel Nov 18 '21 at 03:22
  • @Daniel probably. you could give it a try. – Peeter Joot Nov 18 '21 at 13:08
  • 1
    Actually, a terminal command was not even necessary. MacOS's Disk Utility was able to easily reformat the problematic (in Windows) USB drive and restore it to working order without any issue. – Daniel Dec 01 '21 at 21:17
17

Just wanted to add another possible reason/solution for this error message. Problem: I had previously used this USB drive as a Chromebook recovery image holder and Win8 was giving me errors trying to format it. XP formatted it ok and showed a drive letter when the USB drive was inserted while Win8 did not.

Solution: I ended up using the Chromebook Recovery utility to erase the USB drive again (even though it had been formatted a few times in Windows) and Win8 was then happy with it again. https://support.google.com/chromebook/answer/6002417?hl=en

lastwraith
  • 210
  • 2
  • 2
  • 2
    Tried all the other crap, including extensive use of DISKPART and nothing worked. After clearing the drive using the Recovery utility it worked fine. I must have been using this to try and install chrome OS on an old laptop and it had rendered the USB drive worthless. – Brett Green Dec 25 '16 at 01:28
  • 2
    Amazing. The Chrome App fixed it immediately. – Antiga Feb 01 '17 at 03:16
  • 5
    Diskpart `clean` then `create partition 1` worked for me. – Motomotes Apr 10 '18 at 19:47
  • 2
    `clean` alone already did the job for me. – asynts Mar 06 '19 at 09:36
  • 2
    The Chromebook Recovery did the job. You're a fucking legend, my dude! – xwhitelight Apr 26 '20 at 14:10
  • My drive seemed _seriously_ mucked after I made a Linux bootable with [balenaEtcher](https://www.balena.io/etcher/)-- the other solutions did not work, but this did. So glad to finally have this disk back! Thanks! – Alexander Nied Mar 26 '21 at 05:29
4

I was unable to format a 32GB USB stick using tools from either Ubuntu, win8 disk manager or diskpart, after my son formatted it for a Linux Anaconda boot device. Fix was to use diskpart-list disk-select disk-delete partition override and finally CLEAN. This removed underlying attributes and I was able to create a new primary partition and format as NTFS again!

Rob Smith
  • 41
  • 1
4

I recommend using Mark Tomlin's answer at Recovering a Partially Formatted USB Thumb Drive. If that doesn't work, try then using diskpart to clean the disk again and convert to GPT. The conversion to GPT seems to restore the USB drive to a usable state, which convert to MBR does not always manage. You should now be able to create a primary partition and format it. I then had a little difficulty in converting back to MBR, but managed it OK as explained in my answer on the other post. I hope that this helps.

Alasdair K
  • 304
  • 2
  • 4
  • This is what fixed my thumb drive. For me I didn't need to format it back to MBR. I simply stayed with GPT + FAT32 (FWIW, FAT32 under GPT is called "Basic Data Partition", with the GUID EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 according to [this](https://en.wikipedia.org/wiki/Microsoft_basic_data_partition).) Indeed, as JazzCat commented, yet another case of turning to Linux tools to fix issues in Windows. – Boson Bear Sep 17 '22 at 22:55
1

I had this issue when I had a hard drive in a dock plugged into a SS USB Port. I changed to a standard USB port and worked like a charm. This was odd though because this only happened sometimes in the SS USB Port. But hope this helps!

Thanks.

Jayden
  • 11
  • 1
1

I had the same issue (CLEAN command => error with Access Denied), and luckily my usb key was USB-C.

I simply connected it to my Android phone and clicked on Format.

Then it was immediately fixed, even in Windows 10 :)

Pleymor
  • 121
  • 2
1

UNetbootin can create a bootable Live USB drive, or it can make a "frugal install" on your local hard disk if you don't have a USB drive. It loads distributions either by downloading a ISO (CD image) files for you, or by using an ISO file you've already downloaded.

Try using UNetbootin to format and create a live linux on your thumb drive directly. If this does not work, I would use UNetbootin to create a PartedMagic live cd/dvd/usb (device other than the one you are having troubles with) and boot to it and try to access the problem usb device and wipe it clean with Parted Magic.

Logman
  • 3,640
  • 1
  • 19
  • 30
0

None of the answers solved the issue here today in 2023 so I ended up using SD Memory Card Formatter for Windows/Mac from sdcard.org Association to format and fix the USB drive. Hope this helps.

Henrique de Sousa
  • 983
  • 11
  • 17
-2

What works for me is trying different slots until it recognizes it and then trying the diskpart method. But if it doesn't work I use EaseUS Partition Master and then it does. This can often happen after making a boot disk with TransMac.

  • This doesn't really answer the question of *how* to solve the issue using the tools suggested and is a bit of a low quality software recommendation. You should describe, if possible, why he problem occurs and preferably how to use the tool suggested in order to clear the problem. – Mokubai Feb 12 '18 at 11:07