1

Issue: When running testdisk in macOS, it does not list the internal hard drives.

Objective: I had a video file on the internal Hard drive that was deleted and mistakenly cleaned the trash, which I want to recover.

Configuration already done:

System Preferences –> Privacy & Security –> Full Disk Access –> Enable for Terminal

Screenshot of testdisk - not listing the hard drive enter image description here

Can someone please suggest on how to fix this issue to list out all the partitions of a HDD?

Abh
  • 43

3 Answers3

1

Just to provide an actual, researched, answer on here.

TestDisk is next to useless for Mac, as is PhotoRec.
They can't read APFS at all, so for any OS newer than High Sierra 10.12 it is totally pointless to install, unless the drive you are trying to recover from is FAT/ExFAT, which precludes any boot drive; and you shouldn't be using any FAT structure on Mac unless you absolutely need cross-platform portability. Even then it's better to use HFS & install a comparable reader utility on your other platform. FAT cannot store unix permissions or ACLs & will actually break some of the Mac's data structures such as Photos or iMovie libraries and Logic Pro Project files.

Installing software on the drive you are trying to recover is counter-productive. You may be overwriting the very data you are trying to recover.

Being already prepared by always having a known-good external boot source with rescue utilities is always better than panicking afterwards.
Having a tested, working backup solution is better still.

If you have none of the above, then copying the drive using dd to another disk first, before installing any new software, would be safer.

Tetsujin
  • 50,917
1

Here's an actual, researched answer: Yes these two programs can read APFS, Tetsujin is very much wrong in this case. (SIP) System Integrity Protection is on by default which is what's blocking testdisk from viewing internal drive, adding terminal to full file access doesn't cut it, you need to disable SIP. To do that you need to restart your device and enter recovery mode. Then you need to run csrutil disable in the terminal and restart the device for the change to take effect.

music2myear
  • 49,799
denaal
  • 11
0

The requirements to run Testdisk on MacOS are outlined in the Testdisk manual:

6.6 Running TestDisk, PhotoRec under macOS If you are not root, TestDisk (i.e. testdisk-7.1/testdisk) or PhotoRec will restart itself using sudo after confir- mation from your part. If your administrator account has no password (a blank password), you must give that user a password before using the sudo command: • Choose Apple menu > System Preferences and click Accounts. • Click Change Password. Terminal doesn’t show the password as you type. If you enter the wrong password or a blank password, the command isn’t executed and Terminal asks you to try again. If no disk is listed when running TestDisk or PhotoRec, select System Settings –> Privacy & Security –> Full Disk Access –> Enable for Terminal ( or TestDisk and PhotoRec themself)

Source: https://www.cgsecurity.org/testdisk.pdf

That leaves you to verify that you run macOS with an existing root password.

Hint: Do run Testdisk version 7.2-WIP (work in progress) instead of version 7.1. As opposed to what the name 7.2-WIP suggests it is not a beta version but the result of a continuously improved version 7.1.

r2d3
  • 4,050