Cannot Flash BalenaOS image On SD

Hi,
I am exploring BalenaOS for the first time and flashed the BalenaOS 2.51.1 rev1 using a Raspberry 3.
I wanted to change/install a new device using the same SD card. I have downloaded the new image and wanted to flash using BalenaEtcher but with no success with the following error: PhysicalDrive1:EPERM : operation not permitted, write.

I have tried to format the SD card using Linux and Win 10 tools/commands but no luck.

Any recommendations or suggestions would be very appreciated.

Thanks

Hello Kamal,
I want to make sure I understand your question clearly.

  • Have you created a new application on your balena Cloud dashboard?
  • Have you added Raspberry Pi 3 as a new device and downloaded BalenaOS 2.51.1 rev1 image?
  • Have you used Etcher to flash the image on your SD card?
  • Have you flashed the image successfully on your SD card?
  • Have you managed to bring it up and boot successfully?
  • Are you trying to use the same application with the same image but on another device (not Raspberry Pi 3)?

Hi Mahmoud,

Yes, I have created an application on Balena Cloud and added a RPi as a new device by using the Etcher to flash the image. Everything worked fine. I was seeing the device online and was able to communicate with the device successfully.

I wanted to use the same SD card and burn a new image with Etcher (tried with Rufus as well) but with no success. SD card still works fine when I plug it back into the RPi. I cannot format this SD anymore. Is there anything on the BalenaOS that locks the SD and makes read-only and not be able to be formatted.

Thanks for your support.

Hi @kyakouty – thanks for the additional detail. I can confirm that nothing in balenaOS or Etcher locks the SD card, makes it read-only, or prevents it from being formatted.

Depending on the size of your SD card, I wonder if the write-protection switch (that is, a physical switch on the SD card) has been set. Can you have a look at https://kb.sandisk.com/app/answers/detail/a_id/1102/~/sd%2Fsdhc%2Fsdxc-memory-card-is-write-protected-or-locked and double-check this?

All the best,
Hugh

Thanks for the quick reply.
I am using a Sony Class 10 16GB 70MB/s. And yes, the physical lock/write-protection switch is not activated.

Hi @kyakouty – thanks for checking. Just to be double-sure, could you try turning on that lock/write-protection switch, then turning it off again? Sometimes the switch can behave badly. If that still doesn’t fix the problem, let us know and we’ll continue from there.

All the best,
Hugh

Hi Hugh,
As you have instructed, I have turned the switch on and off but with no success. I have also inserted the SD card in USB reader and same result.
Thanks

Hi there, are you able to open the SD card device (disk) with Windows diskpart.exe by any chance? If so, are you able to re-initialise it from there (i.e. delete the partitions)?

Yes I have tried the diskpart.exe and could not delete the partition with the command. I receive an Access Denied error message. I have also tried with GParted on Linux and no luck either.
Thanks

Hi Kamal, just to add one other additional bit of info here, I have experienced this same behavior several times in the past, and in each case it ended up being that the SD Card has a built-in mechanism for gracefully handling it’s death. Several times I have noticed, that a card will flip an internal flag that cannot be cleared no matter what, if it detects bad blocks or corruption. Some posts seem to indicate it’s a protection measure to allow to continue accessing the data, which is nice in a way, but also creates confusion when you get into a situation such as this. So, while I can’t say for certain, it is actually possible your card has died, but is still in a “semi-functional” state allowing your to read data from it, but not write to it. Coming full circle, neither Etcher or balenaOS do anything that prevents re-writing an SD Card however. In fact, I do this several times per day while testing. :slight_smile: