USB Flash Disk Won't Format (Read Only)

Hello everyone, I’m trying to format a USB flash disk by Manjaro Linux, but I’m not succeeding. All attempts return error and some with message: failed to open ‘/dev/sdb1’: Read-only file system.

I’m trying to format because I want to create a boot image of Manjaro KDE (I’m currently using GNOME)

lsblk -a 

sdb         8:16    1    7,5G    1     disk 
└─sdb1      8:17    1    7,5G    1     part 
lsblk -f 

└─sdb1      vfat   FAT32            0E01-9845
ls -l /dev/sdb                                                                                                                                                                                 

brw-rw---- 1 root disk 8, 16 jun 21 19:41 /dev/sdb

Some attempts

sudo sgdisk --zap-all /dev/sdb                                                                                                                                                                     

Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. 

Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.
Problem opening '/dev/sdb' for writing! Program will now terminate.
Warning! MBR not overwritten! Error is 30!

this return ok

sudo chown -R $USER /dev/sdb


rm -rf

rm: unable to remove '': Read-only file system

sudo rm -rf

rm: unable to remove '': Read-only file system

I recognize that from when playing around with raspberry pi os, they have a boot partition (MBR) and somehow also a boot the first sectors in the / partition that is in GPT. I recall reading something about GPT needing 33 blocks a 512kb for the filesystem or somtething.

Try removing all partitions and recreate a clean new GPT with f ex fdisk or parted, or just do it in gparted in gui.

Might be a wild hunch, but that 33 blocks hit a memory spot.

So If you want to wipe the usb device, then use simply:

sudo umount /dev/sdb
sudo wipefs --all --force /dev/sdb

:warning: Keep sure that the device is unmounted, and that it is the correct one!

It will delete all Magic Strings. And you should be able to format with gparted or gnome-disks. Or what ever you want to use.

1 Like

sudo umount /dev/sdb1 (or whatever number is mounted, if anything)


I think there might be some confusion here.

When changing permissions or doing things your user does not have rights for … you will need to use something like sudo.

But … regardless of all that … lets help you clean/format the device …

Maybe fdisk would be friendly to use;
First make sure the thing is unmounted:

sudo umount /dev/sdb1

Then you can start fdisk in interactive mode

sudo fdisk /dev/sdb

From there you can hit d for delete and select the partition.
Then hit g to create a new GPT partition table or o for MBR table - as yours seems broken.
Then hit n to create a new partition.
To write/exit hit w.


not working :frowning:

sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.38.1).
Changes will only remain in memory until you decide to save them.
Be careful before using the write command.

fdisk: could not open /dev/sdb: Read-only file system

sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.38.1).
Changes will only remain in memory until you decide to save them.
Be careful before using the write command.

fdisk: could not open /dev/sdb: Read-only file system

That might be a sign of faulty hardware tbh.
Doesn’t linux automatically put anything in read only mode if it detects hardware irregularities?
Edit. I cross my fingers I am wrong.

OK … try this:

sudo hdparm -r0 /dev/sdb

(then try mounting or interacting with it again - fdisk, i suppose)

Also please verify your device does not have some sort of hard switch - for example many SD cards may have a little toggle for ‘locking’ which can force this read-only situation.


Could be then only:

A) Flash Disk reaches its lifetime, no more write cycles possible, therefore it is readonly.
B) A physical switch let it be locked as read only.

sudo hdparm -r0 /dev/sdb

 setting readonly to 0 (off)
 readonly      =  1 (on)

Nothing bruh :cry:

Right, alternative B would not be possible, because I don’t have a physical switch on this device.
But, considering alternative A, how do you know if it really has reached the end of its useful life?

Look, every Flash Drive has a Controller and a Flash Memory. The controller controls how much data can be written and how in simple words. There is a hard limit of write cycles, like on any SSD. On dump USB Flash Drives, you can only detect it when you cannot write data on it (create, modify, delete), but still you can read everything.

Got it, from that, I believe that’s the problem then, because everything we tried went down the drain.


You could try installing gsmartcontrol and maybe you might find some info there if you are curious.

pamac install gsmartcontrol

Edit. I revoke that, I tried with a usb stick and it shows nothing, guess it’s not S.M.A.R.T capable. xD
My “ssd” usb stick gave me info though. :smiley:

Just an alternative you don’t have a Flash Drive… wrote that myself and I use it on all of my Manjaro systems:


I’ll try this another time. Thanks!

@megavolt Wow, I’m def bookmarking that for playing around with, I have played around with mounting isos directly in my standard grub, this is a very nice reference! Thank you!

To use nvidia do I only have to change set dri="free" to nonfree, or does this still bring up the grub menu (I see a timeout) and this is just the menu chooser will be at default?

1 Like

You see the Grub Menu, where you can choose to boot the ISO. The grub menu of the ISO will be skipped, since all parameters are already set.

Ah, I see, thank you very much for this, I will def play around with it!

1 Like