Como remover a proteção contra gravação (ou somente leitura) de um disco flash USB?

0

Meu amigo me deu seu disco flash USB de 4 GB porque ele não pode formatar ou remover ou copiar nada para ele. A unidade está vazia agora. Mas não consigo consertar o problema de proteção contra gravação.

O Windows não pode formatar o disco e mostra "o dispositivo está protegido contra gravação". Então resolvi resolver o problema do linux.

Eu não posso consertar o problema do Linux também. A unidade é montada automaticamente quando inserida, mas não consigo fazer nada com ela por causa da proteção contra gravação.

Saída de dmesg | tail no momento em que insiro o disco flash:

$ dmesg | tail
[ 2753.654864] usb-storage 1-1.4:1.0: USB Mass Storage device detected
[ 2753.655207] scsi host4: usb-storage 1-1.4:1.0
[ 2754.668623] scsi 4:0:0:0: Direct-Access     Generic  Flash Disk       8.00 PQ: 0 ANSI: 4
[ 2754.671050] sd 4:0:0:0: [sdd] 8192000 512-byte logical blocks: (4.19 GB/3.91 GiB)
[ 2754.672208] sd 4:0:0:0: [sdd] Write Protect is off
[ 2754.672214] sd 4:0:0:0: [sdd] Mode Sense: 23 00 00 00
[ 2754.673417] sd 4:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 2754.690210]  sdd: sdd1
[ 2754.694654] sd 4:0:0:0: [sdd] Attached SCSI removable disk
[ 2755.154487] FAT-fs (sdd1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

Em seguida, executei o gnome-disk-utility e tentei formatar o disco. 10-20 segundos depois, recebo

Error formatting volume
Error synchronizing after initial wipe: Timed out waiting for object (udisks-error-quark, 0)

A execução de dmesg | tail novamente gera:

$ dmesg | tail
[ 3157.475963] sd 4:0:0:0: [sdd] tag#0 CDB: opcode=0x2a 2a 00 00 00 08 00 00 00 08 00
[ 3157.475967] blk_update_request: critical target error, dev sdd, sector 2048
[ 3157.475977] Buffer I/O error on dev sdd1, logical block 0, lost async page write
[ 3157.477033] sd 4:0:0:0: [sdd] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=0x08
[ 3157.477039] sd 4:0:0:0: [sdd] tag#0 Sense Key : 0x7 [current] 
[ 3157.477044] sd 4:0:0:0: [sdd] tag#0 ASC=0x27 ASCQ=0x0 
[ 3157.477049] sd 4:0:0:0: [sdd] tag#0 CDB: opcode=0x2a 2a 00 00 00 08 00 00 00 08 00
[ 3157.477052] blk_update_request: critical target error, dev sdd, sector 2048
[ 3157.477058] Buffer I/O error on dev sdd1, logical block 0, lost async page write
[ 3157.549308] VFS: Dirty inode writeback failed for block device sdd1 (err=-5).

Tentei verificar a partição da unidade usando o GParted e consegui

GParted 0.27.0 --enable-libparted-dmraid --enable-online-resize

Libparted 3.2

Check and repair file system (fat32) on /dev/sdd1  00:00:00    ( ERROR )

calibrate /dev/sdd1  00:00:00    ( SUCCESS )

path: /dev/sdd1 (partition)
start: 2048
end: 8191999
size: 8189952 (3.91 GiB)
check file system on /dev/sdd1 for errors and (if possible) fix them  00:00:00    ( ERROR )

fsck.fat -a -w -v /dev/sdd1  00:00:00    ( ERROR )

fsck.fat 4.0 (2016-05-06)
open: Read-only file system
libparted messages    ( INFO )

Unable to open /dev/sdd read-write (Read-only file system). /dev/sdd has been opened read-only.
Unable to open /dev/sdd read-write (Read-only file system). /dev/sdd has been opened read-only.

Agora, demsg | tail mostra

[ 3363.006200] sd 4:0:0:0: [sdd] Write Protect is on
[ 3363.006208] sd 4:0:0:0: [sdd] Mode Sense: 23 00 80 00
[ 3363.008312]  sdd: sdd1

Eu tentei usar o GParted para reformatar a única partição da unidade como FAT32 (a Partição já é FAT32) e recebi um erro de Libparted:

Can't write to /dev/sdd, because it is opened read-only.

e depois

GParted 0.27.0 --enable-libparted-dmraid --enable-online-resize

Libparted 3.2

Format /dev/sdd1 as fat32  00:01:32    ( ERROR )

calibrate /dev/sdd1  00:00:00    ( SUCCESS )

path: /dev/sdd1 (partition)
start: 2048
end: 8191999
size: 8189952 (3.91 GiB)
clear old file system signatures in /dev/sdd1  00:01:32    ( ERROR )

write 512.00 KiB of zeros at byte offset 0  00:01:32    ( ERROR )
libparted messages    ( INFO )

Unable to open /dev/sdd read-write (Read-only file system). /dev/sdd has been opened read-only.
Unable to open /dev/sdd read-write (Read-only file system). /dev/sdd has been opened read-only.
Unable to open /dev/sdd read-write (Read-only file system). /dev/sdd has been opened read-only.
Unable to open /dev/sdd read-write (Read-only file system). /dev/sdd has been opened read-only.
Unable to open /dev/sdd read-write (Read-only file system). /dev/sdd has been opened read-only.
Can't write to /dev/sdd, because it is opened read-only.
Can't write to /dev/sdd, because it is opened read-only.
Can't write to /dev/sdd, because it is opened read-only.

Também tentou excluir a partição atual e criar uma nova, mas obteve o mesmo erro.

O disco flash não possui um switch de hardware. Eu também tentei usar hdparm , mas não tem efeito algum:

$ sudo hdparm -r0 /dev/sdd

/dev/sdd:
 setting readonly to 0 (off)
 readonly      =  0 (off)

Algumas informações sobre o disco flash:

$ sudo fdisk /dev/sdd
Welcome to fdisk (util-linux 2.28.2).                                                                                                   
Changes will remain in memory only, until you decide to write them.                                                                     
Be careful before using the write command.


Command (m for help): i

Selected partition 1
         Device: /dev/sdd1
           Boot: *
          Start: 2048
            End: 8191999
        Sectors: 8189952
      Cylinders: 508
           Size: 3.9G
             Id: c
           Type: W95 FAT32 (LBA)
    Start-C/H/S: 1023/255/63
      End-C/H/S: 1023/255/63
          Attrs: 80

Além disso, fsck me dá

$ sudo fsck /dev/sdd
fsck from util-linux 2.28.2
e2fsck 1.43.3 (04-Sep-2016)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdd

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

/dev/sdd contains 'DOS/MBR boot sector; partition 1 : ID=0xc, active, start-CHS (0x3ff,255,63), end-CHS (0x3ff,255,63), startsector 2048, 8189952 sectors' data

e

$ sudo fsck /dev/sdd1
fsck from util-linux 2.28.2
fsck.fat 4.0 (2016-05-06)
open: Read-only file system

Quando eu fiz o fsck logo após a reinserção da unidade, recebi

$ sudo fsck /dev/sdd1
fsck from util-linux 2.28.2
fsck.fat 4.0 (2016-05-06)
0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 1
FATs differ but appear to be intact. Use which FAT ?
1) Use first FAT
2) Use second FAT
? 1
Free cluster summary wrong (1021716 vs. really 1021743)
1) Correct
2) Don't correct
? 1
Perform changes ? (y/n) y
/dev/sdd1: 1 files, 1/1021744 clusters

mas isso não parece mudar nada.

Então, como removo a proteção contra gravação (ou somente leitura) do disco flash USB?

    
por Spikatrix 03.12.2016 / 04:54

0 respostas