I have a USB that is stuck in read only. I can't format it or delete its partitions. I was wondering if anyone knows of a way to fix this. In the fdisk screenshot the size of the partitions and the sectors seemed really unusual so i included a screenshot.
-
You need to unmount the file system at `/dev/sdb1` before you can modify or recreate the partition table (safely). Does it work now? I don't recommend using GPT on external media. It reduces compatibility and has no advantages over MBR at the moment. – David Foerster Feb 29 '16 at 09:52
-
Flash drives do wear out, when they do they enter read only mode to preserve data. Consider the possibility that the drive has seen better days and you should preserve anything valuable from the drive before it completely fails. – MacGuffin Jan 26 '21 at 14:25
2 Answers
try mounting with read write options
sudo mount -t ntfs -o rw /dev/sdb1 /mnt
then try accessing it if doesn't work which is more likely cause i think you may have tried these obvious stuff then that unalloccated is weird just make a backup of all data , delete the partition from gparted ,delete the partition table just to be safe recreate a partition table and create an new healthy partition if none of these works then just bring out the legendary pokemon,the last resort which is a little slow but always works "ONLY DO IT AS LAST RESORT"
dd if=/dev/zero of=/dev/sdb
this will fill the whole thing with zeros any corruption will be overwritten . Good Luck
- 1,042
- 1
- 14
- 34
A few observations:
As others have mentioned, you need to unmount the partition before you can edit the partition table.
You need to run
fdiskon the raw device and not a partition. i.e.:fdisk /dev/sdbThe correct partition table should then be visible.
To actually attempt to fix the filesystem run:
fsck /dev/sdb1If all else fails, try mounting the disk on a Windows machine. This may repair any filesystem damage. (It might also end up wiping the disk; Windows has a nasty tendency to break things.)
The reason this might work is that the Linux NTFS drivers are quite conservative about repairing filesystem damage and won't attempt a repair if they're not 100% sure the operation is safe (the driver docs specifically mention this but I don't have a reference readily at hand).
- 133
- 4

