Can't read/write via `dd`: got /dev/disk2: Permission denied (to Physical device)

I can't do anything via dd with my Physical devices agreed. I can only work with partitions like disk2s1, but can not read from whole disk like disk2. Can't find where is the root of problem.

Steps:
  1. Check disks: diskutil list
  2. Unmount: diskutil unmountDisk /dev/disk2

Then

$ sudo dd bs=4m if=/dev/disk2 of=~/Desktop/PiOS_full_root.img
dd: /dev/disk2: Permission denied

What causes this problem? why dd sends this error from sudo


there are similar topics around. What've tried, but doesn't works:

and many others. nothing is helps.

  • I check system preferences and gave full disk access to iTerm2 (doesn't help)
  • unmount via diskutil unmountDisk and diskutil unmount
  • Change USB ports (many people said because of the physical lock of sd card.
  • change disk / rdisk naming - result the same
  • Lock\unlock state doesn't affect it (it's microUSB, put without adapter into the microsd slot)

Any suggestions, what to check, and how to fix it?

Here is the log:

log


~ ❯ diskutil list                                                                                                                                                                                 
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         500.0 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD - Data     437.8 GB   disk1s1
   2:                APFS Volume Preboot                 80.6 MB    disk1s2
   3:                APFS Volume Recovery                528.5 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4
   5:                APFS Volume Macintosh HD            11.2 GB    disk1s5

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *15.9 GB    disk2
   1:             Windows_FAT_32 boot                    268.4 MB   disk2s1
   2:                      Linux                         15.7 GB    disk2s2


 ~ ❯ diskutil unmountDisk /dev/disk2                                                                                                                                                               
Unmount of all volumes on disk2 was successful

 ~ ❯ sudo dd bs=1m if=/dev/rdisk2 of=~/Pi_Backup.img
dd: /dev/disk2: Permission denied

 ~ ❯ ls -lhdO /dev/disk2                                                                                                                                                                           
brw-r-----  1 root  operator  -   1,   9 Jul 11 17:39 /dev/disk2


Update: another interesting thing: I chack disk in disk utility -> Get info -it's not writable!

But if I mount boot partition disk2s1 - I can write there!


I realize that exactly the same setup is working on other MacBooks and even with another admin user on this laptop. So no matter, what kind o issue it is: I think it's something related to my personal setup and setting, not to the system in general. So I will close this question for now.

If someone get the same problem: try to do the same steps as I described above or in the end: change the machine or user on your one if there is a chance to do this.

  1. make sure that diskX is unmounted via diskutil unmountDisk and diskutil unmount
  2. Change USB ports
  3. if it's SD card: blow with air into the slot (many people said because of the physical lock sensor of sd card.
  4. make sure, that you work via sudo. (just in case, you can check it via which sudo command)