あちゃー、ってなわけですよ。
まずはどうにかデータをサルベージしたい。
$ diskutil list /dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *121.3 GB disk0 1: EFI EFI 314.6 MB disk0s1 2: Apple_APFS Container disk1 121.0 GB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +121.0 GB disk1 Physical Store disk0s2 1: APFS Volume Macintosh HD - Data 92.5 GB disk1s1 2: APFS Volume Preboot 81.1 MB disk1s2 3: APFS Volume Recovery 530.0 MB disk1s3 4: APFS Volume VM 2.1 GB disk1s4 5: APFS Volume Macintosh HD 11.3 GB disk1s5 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *480.1 GB disk2 1: EFI EFI 209.7 MB disk2s1 2: Apple_HFS SSD 479.8 GB disk2s2 /dev/disk3 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *1.0 TB disk3 1: EFI EFI 209.7 MB disk3s1 2: Apple_HFS USB1TB 999.9 GB disk3s2 /dev/disk4 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *7.8 GB disk4 1: DOS_FAT_32 7.7 GB disk4s1
ディスクが色々つながっていてわかりにくいが、SDカードは8Gなので/dev/disk4だ。
www.cgsecurity.org
このソフトウェアを使う。
TestDisk7.2-WIPをダウンロードし、testdisk-7.2-WIP.mac_intel_x86_64.tar.bz2を解凍する。
回答されたフォルダに移動して
$ sudo ./photorec PhotoRec 7.2-WIP, Data Recovery Utility, January 2023 Christophe GRENIER <grenier@cgsecurity.org> https://www.cgsecurity.org PhotoRec is free software, and comes with ABSOLUTELY NO WARRANTY. Select a media and choose 'Proceed' using arrow keys: >Disk /dev/disk2 - 480 GB / 447 GiB (RO) Disk /dev/disk4 - 7751 MB / 7392 MiB (RO) Disk /dev/rdisk2 - 480 GB / 447 GiB (RO) Disk /dev/rdisk4 - 7751 MB / 7392 MiB (RO) >[Proceed ] [ Quit ] Note: Disk capacity must be correctly detected for a successful recovery. If a disk listed above has an incorrect size, check HD jumper settings and BIOS detection, and install the latest OS patches and disk drivers.
カーソルキーを
Disk /dev/disk4 - 7751 MB / 7392 MiB (RO)
に移動し
>[Proceed ]がハイライトされていることを確認してリターン
PhotoRec 7.2-WIP, Data Recovery Utility, January 2023 Christophe GRENIER <grenier@cgsecurity.org> https://www.cgsecurity.org Disk /dev/disk4 - 7751 MB / 7392 MiB (RO) Partition Start End Size in sectors No partition 0 15138815 15138816 [Whole disk] > 1 * FAT32 8192 15138815 15130624 >[ Search ] [Options ] [File Opt] [ Quit ] Start file recovery
PhotoRec 7.2-WIP, Data Recovery Utility, January 2023 Christophe GRENIER <grenier@cgsecurity.org> https://www.cgsecurity.org 1 * FAT32 8192 15138815 15130624 To recover lost files, PhotoRec needs to know the filesystem type where the file were stored: [ ext2/ext3 ] ext2/ext3/ext4 filesystem >[ Other ] FAT/NTFS/HFS+/ReiserFS/...
FATフォーマットのSDなので、下の行がハイライトされている状態でリターン
PhotoRec 7.2-WIP, Data Recovery Utility, January 2023 Please select a destination to save the recovered files to. Do not choose to write the files to the same partition they were stored on. Keys: Arrow keys to select another directory C when the destination is correct Q to quit Directory /Applications/Utilities/testdisk-7.2-WIP >drwxr-xr-x 501 20 672 2-Mar-2023 10:20 . drwxr-xr-x 0 0 480 1-Mar-2023 19:36 .. drwxr-xr-x 501 20 96 16-Feb-2023 19:28 78 drwxr-xr-x 501 20 160 16-Feb-2023 19:28 icons -rw-r--r-- 501 20 216 12-Nov-2007 01:21 AUTHORS -rw-r--r-- 501 20 17987 16-Jun-2006 07:01 COPYING -rw-r--r-- 501 20 117 21-Jan-2023 17:36 INFO -rw-r--r-- 501 20 19633 8-Jul-2019 02:16 NEWS Next
そのまま進めるとアプリケーションのフォルダの中にリカバリーされたファイルのフォルダができる。別の場所を指定してもいい。
保存したいディレクトリがハイライトされている状態でcをタイプ
PhotoRec 7.2-WIP, Data Recovery Utility, January 2023 Christophe GRENIER <grenier@cgsecurity.org> https://www.cgsecurity.org Disk /dev/disk4 - 7751 MB / 7392 MiB (RO) Partition Start End Size in sectors 1 * FAT32 8192 15138815 15130624 Stop Destination /Volumes/Share_Folder/写真/名称未設定フォルタ 2/recup_dir Pass 1 - Reading sector 73981/15130624, 5 files found Elapsed time 0h00m58s - Estimated time to completion 3h16m44 jpg: 5 recovered
こんな感じでrecup_dir.1フォルダが作られ、中にファイルがリカバリーされていく。ファイルの数が多いときはフォルダが複数に分かれるっぽい。
こんな感じで無事ファイルが取り出せる(場合がある。必ず取り出せるとは限らない)。