Problem using Win32DiskImager to write to SD Card – Error 5, Lock problem | Odd Blog

Hopefully a good enough read

Problem using Win32DiskImager to write to SD Card – Error 5, Lock problem

Same day that my Pi arrived, I tried to write the Debian squeeze image to an 8GB Sandisk Micro SD. Actually I tried it with a 2GB unbranded and found the same problem.

The problem was that when clicking the ‘Write’ button in Win32DiskImager, it would say it could not lock the disk, the disk being the SD Card. Nothing I knew of  had accessed the card since I had inserted it into the reader.

Looking around I saw a comment that said delete all partitions on the card. The only partition of course was a FAT32 one which was standard for this kind of disk. I used windows 7 diskpart as follows to delete the partition:

  • Open a command prompt.
  • Type ‘diskpart’ and the ‘Diskpart>’ prompt will be displayed.
  • Against the Diskpart> prompt, type ‘list disk’.
  • A list of disks will appear, for example:DISKPART> list disk

    Disk ###  Status         Size     Free     Dyn  Gpt
    ——–  ————-  ——-  ——-  —  —
    Disk 0    Online          465 GB      0 B
    Disk 1    Online         7580 MB  5723 MB


  • Here you can see that my SD card is Disk  1 just by inspecting the sizes.
  • With diskpart, before you can work on a disk or a partition, you must set the focus. So to select Disk 1 in my example, type ‘select disk 1’.
  • Next check the partitions on the disk you have selected by entering ‘list partition’.
  • In my example there was just the one FAT 32 partition called ‘partition 1’.
  • Before deleting, you need to set the focus to the partition, so in my example I entered ‘select partition 1’.
  • To delete the partition, enter ‘delete partition’.
  • In my case, it still would not let me do this, saying the disk was locked. So we can use the ‘override’ parameter with delete by entering:
  • delete partition override

We now have an SD card with no partiton defined! The next step was to exit diskpart by entering ‘exit’ and then try writing the disk image again.


I hope this helps someone else, please leave a comment! Someone has to be my first non-family-member commenter!!


  • Sorry only just seen your comment – many thanks for that. I’m glad the post helped. What have you been doing with your Pi? Cheers, Chris.

  • This was right on the money, solved the problem for me too. Now to get to grips with Raspian…the official version!

  • Thanks for the comments. I took a different approach and just formatted SD card (same brand… SanDisk). It worked after using FAT32, 32 kilobytes and a quick format.

  • I was having the problem, followed your advice using diskpart, and still had the problem. Then I restarted with the flash reader unplugged, disabled antivirus, shut down all other programs, installed the reader and flash card, ran win32 disk imager as admin, and was successful. I’m sure not all of those were necessary, but one of them did the trick. Thanks for the write up.

  • if you would just right click and run as Admin it will work more than most of the time. js.

  • Did not work for me. I get the message “can not delete volumes on removable media”.
    any other advice?

  • HI, One of the contributors below (Zed) mentioned right clicking and running as administrator. So if you right click the Command Prompt icon in Programs and choose Run as Administrator then carry on as before. I have had to resort to that before in other situations, but must admit I didn’t think of when I had this problem!

    If it sorts it, would appreciate it if you could report it back here to add to the info. Cheers, Chris.

  • I also had the same problem. Running as administrator did the trick. Simply right-click and select Run as administrator!

  • Thanks for this very useful post, I came across the exact same problem and didn’t know how to fix it, cheers! 🙂

  • Thank you. I had the lock issue too, and your advice cleared it. No to see if the debian version works even though the checksums do not match the online manual! Andrew

  • With your valuable suggestions in a few minutes all went well.

    Thank you!

    Roberto from Italy

  • I have try it but it writes when i wanted to delete: “can not delete volumes on removable media” I have run it as Admin but it doesn’t work.
    Can some one help me? 🙂

  • I tried what zed said, and what you said, but the override command won’t work. any more ideas?

  • Excellent, it worked!
    Now I can get on with my life 🙂
    ps – where can I get the the kind of captcha you have here?

  • This worked for me.
    For the past few days, my Windows system kept giving me the Error 5 after years of writing images with no problems using Win32DiskImager.

    I do not know what changed on my system that causes this routine process to fail for no reason, but your solution worked. Thank you very much!!

  • Thanks very much!! It had me scratching my head for an hour or so; and the internet searches were not turning up much- until I hit on your post.

    Thanks again.

  • Perfect… worked immediately! I wish all of this start up information was gathered in one place.. one of these days I might get around to it… or become a consultant 🙂

  • You made my day 🙂
    At first nothing mentioned here did work for me.
    But ….
    The essential tip was that there should be NO prtition on the SD-Card.
    So I ran “EaseUS Partition Master 9.3.0” which was already installed on my computer and I was able to delete the partition. (Be carefull to choose the right drive!).

  • Had this issue with a 64Gig Sandisk SD card. Your solution worked fine. Good job!

  • Hey, many thanks – that solved my problem! had issue with ScanDisk 16 Gb, worked like a charm. Was loosing my nerves with this card 🙂

  • Thanks; got the extra partition on my Statux card deleted so I could reimage.

  • Hey, really really thanks a lot of taking the time to post this. saved me a headache!

  • Hi, looks like this has helped out a lot of users over the past six years and it worked for me today.


  • Hi,
    I was facing the same issue. I did the following to solve it.

    1. Run the diskimager in XP compatible mode.
    2. Format the SD Card as FAT32 and default allocation size WITHOUT CHOOSING QUICK FORMAT.

    and that was it. worked for me nicely.

    Thank you all for your inputs.

1 2

Post a Comment

Your email address will not be published. Required fields are marked *

  • Categories