Mar 08, 2018 Since Fedora 26 Beta came out a few days ago, I decided it was a great time to throw it on my 13' MacBook Air. This MacBook Air is a model number A1466 EMC 2925 which looks like a 2015ish model, 8gb mem, 2.2GHz i7, 512gb ssd. First thing I did was.
So you’re running Linux on your computer, maybe Ubuntu, and you have some files with the .dmg extension. In this guide, we’re going to talk about how to open, mount, extract, and otherwise get your files from these pesky DMG images. You could always just extract the files on a Mac, then transfer them back to your Linux machine. But if you really want to do this on Linux, without having to rely on Mac, here’s how to do it.
What are DMG image files?
Simply put, it’s a kind of image file. But not an image like a jpeg is an image. DMG is Apple’s proprietary disk image format, native to Mac OS X. There are actually a whole bunch of different types, format and options within this format. There are options for encryption, compression, and different kinds of partition schemes, among others. Unfortunately, this can make things pretty confusing when we’re trying to gain access to the data contained in one of these images.
DMG images are typically a kind of Universal Disk Image Format (UDIF), although there are others, namely NDIF and SPARSE. Although the .dmg file extension is usually used, they can also sometimes have an .img extension, or in some cases no extension at all. Their MIME type is application/x-apple-diskimage.
The HFS/HFS+ (Mac OS Extended/Journaled) file system is typically used in DMGs. However, this isn’t always the case. You may also sometimes find FAT and ExFAT files systems, as well as variations on HFS.
Does my system support DMG?
Perhaps the biggest hurdle to overcome when trying to work with DMG files is working with the HFS file system (Mac OS Extended). Linux supports HFS through the “hfs” and “hfsplus” kernel modules.
There’s an easy way to test if your system has these kernel modules. Plug in a USB drive formatted with the Mac OS Extended file system. If your particular distribution doesn’t have the appropriate modules, you will likely get an error message. On Ubuntu, you’ll get a popup window declaring “Ubuntu: Unable to mount
Alternatively, we can see if the kernel module files are present with find:
We want to see two files: “hfs.ko” and “hfsplus.ko”. If find doesn’t return these files, your system probably doesn’t support HFS.
You could also try “modinfo”: modinfo hfs
and modinfo hfsplus
should return something like:
If you get 'modinfo: ERROR: Module hfsplus not found
' your system doesn’t have these modules.
Not all Linux kernels and distributions support HFS. This is especially the case for certain distributions that are a few years old. If you have kernel support for HFS, great! If not, don’t worry. There are still ways to extract data from your DMG files. While it’s nice to have the option to mount the images we’re working with, this is really the only functionality we’re losing without having the hfs and hfsplus modules. The two programs we’re going to use later on (P7ZIP and dmg2img) do not require kernel support to function.
What kinds of DMG images can be opened in Linux?
This guide is about how to open, mount, and extract files from read/write, read only, and compressed DMG image files. The following partition schemes have all been tested with the techniques discussed here.
- Apple Partition Map
- CD/DVD (partitioned)
- CD/DVD (partitioned) with ISO data
- Hard disk
- Master Boot Record Partition Map
- No partition map
This guide does not cover how to handle sparse disk images (.sparseimage), sparse bundle disk images (.sparsebundle), or CD/DVD masters. DMG images with partition scheme types of “CD/DVD” and “GUID Partition Map” do not appear to work with the techniques described here.
Option 1: Mount the DMG
If the Linux distribution you’re on has HFS support in the kernel (Ubuntu 14.04.1 LTS supports it), it’s pretty easy to just mount the DMG image:
We’re using “sudo” because we need root privileges to mount things. The HFS+ file system type is specified with “-t hfsplus”. The “/mnt” at the end of the command specifies where we’re mounting the image.
Unmount the image with sudo umount /mnt
If you get a wrong fs type message like the one below, it means the DMG file is either of an unsupported type, or it’s compressed. Unsupported images include sparse images, sparse disk bundles, CD/DVD masters, and images with partition schemes of the CD/DVD or GUID Partition Map types.
How To Install Dmg File On Fedora Windows 10
Use “file” to learn a little more about the image file:
How To Install Dmg Files
If you get image.dmg: x86boot sector
that means it’s probably using a GUID Partition Map and isn’t supported. This isn’t good, however, it’s also not too terribly common.
What’s more common is to see something like this:
If mounting isn’t working, and this is what you’re seeing with “file image.dmg”, then you’re luck!. Our problems are being caused by compression. Linux doesn’t like to mount compressed DMG images. To get around this little obstacle, we’ll use dmg2img (see below).
Option 2: Use dmg2img for compressed images
So you have a DMG image that you can’t mount because it’s compressed. You’ve done “file compressed_image.dmg” and you got “compressed_image.dmg: bzip2 compressed data”. The fix? That’s easy: use dmg2img to convert it to an uncompressed image. Once you run the image through dmg2img you should be able to mount it no problem.
Don’t have dmg2img? It’s usually pretty easy to get using your distribution’s package management. On Ubuntu, you’d do:
Using dmg2img isn’t very difficult. Type “dmg2img” into the command line followed by the name of the DMG file you want to decompress. The Mac OS X version of Firefox is a good example of a compressed DMG file.
Now mount the resulting .img file:
Option 3: Extract DMG contents with P7ZIP
P7ZIP is awesome. It’s the Linux/BSD version of 7-Zip. Check out their SourceForge page here With it you can literally extract files from any kind of image or archive. Just kidding… It doesn’t really work with every format conceivable. However, it can handle (in alphabetical order): ARJ, CAB, CHM, CPIO, CramFS, DEB, DMG, FAT, HFS, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, RAR, RPM, SquashFS, UDF, VHD, WIM, XAR and Z. Impressed? I certainly am!
Installing p7zip is pretty easy using your distribution’s package management system. On Ubuntu with apt-get:
In addition to being able to extract data from compressed and uncompressed images alike, P7ZIP doesn’t require the HFS kernel modules at all. In the example below, we’re going to extract all of the files from “Firefox 33.1.1.dmg”. When we’re done, we’ll have a tidy little folder called “Firefox”.
Invoke P7ZIP to extract archives and images with “7z x”.
Notice that 7z extracted three files: “0.ddm”, “1.Apple_partition_map”, and “2.hfs”. To actually get to the files, we’ll need to run 7z again on “2.hfs”.
We picked “2.hfs” because it was the biggest of the three, meaning it was probably the one with the data. Simple but effective logic. After a few moments, you should have a folder called “Firefox” with all of the files from the original DMG.
If you are an avid Mac user using a Windows PC, and suddenly find a DMG file in your windows system, you would definitely want to open it up to see what it contains. Though the installation files or compressed files it contains will not be compatible with your windows PC, yet there are some ways you can check out what it withholds. But before proceeding with the ways to open or view a DMG file, it is better if we have a thorough knowledge of what a DMG file exactly is. DMG files are actually Mac OS disk image files. It is very similar to ISO files in windows, or rather a counterpart of ISO files.
The images usually comprise installation files of softwares and operating systems and sometimes, compressed files. Since you are using a windows PC, surely you won't be able to run it on your Window OS, but at least there are ways by which you can have a look at its contents. And that is what we are going to discuss in this article - ways to view the DMG files on Windows 10/7/8.
Way #1: Open DMG Files on Windows with 7-ZIP
7-ZIP is a lightweight freeware which is easily available on the internet market. It not only extracts DMG files but all other of compressed files, such as ZIP, CAB, ISO, RAR, WIM, etc. But we would restrict our discussion here only upto DMG. Read the steps below to know the tool's usage:
Step 1. Download the 7-ZIP program file in any of your working computer and install it.
Step 2. After installation is done, locate the DMG file that you wish to open or view in your directory or desktop, and right-click on it.
Step 3. From the context menu, click on '7-ZIP' which will not appear as a part of your system since installed.
Step 4. From the next sub-menu that follows click on 'Open archive' and your DMG file will be opened and you can view the contents inside.
Cons:
- You cannot view or extract files bigger than 4 GB.
- You cannot view or extract encrypted files.
- You are only allowed to extract 5 DMG files at a time.
Way #2: Open DMG Files with DMG Extractor
DMG Extractor is another professional tool to open and extract .dmg files without first converting them into .iso or .img files. It's interface is very user-friendly and even a beginner can use it without any difficulty. Just go through the steps below to pull off the task:
Step 1. First of all, download the DMG extractor program file from the internet and install it in your personal Windows PC.
Step 2. Run the application with admin rights and in the main UI of the tool's screen, click on 'open' button in the upper menu bar to browse the required DMG file. The file will be loaded into the software's screen.
Step 3. After the file is loaded, you will be displayed all the contents contained within the DMG file.
Cons:
- You cannot view or extract files bigger than 4 GB.
- You cannot view or extract encrypted files.
- You are only allowed to extract 5 DMG files at a time.
Way #3: View DMG files on Windows with PowerISO
PowerISO is yet another very powerful professional tool which can open, burn, extract, create, edit, convert, any kind of disk image files. It can process every kind of image files, be it BIN, DMG, ISO, DAA, etc. Here we would burn the image file into a CD/DVD or USB and then will open it from the disk storage to check out what it contains. But before you head on the tool's usage, better have a look at its specifications to use it in a better way.
Step 1. Get the program file downloaded from the official website and install it in your Windows computer.
Step 2. Launch the utility with admin privileges and then insert a empty Disk (CD/DVD or USB) in your computer.
Step 3. Click on 'Tools' button from the menu bar and then click on 'Burn' option from the drop-down menu.
Step 4. Now the 'DMG Burner' option will be shown in the PowerISO Window's screen.
Step 5. Click on 'Browse' button to fetch the required DMG files from your computer's directory.
Step 6. Select the burning speed from the dialog box and then finally click on 'Burn' button to start the burning process.
Step 7. Once the image is burnt in your disk, open the disk from 'My computer' and click on the DMG file to view what it contains.
How To Install Dmg File On Fedora Windows
Conclusion:
After going through all the methods mentioned above, you must have realized by now that the first two tools implemented have got several demerits and thus can be not relied upon fully. So in order to have all the facilities with disk images, better stick to way 3 for a guarantee result.