USB Flash Disk Won't Format (Read Only)

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.

2 Likes

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

/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.

:smiling_face_with_tear:

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:

2 Likes

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

Would this work to zero the critical initial sectors when normal formatting tools don’t work?

dd if=/dev/zero of=/dev/sdY bs=4k count=1 status=progress

where “Y” in sdY is the actual USB drive.

It has been around for a long time in Tutorials section

You cannot do that - the command may return OK but it won’t work.

In the Tutorials section is a utility script to handle the task

If @cscs suggestion in #10 is failing - it is likely end of life - it happens more often than you think.

1 Like

Simple alternative is install package
grml-rescueboot

See also explanation for Debian
http://wiki.grml.org/doku.php?id=rescueboot

Now its as simple as copy your *.iso to
/boot/grml/
then update-grub and you have aditional boot entry for your *.iso

3 Likes

I just tried an it does not work for just ANY iso. By default it works for their grml images. The grub script there is optimized for those images, if you put a manjaro iso it will not find vmlinuz, initrd etc. where it looks.
So for a manjaro iso you have to use the method from the How-to.

Just veryfied with booting
manjaro-xfce-21.3.7-220816-linux515.iso
from the new grub-menue entry … it works!

Sysinfo

Generated on 2023-06-24 11:49:1687600193

#################### inxi -Fxzc0 ########################

System:
  Kernel: 6.1.31-2-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.1.1 Desktop: Xfce v: 4.18.1
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 81RS v: Lenovo Yoga S740-14IIL serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: SDK0J40709 WIN serial: <superuser required> UEFI: LENOVO
    v: BYCN39WW date: 05/28/2021
Battery:
  ID-1: BAT0 charge: 63.6 Wh (97.4%) condition: 65.3/62.0 Wh (105.3%) volts: 17.1 min: 15.4
    model: LGC L19L4PD2 status: full
CPU:
  Info: quad core model: Intel Core i7-1065G7 bits: 64 type: MT MCP arch: Ice Lake rev: 5 cache:
    L1: 320 KiB L2: 2 MiB L3: 8 MiB
  Speed (MHz): avg: 1350 high: 1500 min/max: 400/3900 cores: 1: 1500 2: 1396 3: 608 4: 1500
    5: 1301 6: 1500 7: 1500 8: 1500 bogomips: 23968
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel Iris Plus Graphics G7 vendor: Lenovo driver: i915 v: kernel arch: Gen-11
    bus-ID: 00:02.0
  Device-2: NVIDIA GP108M [GeForce MX250] vendor: Lenovo driver: nvidia v: 530.41.03 arch: Pascal
    bus-ID: 2b:00.0
  Device-3: Chicony Integrated Camera driver: uvcvideo type: USB bus-ID: 3-5:5
  Display: x11 server: X.Org v: 21.1.8 driver: X: loaded: modesetting,nvidia unloaded: nouveau
    dri: iris gpu: i915 resolution: 1: 1920x1080~60Hz 2: N/A
  API: OpenGL v: 4.6 Mesa 23.0.4 renderer: Mesa Intel Iris Plus Graphics (ICL GT2)
    direct-render: Yes
Audio:
  Device-1: Intel Ice Lake-LP Smart Sound Audio vendor: Lenovo driver: sof-audio-pci-intel-icl
    bus-ID: 00:1f.3
  API: ALSA v: k6.1.31-2-MANJARO status: kernel-api
  Server-1: sndiod v: N/A status: off
  Server-2: PipeWire v: 0.3.70 status: active
Network:
  Device-1: Intel Ice Lake-LP PCH CNVi WiFi driver: iwlwifi v: kernel bus-ID: 00:14.3
  IF: wlp0s20f3 state: up mac: <filter>
  Device-2: Realtek RTL8153 Gigabit Ethernet Adapter driver: r8152 type: USB bus-ID: 2-1.4:4
  IF: enp0s13f0u1u4 state: up speed: 1000 Mbps duplex: full mac: <filter>
  IF-ID-1: pan1 state: down mac: <filter>
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB bus-ID: 3-10:14
  Report: rfkill ID: hci0 rfk-id: 4 state: up address: see --recommends
Drives:
  Local Storage: total: 1.84 TiB used: 445.39 GiB (23.6%)
  ID-1: /dev/nvme0n1 vendor: Micron model: MTFDHBA1T0TCK size: 953.87 GiB temp: 45.9 C
  ID-2: /dev/sda vendor: Western Digital model: WD10EARX-00N0YB0 size: 931.51 GiB type: USB
Partition:
  ID-1: / size: 57.85 GiB used: 41.66 GiB (72.0%) fs: ext4 dev: /dev/nvme0n1p8
  ID-2: /boot/efi size: 259.5 MiB used: 114.8 MiB (44.2%) fs: vfat dev: /dev/nvme0n1p1
Swap:
  ID-1: swap-1 type: partition size: 16.67 GiB used: 0 KiB (0.0%) dev: /dev/nvme0n1p9
Sensors:
  System Temperatures: cpu: 52.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 284 Uptime: 6m Memory: available: 15.19 GiB used: 2.71 GiB (17.8%) Init: systemd
  Compilers: gcc: 13.1.1 clang: 15.0.7 Packages: 1987 Client: Unknown Client: wrapper-2.0
  inxi: 3.3.27

If i recall it correct i just installed the package and copied the *.iso to the now existing /boot/grml folder plus update-grub

Never needed it because Manjaro just works for years now :slight_smile:

But i now think its useless for your usecase because /boot/grml is part of the system you want to fix?!

I make a full backup every night with backintime, never fixed a ruined system because its easy to restore with backintime.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.