Web lists-archives.com

Re: Debian Live USB fails; bricks the USB stick




Hi,

Kent West wrote:
> The Yosemite Mac's Disk Utility gives me more info
> "This disk is not writable and can't be partitioned"
> that the Write Status is Read Only,

It really looks like this info comes from the stick's firmware and is
not fabricated by a software layer of the operating system.


I looked for the possible reason of EROFS in Linux driver sd.c.
Function sd_read_write_protect_flag() does its best to get a Mode Parameter
Header that preceeds any SCSI mode page reply. Then it interprets the
"Device-Specific Parameter" byte in that 4-byte header.
Standard SBC-2 says in section 6.1.3 that if bit 7 of this byte is set
then the medium is write protected.
I see this test in line 2638 of
  https://github.com/torvalds/linux/blob/master/drivers/scsi/sd.c
as
  sdkp->write_prot = ((data.device_specific & 0x80) != 0);

So like with the "No medium" error, it looks like an ill drive.

(I always thought that optical drives are a bit bitchy. But disk devices
 have their own ways to surprise the programmer. I better stay with
 the opticals and in userspace. :))


> It's just really odd that two differently-manufactured/aged sticks went bad
> at the same time, when trying to do the same operation with them,

My best explanation is that copying the 2 GB was more work than they had
to do in the years before.
Others are that misery loves company and misfortune seldom comes alone.

Already yesterday i dd'ed the ISO onto a 4 GB SanDisk Cruzer stick
in order to look for problems with mounted partitions. (None found.)
The stick is still alive and writable.

So debian-live-9.2.0-amd64-cinnamon.iso is not poisonous to all sticks.

I can hardly imagine how the computer should be to blame. It could
possibly fry the stick's controller. But talking it into losing its
medium or making it read-only ?


> Looks like I'll be tossing these sticks.

If you buy a new one, then make a backup before putting the ISO on it:

  dd if=/dev/sdc bs=1M | gzip >new_stick_backup.gz

A virgin stick should yield quite a small .gz file.


Have a nice day :)

Thomas