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
partedorfdisk? 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 likedd.man umount.sudo touch /dev/wibble(or any other filename in/devthat does not exist). If you get aRead-only file systemerror the problem is nothing to do with/dev/sdbbut rather something's gone wrong with the/devsubsystem