2

I need to hide a particular folder on my Mac from other people who might want to view or copy them while I'm away from home.

There are two ways I'm aware of. The first way is to hide the folder using Terminal.

chflags hidden your-folder
chflags nohidden your-folder

The second way is to move the files from the folder to a disk image, which is created using Disk Utility. And again, it seems there are two different ways, both are described here: Create a disk image using Disk Utility on Mac, sections

  • Create a disk image from a folder or connected device

    Disk Utility > File > New Image > Image From Folder > Encryption = 128-bit AES encryption > Passoword = ... > Image Format = read/write

  • and Create a secure disk image

    Disk Utility > File > New Image > Blank Image > Size = 100 MB (default) (as far as I understand, this value doesn't matter, because we will use read/write futher) > Format = APFS > Encryption = 128-bit AES encryption > Partitions = Single partition - GUID partition map (default) (I don't know what does it mean) > Image Format = read/write disk image

What I don't understand and what my question is about is whether any practical difference here between creating a disk image from folder and creating a blank disk image. And if it is, then what is this difference.

Note that a disk image should not be limited to a particular size. I want to be able to add there as many files as I want. That is, its size should be adaptive.

1 Answer 1

1

When making a "Create a disk image from a folder or connected device", the amount of available space is slightly larger than the space used by the folder. I was unable to change the size of the disk image by using the Disk Utility under macOS Catalina. However, I could by using the hdiutil command. For example, if I want the size of my stuff.dmg read/write image file to be 1 GB, then I would enter the following command.

hdiutil resize 1g stuff.dmg

I suppose you could do the same with "Create a secure disk image", but this would require having to copy the files from the folder to the disk image. You have more options than just creating a read/write disk image (.dmg). You can also create a sparse disk image (.sparsediskimage) or a sparse bundle disk image (.sparsebundle). Both differ from a read/write disk image in that both can grow as files are added. A sparse disk image is a single file, where as a sparse bundle disk image is a folder containing many small files. A sparse bundle disk image is prefered when the size of the image will be vary large. Note that when an image size exceeds 4 GB, a sparse bundle disk image can exist on FAT formatted volumes. This is not possible for read/write images or sparse bundle disk images.

1
  • Hi, David. Sorry for a relly late reply. (I have upvoted your answer, of course!) "Both differ from a read/write disk image in that both can grow as files are added." - I have tested it and it seems you are correct, they can grow (or I can create an image from folder, and it can grow as well), but seems the image doesn't grow automatically. I have to manually enlarge its size using Disk Utility once it is full. Right?
    – user480875
    Commented Feb 21 at 17:38

You must log in to answer this question.