How do you reset a USB flash drive back to factory settings?

Page 3 of 4 FirstFirst 1234 LastLast

  1. Posts : 985
    Windows 10 Home 21H1
    Thread Starter
       #21

    lx07 said:
    You are quite right of course. If you wanted it exactly the same you'd have to restore it but who would back up an empty USB drive?

    In fact the second partition type (0xC) in your example is correct for USB stick. The first one (0xB) is for CHS (old style HDD). MS got it right and Lexar got it wrong if you want to be pedantic about it (and if you trust Wikipedia). Mind you I manually assign partition types a lot (I have to use hybrid GPT/MBR partition scheme) and always give the 0x7 irrespective if they are FAT or NTFS and that works too so it probably doesn't matter.

    Delete its record from the registry.

    First assign it some letter like Z so you know what it is. Doesn't matter how - through Disk Management or diskpart assign letter=z - the result is the same.

    Then unplug it. Then go to regedit and delete HKLM\SYSTEM\MountedDevices value \DosDevices\Z:

    Next time you plug it in it will assign E or whatever is the first unallocated letter.

    It is nothing to do with the USB - only your Windows install.

    Attachment 173920
    To be honest I don't want to mess around with the registry. I think I must be be misinterpreting what the Assign command does? So is it better to not type the Assign command into Diskpart at all. I'm just trying to make sure the flash drive gets assigned a drive letter in exactly the same way as it would do if it was a brand new flash drive being plugged into my laptop. Like I said at the beginning when I first posted I just want the flash drive to be set up and behaving in exactly the same way as when I first purchased it. I thought that if you typed in the assign command (without a letter) it ensured that the flash drives letter would be assigned dynamically from then on i.e if the drive letter previously had a fixed drive letter the Assign command would remove that fixed letter and set it to dynamic. I'm worried that if the drive letter gets fixed by the Assign command that there may be conflicts when other flash drives are plugged in. That's why I don't want to have a fixed drive letter on any of my flash drives..thats why I keep mentioning that I would like dynamic drive letter assignment. Am I getting crossed wires and misunderstanding the way flash drive letter assignment works in Windows?
      My Computer


  2. Posts : 5,478
    2004
       #22

    sportsfan148 said:
    To be honest I don't want to mess around with the registry. So is it better to not type the Assign command into Diskpart. I'm just trying to make sure the flash drive gets assigned a drive letter in exactly the same way as it would do if it was a brand new flash drive. Like I said at the beginning when I first posted I just want the drive set up and behaving in exactly the same way as when I first purchased it. I thought that if you typed in the assign command (without a letter) it ensured that the flash drives letter would be assigned dynamically from then on i.e if the drive letter previously had a fixed drive letter the Assign command would remove that fixed letter and set it to dynamic
    No - assign assigns a letter and stores it in the registry key above (not on the USB). It does the same as doing it in Disk Management except you can assign mount points (letters) to otherwise unavailable partitions.

    You could try remove instead of assign. You may find remove just stores it without a mount point and assigns no letter when you plug it in the next time though (which would mean until you assigned a letter you would not see it in File Explorer).

    If you don't want to delete the registry key then you'd have to change the serial number (which it matches to the binary value in the registry). I've no idea how to do that - whether it is randomly generated when you format or fixed for the device I just don't know and don't have a blank USB to test it.
      My Computer


  3. Posts : 985
    Windows 10 Home 21H1
    Thread Starter
       #23

    lx07 said:
    You could try remove instead of assign as assign will just assign another letter. You may find remove just stores it without a mount point and assigns no letter when you plug it in though so until you assigned a letter you would not see it in File Explorer.

    Other than that you'd have to change the serial number (which it matches to the binary value in the registry). I've no idea how to do that - whether it is randomly generated when you format or fixed for the device I just don't know.
    Remove doesn't sound right then. What happens if two flash drives are plugged in at the same time then that the Diskpart Assign command had given the same letter to?
      My Computer


  4. Posts : 5,478
    2004
       #24

    sportsfan148 said:
    Remove doesn't sound right then. What happens if two flash drives are plugged in at the same time then that the Diskpart Assign command had given the same letter to?
    If you assigned separately 2 USB sticks the letter S you mean?

    Normally you will not see the second one you plug in in File Explorer and you'll have to manually assign a different letter to it.

    Again though this is a function of your Windows install not the USB stick(s). If you tried another PC or reinstalled Windows neither would be assigned S.
      My Computer


  5. Posts : 985
    Windows 10 Home 21H1
    Thread Starter
       #25

    lx07 said:
    If you assigned separately 2 USB sticks the letter S you mean?

    Normally you will not see the second one you plug in in File Explorer and you'll have to manually assign a different letter to it.

    Again though this is a function of your Windows install not the USB stick(s). If you tried another PC or reinstalled Windows neither would be assigned S.
    Yeah..its as I thought then. I'm just trying to avoid conflicts. If I'm understanding you correctly..Is a flash drive assigned a drive letter the first time its inserted into a PC and that letter will stick with that flash drive permanently? In my case then if I'm inserting each of my several flash drives separately (my next available drive letter is always E: after my c: system drive and D: DVDRW drive). Does each of them when inserted individually get drive E: or is the first one assigned E: (stored in the registry)and even after you've removed it ...each one when plugged in separately after that has an individual letter further down the alphabet? Is it the Assign command that causes this? I'm sure ive inserted USB flash drives before that had a drive letter E: one day and was then recognised as F: on another occasion
      My Computer


  6. Posts : 1,471
    Win10 Home x64 - 1809
       #26

    Hey sportsfan148,
    Just an FYI ... DriveCleanup is a command line utility for seeing/cleaning up non present drives from the device tree/registry. Be sure to read the DriveCleanup.txt for info/command line switches

    DriveCleanup v1.5 - Drive Tools for Windows
      My Computers


  7. Posts : 11,618
    Windows11 Home 64bit v:23H2 b:22631.3374
       #27

    Why commandline utility? Make life simple. Put Drive Cleanup into a folder and use it periodically to remove all non-present devices.

    Download v 0.8.1 of the drivecleanup.zip from Drive Tools for Windows. ( You can use the latest version v 1.5.0. I started using it from v 0.8.1 and still sticking to it)

    Unzip it to a folder, say drivecleanup.

    You will have two folders Win32 and x64 each containing DriveCleanup.exe for 32 bit and 64 bit respectively.

    Remove all USB storage devices from your system (except your USB Keyboard and mouse - if you have) and reboot.

    Right click on the DriveCleanup.exe and run as administrator. (Use theDriveCleanup.exe file appropriate for your bit version of Windows.).

    After the clean up act, reboot.

    ( When you plug in your USB devices after this cleanup these will be installed afresh. What you have done is to remove all non-present devices and drive letters associated with them and start with a clean slate. )

    Ed Tittel says http://itknowledgeexchange.techtarge...rage-metadata/
    Last edited by jumanji; 25 Jan 2018 at 15:13.
      My Computer


  8. Posts : 985
    Windows 10 Home 21H1
    Thread Starter
       #28

    lx07 said:
    Sure they can.

    "Clean" destroys the partition table. There is also "Clean all" which zeros the disk. If you are formatting after without "quick" option it doesn't matter but...

    GPT has a second (backup) partition table at the end of the disk and I'm not sure if clean deletes that. If you just "clean", "convert mbr" and then format with "quick" the first partition table will be will be overwritten certainly. If you omitted the "quick" the second backup partition table would also be overwritten and could not be retrieved. If you did a "quick" format as mbr knows nothing about the second backup gpt structure it could in theory be retrieved.

    You can't use disk management to do this - you must use diskpart (or third party tool but there is no point really).
    Hi lx07.
    Ive just run into a problem while using Diskpart this weekend to reset a flash drive back to factory. All commands were successful except "Active". It produced an error message "Diskpart has encountered an error. The system cannot find the file specified. See the system event log for more information". At the time of the error there are no errors shown in the system event log. All the other commands were successful.
    You mention above that GPT has a second backup partition table at the end of the disk that has to be deleted.
    Would it be possible to use Diskpart to Clean and Convert MBR only on the USB flash drive and then Close down Diskpart. Then finish the process off using Disk Management to create the New Simple Volume and Full format. Is a Disk Management Full Format exactly the same as a Diskpart Full Format? The reason I'm asking is you said.... "You can't use disk management to do this - you must use diskpart (or third party tool but there is no point really).
      My Computer


  9. Posts : 5,478
    2004
       #29

    See your PM. Use diskpart:

    select disk 99 (or whatever)
    clean
    convert mbr
    create partition primary
    format fs=fat32 quick label="HELLO" (optional)
    active
    exit

    clean is the important bit (apart from selecting the correct disk obviously)
      My Computer


  10. Posts : 985
    Windows 10 Home 21H1
    Thread Starter
       #30

    lx07 said:
    See your PM. Use diskpart:

    select disk 99 (or whatever)
    clean
    convert mbr
    create partition primary
    format fs=fat32 quick label="HELLO" (optional)
    active
    exit

    clean is the important bit (apart from selecting the correct disk obviously)
    Hi lx07. What about the error message after the Active command? I'm uneasy about that.

    You mention above that GPT has a second backup partition table at the end of the disk that has to be deleted.
    As an alternative method..Would it be possible to use Diskpart to just Clean and Convert MBR on the USB flash drive and then Close down Diskpart. Then finish the process off using Disk Management to create the New Simple Volume and perform the Full format. Is a Disk Management Full Format exactly the same as a Diskpart Full Format? The reason I'm asking is you said.... "You can't use disk management to do this - you must use diskpart (or third party tool but there is no point really).
    The flash drive has been used with Rufus in the past so it had a GPT partition table..you mentioned in your post that a full format not a quick format had to be used in order to be able to completely remove a second backup GPT partition table
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:57.
Find Us




Windows 10 Forums