MacOS – Does mounting a large disk image require a certain amount of free space on the internal drive

disk-spacedisk-utilityhard drivemacosmount

I've got a bunch of Mac disk images (.dmg files) that are 100 GB or larger. I'm currently on an iMac with a few hundred gigabytes of free space, but I'm going to be moving to a Mac laptop with 128 GB storage.

So, I'm wondering, would that be a problem when I have less than 100 GB of free space on my computer, but I'm opening a disk image larger than 100 GB? My guess would be no, but is ANY space on the internal drive used at all when mounting an image?

How exactly does mounting an image work, does it just change the way the operating system sees the files as one file (the disk image) rather than the actual files within the disk image, until it is mounted? Therefore, no internal space is necessary for the mount operation?

Follow-up question: Is it any slower to read from a DMG on an external drive than it is to read from any other files on the same external drive? Basically, is there any performance hit from having files in a DMG?

Best Answer

There certainly isn't the same amount necessary as the DMG, so you sure can mount a 100GB DMG into a file system that has less (there will be trivial consumptions, maybe a few kb, but nothting that you'll notice).

The whole thing works in the way, that the system attaches a file-system driver to the file with the DMG. The driver will present the DMG file to the system like an "external" drive and perform file requests on behalf of the system on the contents of the file.

Essentially the driver will says to MacOS: We have a new volume here. So MacOS will then ask the driver. "Give me a list of content in it", and then the driver examines the inside of the file and presents the list of files organized inside the DMG. Etc.