OS/X fsck_hfs: "operation not permitted NO WRITE" for external drive in single-user mode [SOLVED]

0

I am attempting to repair an external hard drive (backup drive) on OS/X Catalina by booting into single-user mode and executing the following command:

 fsck_hfs -fyd /dev/disk2s2

(I determined the identity of the failing disk by looking at the log in Console.)

The Console log says "this volume could not be verified completely" in the log output, but gives no further details. That's why I'm trying to run it in single-user mode with the -d flag.

Here's what I get:

 /dev/disk2s2 ... (NO WRITE)
 Operation not permitted.

How do I get fsck_hfs to consent to run against this drive?

Mike Robinson

Posted 2020-02-05T14:32:44.027

Reputation: 129

Why from single user? Why not just from the running OS? – Tetsujin – 2020-02-05T14:39:20.247

Answers

0

Finally realizing that, since this is an external drive, I don't need to go into single-user mode, I logged on as an administrator and used the sudo command from the terminal.

First, I tried:

 sudo diskutil repairdisk disk2
 sudo diskutil repairvolume disk2s2

I noticed that this actually invokes fsck_hfs and that the device name includes an "r" to be /dev/rdisk2s2.

First, I read the manual-entry on the command to see what parameters to use:

 man fsck_hfs

Then, I ran the command with debug information turned on, and it worked:

 sudo fsck_hfs -ryd /dev/rdisk2s2

Although this still does not answer why I was getting NO WRITE in single-user mode ... an answer that I would still like to receive ... it does mean that I found a solution to my immediate issue.

(Note: MacOS automatically started its own fsck_hfs process in the background shortly after I attached the drive. I used top to find the process-id and then used sudo kill <pid> to terminate it so that the drive was no longer "busy" and my terminal-command could run against it.)

Mike Robinson

Posted 2020-02-05T14:32:44.027

Reputation: 129