Create and Restore Disk Images on macOS
- Run the following command, and look for the volume path of your drive.
diskutil list
- Replace the bracketed part with the volume path and run the command.
diskutil unmountDisk [Volume Path]
- Replace the bracketed part with the volume path and the desired name and path for a disk image file, and run the command.
sudo dd if=[Volume Path] of=[Path to Disk Image file].img
To restore a disk image to a drive:
- Run the following command to find a volume path to the disk.
diskutil list
- Replace the bracketed part with the volume path and run the command.
diskutil unmountDisk [Volume Path]
- (optional) You can format the disk before going ahead. Replace the bracketed part with the volume path and run the command.
sudo newfs_msdos -F 32 [Volume Path]
- Replace the former bracketed part with the path to the disk image by simply drag and drop, and latter with the volume path. And run the command.
sudo dd if=[Path to Disk Image file] of=[Volume Path]
Let me know if there is any issues or questions.