I wanted to create a recovery DVD for my Mac OS X install and all I had was an old DMG of Mac OS X version 10.6.
I'm using mkfs.hfsplus to create a HFS+ volume on Linux, but I want to compress it using Apple's UDIF format. It looks like I should be able to use bzip2 to do this, but I can't really tell how. Any ideas on how I can create a read-only, UDIF compressed HFS+ volume on Linux? How do I remove Apple UDIF read-only compressed (bzip2) Media? Macbook Air (Early 2015) OS X El Capitan 10.11.3. I have at least 3 of these Disk Images on my Disk Utility screen and cannot figure out how to remove them. MacBook Air (13-inch, Early 2015), OS X Yosemite (10.10.3) 2016-07-14.
hdiutil Image Information
Here is the information regarding the DMG file:
You can see that the total size is 6737006592 bytes (about 6.3Gib). That is not going to fit on a Single Layer DVD. Here is the size information of an empty SL-DVD:
We can see that we can fit about 4.3GiB onto a SL-DVD. When I mount the DMG, I see the following size:
Here is the df output:
Since the data is compressed the actual file is 5.2GiB:
Create a Sparse Image
Let’s create a sparse image and copy the contents of the DMG to that. To create the sparse image we can run the following:
![Apple udif read-only compressed bzip2 media Apple udif read-only compressed bzip2 media](https://forums.macrumors.com/data/attachments/604/604045-d316a34b037ac08a118887d6eba7d517.jpg)
I noticed that the DMG didn’t have a partition schema so I did the same thing for the Sparse Image.
Restore DMG to a Sparse Image
Now we can mount the sparse file. First let’s unmount the DMG:
Now let’s mount the Sparse Image:
Now we can use asr (Apple Software Restore) to basically do a block level copy of the DMG onto the Sparse Image. First let’s scan our DMG:
Now for the copy/restore:
Checking the size of the Sparse Image:
After the copy the Sparse was mounted and checking the maximum size:
Notice the maximum size is 7.0GiB, which is what we created the Sparse File to be. Notice that since we did a block level copy the Volume Name was also copied.
Clean Up Un-necessary Files in the New Sparse Image
The Sparse Image is already mounted so let’s clean it up. The Mac OS X install CD contains a lot of printer Drivers, Language Packages, and X11 tools. For recovery purposes we don’t need those. To clean up the Sparse Image, I ran the following:
After you are done cleaning up superflous files, the used size should be about 4.2GiB:
Compact Sparse Image
Now we can reclaim the unused space in the Sparse image and resize it:
Notice we didn’t get all of the possible space. Looking over the size information of the image, we see the following:
we can also check the limits set on the Sparse file: Smartalbums 2 0 16 download free.
the values are in 512 sized sectors. So our minimum possible size is (13158272 * 512) 6737035264 bytes. So I can resize the image to that by running the following:
Notice the size has changed, but it didn’t go as low as 4.3GiB (as shown by Total Non-Empty Bytes). The reason for this is because the sparse image is not defragmented. This is discussed in How to reclaim all/most free space from a sparsebundle on OS X.
From here we have two options. If you have access to iDefrag then you can use that to defragment the Sparse Image to reclaim more space, or we can create a smaller Sparse Image and copy the contents manually.
Use iDefrag to Defragment the Sparse Image
Luckily, I had iDefrag :). Mount your Sparse image:
then start up iDefrag and you will see you drive there. Click “Go” and it will start defragmenting:
after it’s done you will the following message:
at this point you can quit iDefrag and unmount the Sparse Image:
Then we can try to compact again and we will see the following:
Checking the new size limits:
we can go to (8862888 * 512) 4537798656 bytes (less than 4.3 GiB). Now for the actual resize:
and here is the new size:
that looks much better.
Copy Contents of Sparse Image into a Smaller Sparse Image
If you don’t have access to iDefrag, you can create a smaller sparse image:
Now we can mount both our images:
Now we can just copy from the first sparse image to the second (smaller) sparse file. First check to make sure the source is smaller than the destination:
asr used to be able to do file-level copies, but now only block level copies/restores are allowed. From the man page:
I prefer rsync over ditto (ditto vs. rsync), so here is what I ran to copy the contents onto the smaller sparse image:
From here we can either convert the Sparse Image back to a DMG or an ISO/CDR. Let’s unmount both:
Convert Sparse Image to DMG
We can use this command to convert our sparse image to a DMG:
Just for reference here are the available formats:
taken from the man page. With bzip2 compression the end file will be even smaller:
Now we can burn the file, by just running:
Convert Sparse Image to ISO
This can be accomplished with hdiutil in multiple ways. The first one is with the following command:
the second way is like this:
both can be burned by using the ‘hdiutil burn’ command or with any burning software.
Mac OS X 10.8 Recovery Options
Since I was on Mac OS 10.8 there are a couple of other options for recovery media.
1. Resize OS X Mountain Lion installer to fit on a 4.7 GB DVD
The 10.8 Installer is downloadable via App Store and even though it’s doesn’t fit on a regular DVD you just have to copy the contents into a smaller image. No deletion of any files is necessary. The instructions on how to accomplish that are here:
From the bottom link (Mac OS X hints), here is a snippet of the code that can accomplishes our goal:
Apple Udif Read Only Compressed Bzip2 Media
2. Mac OS X 10.8 Has a Built-in Recovery Partition
From “OS X Recovery”:
The new Mac safety net.OS X Recovery lets you repair disks or reinstall OS X without the need for a physical install disc. Since OS X Recovery is built into your Mac, it’s always there when you need it. Even if you don’t need it, it’s good to know it’s there. And you don’t have to search through original packaging to find install DVDs to get your Mac back up and running.
Command-R to the rescue.Just hold down Command-R during startup and OS X Recovery springs into action. It lets you choose from common utilities: You can run Disk Utility to check or repair your hard drive, erase your hard drive and reinstall a fresh copy of OS X, or restore your Mac from a Time Machine backup. You can even use Safari to get help from Apple Support online. And if OS X Recovery encounters problems, it will automatically connect to Apple over the Internet.
So I can just reboot the Mac and hold Command-R to get into recovery mode.
3. Use OS X Lion’s Recovery Disk Assistant to create a bootable USB recovery Disk
Starting with OS X Lion, you can create a recovery USB disk to help with recovery. Instructions on how to do that are here:
From “OS X Recovery Disk Assistant v1.0”:
The OS X Recovery Disk Assistant lets you create OS X Recovery on an external drive that has all of the same capabilities as the built-in OS X Recovery: reinstall Lion or Mountain Lion, repair the disk using Disk Utility, restore from a Time Machine backup, or browse the web with Safari.
Well at least I have a cheap bootable OS 10.6 DVD now :)
(Redirected from UDIF)
The icon depicts an internal hard drive within a generic file icon. | |
Filename extension | |
---|---|
Internet media type | application/x-apple-diskimage |
Uniform Type Identifier (UTI) | com.apple.disk-image |
Developed by | Apple Inc. |
Type of format | Disk image |
Apple Disk Image is a disk image format commonly used by the macOS operating system. When opened, an Apple Disk Image is mounted as a volume within the Macintosh Finder.
An Apple Disk Image can be structured according to one of several proprietary disk image formats, including the Universal Disk Image Format (UDIF) from Mac OS X and the New Disk Image Format (NDIF) from Mac OS 9. An Apple disk image file's name usually has '.dmg' as its extension.
Features[edit]
Apple Disk Image files are published with a MIME type of application/x-apple-diskimage.
Different file systems can be contained inside these disk images, and there is also support for creating hybrid optical media images that contain multiple file systems.[1] Some of the file systems supported include Hierarchical File System (HFS), HFS Plus, File Allocation Table (FAT), ISO9660 and Universal Disk Format (UDF).[1][2]
Apple Udif Read Only Media
Apple Disk Images can be created using utilities bundled with Mac OS X, specifically Disk Copy in Mac OS X v10.2 and earlier and Disk Utility in Mac OS X v10.3 and later. These utilities can also use Apple disk image files as images for burning CDs and DVDs. Disk image files may also be managed via the command line interface using the hdiutil utility.[3]
In Mac OS X v10.2.3, Apple introduced Compressed Disk Images[4] and Internet-Enabled Disk Images for use with the Apple utility Disk Copy, which was later integrated into Disk Utility in 10.3. The Disk Copy application had the ability to display a multilingual software license agreement before mounting a disk image. The image will not be mounted unless the user indicates agreement with the license.[5]
An Apple Disk Image allows secure password protection as well as file compression, and hence serves both security and file distribution functions; such a disk image is most commonly used to distribute software over the Internet.
History[edit]
Apple originally created its disk image formats because the resource fork used by Mac applications could not easily be transferred over mixed networks such as those that make up the Internet. Even as the use of resource forks declined with Mac OS X, disk images remained the standard software distribution format. Disk images allow the distributor to control the Finder's presentation of the window, which is commonly used to instruct the user to copy the application to the correct folder.
A previous version of the format, intended only for floppy disk images, is usually referred to as 'Disk Copy 4.2' format, after the version of the Disk Copy utility that was used to handle these images.[1] A similar format that supported compression of floppy disk images is called DART.[1][6]
New Disk Image Format (NDIF) was the previous default disk image format in Mac OS 9,[1] and disk images with this format generally have a .img (not to be confused with raw .img disk image files) or .smi file extension. Files with the .smi extension are actually applications that mount an embedded disk image, thus a 'Self Mounting Image', intended only for Mac OS 9 and earlier.[7][2]
Universal Disk Image Format (UDIF) is the native disk image format for Mac OS X. Disk images in this format typically have a .dmg extension.[1]
File format[edit]
Apple has not released any documentation on the format, but attempts to reverse engineer parts of the format have been successful. The encrypted layer was reverse engineered in an implementation called VileFault (a spoonerism of FileVault).[8]
Apple disk image files are essentially raw disk images (i.e. contain block data) with some added metadata, optionally with one or two layers applied that provide compression and encryption. In hdiutil, these layers are called CUDIFEncoding and CEncryptedEncoding.[1]
UDIF supports ADC (an old proprietary compression format by Apple), zlib, bzip2 (as of Mac OS X v10.4), and LZFSE (as of Mac OS X v10.11)[9] compression internally.
Metadata[edit]
The UDIF metadata is found at the end of the disk image following the data. This trailer can be described using the following C structure.[10] All values are big-endian (PowerPC byte ordering)
The XML plist contains a
blkx
(blocks) key, with information about how the preceding data fork is allocated. The main data is stored in a base64 block, using tables identified by the magic 'mish'
. This 'mish'
structure contains a table about blocks of data and the position and lengths of each 'chunk' (usually only one chunk, but compression will create more).[10] The data and resource fork information is probably inherited from NDIF.Encryption[edit]
The encryption layer comes in two versions. Version 1 has a trailer at the end of the file, while version 2 (default since OS X 10.5) puts it at the beginning. Whether the encryption is a layer outside of or inside of the
blkx
metadata (UDIF) is unclear from reverse engineered documentation, but judging from the vfcrack
demonstration it's probably outside.[8]Utilities[edit]
There are few options available to extract files or mount the proprietary Apple Disk Image format. Some cross-platform conversion utilities are:
- dmg2img was originally written in Perl; however, the Perl version is no longer maintained, and the project was rewritten in C. It extracts the raw disk image from a DMG, without handling the file system inside. UDIF ADC-compressed images (UDCO) have been supported since version 1.5.[11]
- DMGEXtractor is written in Java with GUI, and it supports more advanced features of dmg including AES-128 encrypted images but not UDCO images.[12]
- The Sleuth Kit. Handles the DMG format, HFS+, and APFS.
Most dmg files are unencrypted. Because the dmg metadata is found in the end, a program not understanding dmg files can nevertheless read it as if it was a normal disk image, as long as there is support for the file system inside. Tools with this sort of capacity include:
- Cross-platform: 7-zip (HFS/HFS+), PeaZip (HFS/HFS+).
- Windows: UltraISO, IsoBuster, MacDrive (HFS/HFS+).[13]
- Unix-like: cdrecord and
mount
(e.g.mount -o loop,ro -t hfsplus imagefile.dmg /mnt/mountpoint
).[14][15]
Apple Udif Read-only Compressed Bzip2 Media
Tools with specific dmg support include:
- Windows:
- Transmac can handle both UDIF dmgs and sparsebundles, as well as HFS/HFS+ and APFS. It is unknown whether it handles encryption.[16] It can be used to create bootable macOS installers under Windows.[17]
- A free Apple DMG Disk Image Viewer also exists, but it is unknown how much what it actually supports.[18]
- Unix-like:
- darling-dmg is a FUSE module enabling easy DMG file mounting on Linux. It supports UDIF and HFS/HFS+.[19]
See also[edit]
References[edit]
- ^ abcdefg'hdiutil(1) Mac OS X Manual Page'. Archived from the original on 2016-05-14. Retrieved 2016-05-14.
- ^ ab'Mac OS X: Using Disk Copy disk image files'. Archived from the original on 2013-12-19. Retrieved 2013-04-25.
- ^
hdiutil(1)
– Darwin and macOS General Commands Manual - ^'Re: Some apps refuse to launch in 10.2.8! (OT, but very important)'. Archived from the original on 2014-01-17.
- ^'Guides'. Apple. Archived from the original on 2009-03-06. Retrieved 2010-10-27.
- ^'DART 1.5.3: Version Change History'. Archived from the original on 2013-12-19. Retrieved 2013-04-25.
- ^'Software Downloads: Formats and Common Error Messages'. Archived from the original on 2010-12-24. Retrieved 2009-05-06.
- ^ ab'VileFault'. 2006-12-29. Archived from the original on 2007-01-09. Retrieved 2010-10-27.
- ^Michael Tsai (2015-10-07). 'LZFSE Disk Images in El Capitan'. Archived from the original on 2017-04-09. Retrieved 2017-04-09.
- ^ ab'Demystifying the DMG File Format'. Archived from the original on 2013-03-17.
- ^'dmg2img'. Archived from the original on 29 November 2010. Retrieved 2010-10-27.
- ^'DMGExtractor'. Archived from the original on 2011-01-02. Retrieved 2011-01-03.
- ^MacDrive Features / Boot Camp / System Requirements /. 'MacDrive Home page'. Mediafour. Archived from the original on 4 October 2010. Retrieved 2010-10-27.
- ^'How To Convert DMG To ISO in Windows, Linux & Mac'. Archived from the original on 2010-03-07.
- ^'Convert DMG To ISO using PowerISO'. Archived from the original on 2009-05-02. Retrieved 2009-02-15.
- ^'About TransMac for Windows'. www.acutesystems.com.
- ^'Convert'. www.winytips.com. winytips. Retrieved 5 May 2020.
- ^Olivia Dehaviland (2015-03-03). 'Apple DMG Disk Image Viewer'. DataForensics.org. Archived from the original on 2015-04-02. Retrieved 2015-03-10.
- ^'darling-dmg'. darling-dmg. Retrieved 29 March 2015.
External links[edit]
- Apple Developer Connection A Quick Look at PackageMaker and Installer
- O'Reilly Mac DevCenter Tip 16-5. Create a Disk Image from a Directory in the Terminal
Make Zip File On Mac
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Apple_Disk_Image&oldid=979643441'