Solved USB flash died?

I have a problem with a flash drive, which I haven't used for a couple of months, and forget why, and what is on it.

Standard % sudo mount /dev/da0[s1] /mnt/ won't help.
Code:
% sudo fdisk /dev/da0

******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=489 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=489 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 23 (0x17),(OS/2 BM: hidden IFS (e.g. HPFS))
    start 64, size 5836768 (2849 Meg), flag 80 (active)
    beg: cyl 0/ head 2/ sector 1;
    end: cyl 1018/ head 178/ sector 32
The data for partition 2 is:
sysid 1 (0x01),(Primary DOS with 12 bit FAT)
    start 5836832, size 126784 (61 Meg), flag 0
    beg: cyl 1019/ head 0/ sector 1;
    end: cyl 1023/ head 178/ sector 32
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

% sudo fdisk /dev/da0s1
******* Working on device /dev/da0s1 *******
parameters extracted from in-core disklabel are:
cylinders=363 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=363 heads=255 sectors/track=63 (16065 blks/cyl)

fdisk: invalid fdisk partition table found
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 5831532 (2847 Meg), flag 80 (active)
    beg: cyl 0/ head 1/ sector 1;
    end: cyl 362/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>


% sudo fdisk /dev/da0s2
******* Working on device /dev/da0s2 *******
parameters extracted from in-core disklabel are:
cylinders=7 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=7 heads=255 sectors/track=63 (16065 blks/cyl)

fdisk: invalid fdisk partition table found
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 112392 (54 Meg), flag 80 (active)
    beg: cyl 0/ head 1/ sector 1;
    end: cyl 6/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

Code:
% gpart show da0
=>     63  7866305  da0  MBR  (3.8G)
       63        1       - free -  (512B)
       64  5836768    1  !23  [active]  (2.8G)
  5836832   126784    2  !1  (62M)
  5963616  1902752       - free -  (929M)
Code:
% gpart list da0
Geom name: da0
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 7866367
first: 63
entries: 4
scheme: MBR
Providers:
1. Name: da0s1
   Mediasize: 2988425216 (2.8G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 32768
   Mode: r0w0e0
   attrib: active
   rawtype: 23
   length: 2988425216
   offset: 32768
   type: !23
   index: 1
   end: 5836831
   start: 64
2. Name: da0s2
   Mediasize: 64913408 (62M)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 2988457984
   Mode: r0w0e0
   rawtype: 1
   length: 64913408
   offset: 2988457984
   type: !1
   index: 2
   end: 5963615
   start: 5836832
Consumers:
1. Name: da0
   Mediasize: 4027580416 (3.8G)
   Sectorsize: 512
   Mode: r0w0e0

And I can't do anything:
Code:
% sudo fsck /dev/da0
fsck: Could not determine filesystem type
Code:
% sudo dd if=/dev/zero of=/dev/da0
dd: /dev/da0: Permission denied
1+0 records in
0+0 records out
0 bytes transferred in 0.011140 secs (0 bytes/sec)

Don't know what to do. I bought this only year ago. Don't think that it's reached its limit of rewriting data.

Any suggestions?

Thanks.
 
You can always look what’s on a device by doing hd /dev/da0 | more or hd /dev/da0s1 | more. If you do not care anymore what’s on the stick do gpart destroy -F da0.
 
The partition types look pretty weird. Try to identify the filesystems on them with file(1):
Code:
# file -s /dev/da0s1
# file -s /dev/da0s2
 
getopt
Each time telling me that operation not permitted. Even when
Code:
# gpart destroy -F /dev/da0
gpart: Operation not permitted

% sudo gpart create -s GPT /dev/da0
gpart: Operation not permitted

wblock@, sorry don't know why, forgot to post output of file -s

Code:
% sudo file -s /dev/da0
Password:
/dev/da0: DOS/MBR boot sector

As soon as I already tried to gpart destroy => (it was, but now I've got no /dev/da0s1)
Code:
# file -s /dev/da0s1
dev/da0s1: 8086 relocatable (microsoft)

Code:
# gpart list da0
Geom name: da0
modified: true
state: OK
fwheads: 0
fwsectors: 0
last: 7866367
first: 0
entries: 0
scheme: (none)
Consumers:
1. Name: da0
   Mediasize: 4027580416 (3.8G)
   Sectorsize: 512
   Mode: r0w0e0
 
It might be auto-mounted with some desktop UI. If so, do not boot into a desktop, do not use sudo. As root, use gpart destroy -F da0 and call it good.

You don't mention which memory stick this is. A few years ago, there was that terrible U3 thing from Sandisk that did weird things. It could be disabled with their Windows-only software.
 
It might be auto-mounted with some desktop UI. If so, do not boot into a desktop, do not use sudo. As root, use gpart destroy -F da0 and call it good.

You don't mention which memory stick this is. A few years ago, there was that terrible U3 thing from Sandisk that did weird things. It could be disabled with their Windows-only software.
I used # gpart destroy -F as root ( su - => '#' at the start of command).
Some strange "operation not permitted" while I'm root ...
P.S. another flash works great on same usbus (USB3 Transcend jf780)

Code:
% tail -10 /var/log/messages
Dec 10 20:46:12 dell15 kernel: ugen1.6: <Generic> at usbus1
Dec 10 20:46:12 dell15 kernel: umass0: <Generic Mass Storage, class 0/0, rev 2.00/1.04, addr 6> on usbus1
Dec 10 20:46:12 dell15 kernel: umass0:  SCSI over Bulk-Only; quirks = 0x4101
Dec 10 20:46:12 dell15 kernel: umass0:2:0:-1: Attached to scbus2
Dec 10 20:46:12 dell15 kernel: da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
Dec 10 20:46:12 dell15 kernel: da0: <Generic Flash Disk 8.07> Removable Direct Access SCSI-4 device
Dec 10 20:46:12 dell15 kernel: da0: Serial Number CC340132
Dec 10 20:46:12 dell15 kernel: da0: 40.000MB/s transfers
Dec 10 20:46:12 dell15 kernel: da0: 3841MB (7866368 512 byte sectors: 255H 63S/T 489C)
Dec 10 20:46:12 dell15 kernel: da0: quirks=0x2<NO_6_BYTE>

This happens if I try # gpart destroy -F da0 without Xorg started
Code:
(da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 00 00 00 00 00 00 00 01 00            
(da0:umass-sim0:0:0:0): CAM status: CCB request completed with an error          
(da0:umass-sim0:0:0:0): Retrying command                                                          
(da0:umass-sim0:0:0:0): WRITE(10). CDB: 2a 00 00 00 00 00 00 00 01 00            
(da0:umass-sim0:0:0:0): CAM status: SCSI Status Error                                          
(da0:umass-sim0:0:0:0): SCSI status: Check Condition
(da0:umass-sim0:0:0:0): SCSI sense: DATA PROTECT asc:27,0 (Write protected)  
(da0:umass-sim0:0:0:0): Error 13, Unretryable error
 
Try
Code:
# sysctl kern.geom.debugflags=16
# gpart destroy –F da0
As a last resort dd if=/dev/zero of=/dev/da0 bs=512 count=1.
 
Try
Code:
# sysctl kern.geom.debugflags=16
# gpart destroy –F da0

As a last resort
Code:
dd if=/dev/zero of=/dev/da0 bs=512 count=1
Still permission denied after gpart destroy -F da0
Already tried to fill with zeros at the beginning of post - nothing.

Thanks to everyone. I think I'm done with this flash. While going through all of your suggestions I got two kernel crashes. Enough for me :D
 
Back
Top