0

1st set of commands

Using these commands with GDISK:

> sudo gdisk /dev/sdb
o
n
w

I get:

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!

Do you want to proceed? (Y/N): Y

OK; writing new GUID partition table (GPT) to /dev/sdb.

Unable to open device '/dev/sdb' for writing! Errno is 30! Aborting write!

2nd set of commands

Also using another set of GDISK commands:

> sudo gdisk /dev/sdb
x
z

I get:

About to wipe out GPT on /dev/sdb. Proceed? (Y/N): Y

Problem opening '/dev/sdb' for writing! Program will now terminate.

Blank out MBR? (Y/N): Y

Warning! MBR not overwritten! Error is 30!

Why

The device is a flash USB drive.

  • What might be the cause?
  • What else can I try?

DD

The dd couldn't help:

> sudo dd if=/dev/zero of=/dev/sdb status=progress
dd: failed to open '/dev/sdb': Read-only file system

FDISK

FDISK didn't help too:

> sudo fdisk /dev/sdb

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

fdisk: cannot open /dev/sdb: Read-only file system

HDPARM

I had already used hdparm:

> sudo hdparm -r0 /dev/sdb

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

macOS

I'm able to see USB drive content by a MacBook! So, the hardware is fine. macOS reports the filesystem as MS-DOS (FAT32).

macOS Disk Utility

Trying to format the device with macOS Disk Utility throws these error:

When erasing partition:

Starting secure erase…

Unmounting disk

Creating the partition map

Couldn’t open device.

Operation failed…

When erasing filesystem:

Unmounting disk

Couldn’t modify partition map.

Operation failed…

Wipefs tool

Wipefs tool output:

> sudo wipefs -a /dev/sdb
wipefs: error: /dev/sdb: probing initialization failed: Read-only file system
5
  • 2
    Is there anything relevant in the kernel messages? Have you tried a different command, such as parted or fdisk? I don't know if there is anything on the drive you want to keep, but if not, try writing to it with another tool like dd. Apr 30, 2021 at 14:19
  • @berndbausch Thanks =) Updated the post :)
    – Megidd
    Apr 30, 2021 at 14:26
  • Disks cannot be mounted while you alter partitions on the disk. Read man umount.
    – waltinator
    Apr 30, 2021 at 14:47
  • 1
    Something makes the drive readonly. See superuser.com/questions/1125282/… and other articles in Stackexchange and the internet. You could try it on a different computer, e.g. one running Windows. Or simply buy another drive. May 1, 2021 at 2:10
  • Please try sudo touch /dev/wibble (or any other filename in /dev that does not exist). If you get a Read-only file system error the problem is nothing to do with /dev/sdb but rather something's gone wrong with the /dev subsystem May 1, 2021 at 12:09

1 Answer 1

0

The device make and model is

SanDisk Ultra Media USB External Physical Disk 

According to this:

Is this a sandisk usb? Some have a hardware 'safety lock' that locks the usb to read-only in the event of a usb power fluctuation. I had one that did this and had to be returned, though they replaced it FOC.

According to that:

According to SanDisk customer service, those drives have a safety mechanism that disables writes when error conditions are detected, to protect the data:

The flash drive has detected a potential fault and has become write protected to prevent data loss. There is no method to fix this. You will need to backup your data and replace the flash drive.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .