Flash drives changed to Read Only

Moderator: Forum moderators

Feek
Posts: 394
Joined: Sun Oct 18, 2020 8:48 am
Location: cze
Has thanked: 44 times
Been thanked: 86 times

Re: Flash drives changed to Read Only

Post by Feek »

For perhaps the last 6 months I have been using balenaEtcher. However, at least 50% of the time it crashes just as it begins to write and has to be reconfigured and started over. PITA sometimes.

Better not to use Balena Etcher with Puppy.

Once you have "running puppy" (doesn't matter that it's read-only) you have the possibility to use Puppy specific installation tools and do the proper frugal install to another stick (e.g. Frugalpup, grub4dos config, ...).
Enough information in "how-to" section.

williwaw
Posts: 1594
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 145 times
Been thanked: 291 times

Re: Flash drives changed to Read Only

Post by williwaw »

G0rdie wrote: Wed Jan 05, 2022 3:29 pm

For perhaps the last 6 months I have been using balenaEtcher. However, at least 50% of the time it crashes just as it begins to write and has to be reconfigured and started over. PITA sometimes.....
To write an image (iso) on a USB (Don't need a light):

Code: Select all

dd if=bionicpup32-8.0-uefi.iso of=/dev/sdX status=progress

It is my understanding that Balena currently uses dd or similar, but maybe didn't always.

Doesn't dd (or balena for that matter) need a hybrid iso or other image file that already includes a partition table?
Otherwise, you would just be creating an iso(9660) on the USB drive?

still curious what gparted reports when first trying to create a new partition table on one of the now "read-only" drives.

G0rdie
Posts: 14
Joined: Tue Dec 28, 2021 3:50 am
Location: Nolalu, Ontario, Canada
Has thanked: 5 times
Been thanked: 3 times

Re: Flash drives changed to Read Only

Post by G0rdie »

Using the command line to restore a USB stick to original condition as long as it was not Read Only:
RUN THESE COMMANDS AS ROOT USER.

Code: Select all

Restoring your USB key to its original state using Linux if it now has more than one partition:

A. First check to see if your computer detects the USB drive and tries to mount it.

B. Next we need to delete any old partitions that may remain on the USB key.
Type fdisk -l and note your USB drive letter.
Type fdisk /dev/sdx (replacing x with your drive letter)
Type d to proceed to delete a partition
Type 1 to select the 1st partition and press enter
Type d to proceed to delete another partition (fdisk should automatically select the second partition)

C. Next we need to create the new partition.
Type n to make a new partition
Type p to make this partition primary and press enter
Type 1 to make this the first partition and then press enter
Press enter to accept the default first cylinder
Press enter again to accept the default last cylinder
Type w to write the new partition information to the USB key
Type umount /dev/sdx (replacing x with your drive letter)

D. Next step is to create the fat filesystem.
Type mkfs.vfat -F 32 /dev/sdx1 (replacing x with your USB key drive letter)

E. Lastly, make the USB drive bootable (only really matters to Windows)
Type parted /dev/sdb set 1 boot on

That's it, you should now have a bootable, restored USB key with a single fat 32 partition that can be read from any computer.
G0rdie
Posts: 14
Joined: Tue Dec 28, 2021 3:50 am
Location: Nolalu, Ontario, Canada
Has thanked: 5 times
Been thanked: 3 times

Re: Flash drives changed to Read Only

Post by G0rdie »

LateAdopter wrote: Mon Jan 03, 2022 10:55 am

Another point...

When you get a new USB stick or SD card, it comes with a partition already on it. There is an unpartitioned space of 4, 8, 16 or 32 MB at the start of the device.

I think you should assume that it is unsafe to include this space within a working partition that is written frequently.

I have created small bootloader/EFI partitions within this space without having any problems, but they are only written infrequently.

Flash devices have multiple slices, but I have not found an explanation of how the slices are addressed. I speculate that the original partition starts at the first available alignment point, taking erase blocks and slices into account. I think USB sticks do not align on a megabyte as a consequence of the hidden LBA translation table.

After the iso is written to the stick it has no partition or partition table. Actually you can write the iso to a stick that is not partitioned, has no partitions and has not been formatted. i got curious, tried it and found that it works

G0rdie
Posts: 14
Joined: Tue Dec 28, 2021 3:50 am
Location: Nolalu, Ontario, Canada
Has thanked: 5 times
Been thanked: 3 times

Re: Flash drives changed to Read Only

Post by G0rdie »

williwaw wrote: Wed Jan 05, 2022 9:04 pm

still curious what gparted reports when first trying to create a new partition table on one of the now "read-only" drives.

I still have been unable to get a USB stick to go Read Only. Maybe you can then you can tell us all. My memory isn't quite that good. One thing came back to me though. An error message telling about an input / output error. Next time I see that I'll get my hammer :lol:

G0rdie
Posts: 14
Joined: Tue Dec 28, 2021 3:50 am
Location: Nolalu, Ontario, Canada
Has thanked: 5 times
Been thanked: 3 times

Re: Flash drives changed to Read Only

Post by G0rdie »

I now have one USB stick not responding to my commands. It is not reporting a Write Protected / Read Only condition YET but it only shows about 4 Gig out of a 32 Gig stick.
Won't respond to gparted, gnome disks or to the command line.

After countless attempts the stick now shows 8 Gig as the total capacity for this 32 Gig stick
Partition table = MSDOS
Format = FAT32

Last edited by G0rdie on Sat Jan 08, 2022 4:30 pm, edited 1 time in total.
User avatar
bigpup
Moderator
Posts: 6268
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 732 times
Been thanked: 1292 times

Re: Flash drives changed to Read Only

Post by bigpup »

Tried plugging it into a different USB port?

To be clearly understood.

You cannot run this command on it?

(The code of=/dev/sdb. (sdb is the flash drive, yours could be sdc, sdd, etc.... adjust to match yours)

Code: Select all

dd if=/dev/zero of=/dev/sdb bs=1M count=1

If no.
What exactly happens when you try?

What operating system are you trying to do this in?

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

G0rdie
Posts: 14
Joined: Tue Dec 28, 2021 3:50 am
Location: Nolalu, Ontario, Canada
Has thanked: 5 times
Been thanked: 3 times

Re: Flash drives changed to Read Only

Post by G0rdie »

bigpup wrote: Sat Jan 08, 2022 2:37 pm

Tried plugging it into a different USB port?

To be clearly understood.

You cannot run this command on it?

(The code of=/dev/sdb. (sdb is the flash drive, yours could be sdc, sdd, etc.... adjust to match yours)

Code: Select all

dd if=/dev/zero of=/dev/sdb bs=1M count=1

If no.
What exactly happens when you try?

What operating system are you trying to do this in?

Port #1:
bash-5.1$ dd if=/dev/zero of=/dev/sdb bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0928783 s, 11.3 MB/s
bash-5.1$

Port #2:
bash-5.1$ dd if=/dev/zero of=/dev/sdb bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.000891705 s, 1.2 GB/s
bash-5.1$

Port #3:
bash-5.1$ dd if=/dev/zero of=/dev/sdb bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0944701 s, 11.1 MB/s
bash-5.1$

OS = Slackware64-current

williwaw
Posts: 1594
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 145 times
Been thanked: 291 times

Re: Flash drives changed to Read Only

Post by williwaw »

bigpup wrote: Sat Jan 08, 2022 2:37 pm

Tried plugging it into a different USB port?

To be clearly understood.

You cannot run this command on it?

(The code of=/dev/sdb. (sdb is the flash drive, yours could be sdc, sdd, etc.... adjust to match yours)

Code: Select all

dd if=/dev/zero of=/dev/sdb bs=1M count=1

If no.
What exactly happens when you try?

What operating system are you trying to do this in?

seems like dd worked on the first block. what if there is a remnant gpt partitioning table at the end of the device that might be problematic?

User avatar
bigpup
Moderator
Posts: 6268
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 732 times
Been thanked: 1292 times

Re: Flash drives changed to Read Only

Post by bigpup »

Code: Select all

bash-5.1$ dd if=/dev/zero of=/dev/sdb bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0928783 s, 11.3 MB/s
bash-5.1$

That looks like what the command should do.

Now try using Gparted on the drive, to make a new partition table (msdos), make a partition, and format the partition.
Do you know how to do that using Gparted?

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

G0rdie
Posts: 14
Joined: Tue Dec 28, 2021 3:50 am
Location: Nolalu, Ontario, Canada
Has thanked: 5 times
Been thanked: 3 times

Re: Flash drives changed to Read Only

Post by G0rdie »

bigpup wrote: Sun Jan 09, 2022 12:14 am

Code: Select all

bash-5.1$ dd if=/dev/zero of=/dev/sdb bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0928783 s, 11.3 MB/s
bash-5.1$

That looks like what the command should do.

Now try using Gparted on the drive, to make a new partition table (msdos), make a partition, and format the partition.
Do you know how to do that using Gparted?

Yes, I do know how and by the time I got to read your reply I had restored the stick back to factory condition and wrote a live Linux system on it and verified that it works.
Now, that was not Write Protected / Read Only but was not responding although something in your command shocked it into acting "normal" again. I will have to keep plugging away until I have one defy ROOT to write anything on it. The problem is that there is no way for me to predict when that will happen or for me to MAKE it happen on purpose.

Thank you bigpup for your help so far and for your patience as well. :thumbup2:

User avatar
bigpup
Moderator
Posts: 6268
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 732 times
Been thanked: 1292 times

Re: Flash drives changed to Read Only

Post by bigpup »

Are we having fun, Yet!

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

Post Reply

Return to “Repair”