I've got the HFS+ filesystem represented by .dmg image file. For security reasons I'd like to make sure every I/O applies directly to the .dmg file and not through any kind of memory in the middle.

Is there any way to cancel the option for read and write caching while mounting the filesystem?

During my research (source: Apple Developer) about this I discovered that HFS+ hears contain attributes field, which refer to volume attributes. One of its containing bits is named kHFSVolumeNoCacheRequiredBit and this bit is set if the blocks from this volume should not be cached, which is pretty much what I need.

Any idea how to configure this volume properly (command-line, application, API, etc .. )?

  • 1
    Where did you read that info? – Allan Apr 30 '18 at 11:15
  • 1
    @allan, in HFS+ spec here developer.apple.com/legacy/library/technotes/tn/tn1150.html. It's a little out-dated doc, but I guess the filesystem spec haven't changed – osxUser Apr 30 '18 at 11:19
  • 1
    From this in the document you linked: This bit is set if the blocks from this volume should not be cached. For example, a RAM or ROM disk is actually stored in memory, so using additional memory to cache the volume's contents would be wasteful. Since I can't find a way to set that attribute during the creation of a RAM disk, I'm assuming it's automatic. If that's the case, then the solution is to create a RAM disk and copy the contents to it bypassing the cache. – Allan Apr 30 '18 at 11:55
  • Thanks, i also depicted this information from the spec. I hope there's also a way to use .dmg filesystem with this configuration. – osxUser Apr 30 '18 at 12:53

You must log in to answer this question.

Browse other questions tagged .