2

I’m backing up an old Mac SSD and I wondered whether if creating a compressed DMG from that HFS+ disk with Disk Utility will actually consider the free space as zero and therefore compress it immensely or if it will simply compress a bit-by-bit image consisting also of the bits of long deleted files.

Does anyone know?

Thanks in advance.

2
  • If you are backing up to an image file (.dmg) you might want to create it as a "sparse image" and that expands with the amount of data it contains up to it's "formatted" size. Oddly enough if you delete files contained in a sparse image, I believe the space is not recovered, unless I am remembering incorrectly... Commented Jan 31, 2023 at 22:26
  • The rules have changed (due to APFS and SSDs with trim support) since I did a lot of imaging, but it at least used to treat unallocated space as all-zeroes, and hence compress it really well. But you can also create an image from a folder (selecting an entire volume as the source "folder"), and it'll create an image of just the actual files without the empty space at all. Commented Feb 1, 2023 at 0:49

1 Answer 1

1

From Apple Support

Create a disk image from a disk or connected device

You can create a disk image that includes the data and free space on a physical disk or connected device, such as a USB device. For example, if a USB device or volume is 80 GB with 10 GB of data, the disk image will be 80 GB in size and include data and free space. You can then restore that disk image to another volume.

In Terminal, using the hdiutil command, you can convert existing disk images into a number of compressed file formats. If you are just storing the compressed files for archival purposes, this may work for you.

convert image -format format -o outfile

This page replicates the info from man hdiutil.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .