You can use 'hdiutil' to create, mount, and unmount disk images:

  • to create a UFS (Unix file system) disk image, do the following:
          hdiutil create ufs_tmp -volname tmp -size 3000m -fs UFS
    where "ufs_tmp" is the name of the file you want to create on disk, "tmp" is the name the file system will be mounted as, and "3000m" is the size of filesystem to create (in this case 3 gigabytes, approximately).

  • to mount the filesystem, do:
          hdiutil attach ufs_tmp.dmg -readwrite

  • to unmount the filesystem, do:
          hdiutil detach `hdid cvs.dmg | perl -pe 's@^(/dev/disk\d+).*@$1@' | sort -u`
    this last bit (in the back-ticks) is just figuring out what device to unmount. You can cut and paste the back-ticked portion in a terminal to see what it's picking up. As an alternative, you could run 'df', figure out which device the file is mounted as, and then just tell hdiutil to detatch that device.

-- DarrellSchiebel - 01 Sep 2005
Topic revision: r1 - 2005-09-01, DarrellSchiebel
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback