I have read-only usb drive and could not fix it. I have read some articles about it and tried to fix but I couldn't.

I unmounted drive and used dosfsck to check and repair MS-DOS filesystems, because it is FAT filesystem and run:

dosfsck -a /dev/sdb1

it gave the output:

fsck.fat 4.1 (2017-01-24) open: Read-only file system

So what can I do with it? Can I repair or it's time to throw it in a trash?

  • 1. where did the USB come from: some USBs -are- read only. Often when those are commercial those USB are hardware locked. 2. Some USB have a hardware lock on the outside. – Rinzwind Feb 10 '18 at 12:31
  • this usb was worked normally and once it became read-only. I think during monting or unmounting – godot Feb 10 '18 at 12:41
  • Can you add the output of dmesg when you insert the USB? – Katu Feb 16 '18 at 13:59
  • what is dmesg?? – godot Feb 16 '18 at 14:51
  • Maybe the tips in the following link will help, askubuntu.com/questions/144852/… – sudodus Feb 16 '18 at 15:12

If the USB was once writable and is now no longer, this suggests 3 things in my mind:

  1. A hardware switch on the device has been toggled.

    If this is the case, the simple fix would be to find that hardware switch (they can be really subtle), and toggle it.

  2. An "unclean" unmount occurred, such as pulling the USB out of the slot before the OS finished writing data to it

    To save the life of devices, and to improve performance, writes to most storage mediums are buffered -- including USB drives. In essence, this means then unless you tell the operating system to eject/unmount the USB drive, you have no guarantee that all data has been written. Further, most filesystems have flags to indicate when they've been mounted and unmounted: always tell the OS you're going to remove the drive ("eject", "unmount", "turn off") before you pull it out of the slot.

    Consequently, if simply checking and fixing the filesystem does not work, then you could try the ham-fisted approach of copying your data temporarily somewhere else, reformatting your USB drive, and then copying your data back. By reformatting, you're completely overwriting what was there, so the OS/filesystem will have no recollection the USB drive/filesystem was readonly before the format.

    One detail on repairing the filesystem. Make sure it's not mounted first. Your set of commands implies it's mounted. So:

    sudo umount /dev/sdb1

    sudo dosfsck -a /dev/sdb1

  3. The USB disk itself is dying, and the embedded firmware is protecting you from losing any data.

    If the USB uses flash-based storage, it's possible that you have written to the device enough times that it is now unable to write anymore. Writing to flash-based is a destructive process, and each sector can only take so many rewrites. Many drives will "hide" this fact, by internally having much larger storage (say 16G of total write space), but only present to the OS as a smaller amount (say 2G). As each sector begins to wear out, the firmware will automatically move the data to a new unused sector. After too many writes, however, there will be no more usable storage, and smart firmware implementations will lock the drive to prevent data loss. At that point, your only option would be to copy the data to a new flash drive.

| improve this answer | |
  • If there is nothing on the drive you need to keep, use "gparted" to create a new filesystem on the drive, create a new partition and format it to your format of choice (I guess you want fat32 ?). If it mounts read only, you need to change the permissions of the mount point. – hatterman Feb 20 '18 at 14:35

A thumb drive has, perhaps only recently, some means of turn itself readonly for some days as you burn there something - maybe just to preserve its life as a flash memory further.

That unit isn't bricked at all, and you may wish to set the readonly flag to zero earlier...

Please look at hdparm --security-help from your device.

You may want to run SOME of them if not ALL; try to figure out the correct sequence.

The idea here is to:

hdparm --security-mode m --user-master m --security-freeze device;
hdparm --security-mode m --user-master m --security-set-pass null device;
hdparm --security-mode m --user-master m --security-unlock null device;
hdparm --security-mode m --user-master m --security-disable null device;
hdparm --security-mode m --user-master m --security-erase null device;
hdparm --security-mode m --user-master m --security-erase-enhanced null device;

To fully disable the readonly feature of your device. I was successful with this on a USB 2.0 64G multilaser (tm) pen drive here in Brazil a month ago.

| improve this answer | |

The Ubuntu utility called "DISKS" is very powerful. It can sometimes fix this fault. I've had success with it a couple of times. Plug in the usb drive. Open DISKS. On the left it will list the drives it can see. In the main window it will show the partitions on each drive. Select the usb drive from the list on the left. It will open in the main window and show it as one partition (unless you've changed this). Under the window there are 2 icons, one can be used to mount and unmount the drive and the other (Gear Wheels) can be used for a wide range of maintenance operations. Underneath this there are 4 items of information about the drive - Size, Device, UUID, Contents. These will help you make sure you have selected the right drive. Click the Gear Wheels and on the sub-menu look about 7 items down for "Repair Filesystem". You'll get a warning but continue. If DISKS can fix the drive it may create a number of FSCK files on the drive. When it has finished it will list the FSCK files it has created. You have to open a console and delete these files with sudo rm -rf FSCK* Once you've done this to tidy up the drive you are done. DISK will have removed the flag that made the file system read-only. Eject the usb drive and then remove it from the slot. It should now behave normally, if you are lucky.

| improve this answer | |
  • Nice answer! Some screenshots will make it wonderful. – user68186 Jun 12 '19 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.