How to split DMG into segments
Posted on 17th October 2007 in Mac OS |
Uploading a disk image may in some cases be quite troublesome, e.g. uploading to .Mac simply because you can’t resume the upload if it fails. A way around would be to upload in segments.
There are number of tools that can split your image (DMG, CDR, etc.) into pieces. Some of them work, some don’t but the most bulletproof way is to do it in the Terminal (Applications > Utilities > Terminal).
There’s a tool on a Mac that does pretty much everything concerning the disks. It’s called hdiutil. It can attach, detach (eject), verify, mount, unmount and segment a volume to name a few. To use this tool you have just got to type in a command. For a start you may want to get a view on hdiutil’s features by typing hdiutil help. Hit Enter to execute a command.
To segment an image, let’s say DMG you could use a command:
hdiutil segment -o mydvd -segmentSize 100M /Users/[your Mac username]/Desktop/dvdimage.dmg
That command would create segments (mydvd.002.dmgpart, mydvd.003.dmgpart, etc.) in your Home folder of an image named dvdimage.dmg on your desktop.
‘-o mydvd’ stands for the prefix that is used to name the segments. Segment size would be 100MB as defined by the segmentSize parameter. If you’d want the segment size to be 500KB you could just use 500k instead of 100M. Alternatively you could also split your image by the number of segments. In that case you should replace ‘-segmentSize 100M’ with ‘-segmentCount 5′ for example. That would split your image into 5 segments.
A good thing about it is that you don’t even have to rejoin these segments later. You can just click the first segment (in above example it would be mydvd.dmg) so Mac will verify the image and attach the DMG as it usually does. Or use Disk Utility (Applications > Utilities > Disk Utility) to burn it by using the first segment as well.

7 Responses
I’ve tried to type “hdiutil help” and gotten a long details of “hdiutil” methods. This is wonderful. How can you find out this things? It’s amazing. ^-^
By the way, do you know how to use “hdiutil chpass”?
It does not directly answer your question but if you’d like to password-protect your image with hdiutil you may want to try 2 additional options which are
-encryptionand-stdinpass.The latter will read the password from standard input so you’ll be asked for it.
-encryptionis required to force the encryption (defaults to CEncryptedEncoding that utilizes the AES cipher with a 128 bit key).So for the above sample the command would be
hdiutil segment -o mydvd -segmentSize 100M -encryption -stdinpass /Users/[your Mac username]/Desktop/dvdimage.dmgusing -segmentCount will save some of the more OCD people some internal struggle, splitting a disk image into num equally-sized segments.
You can get a more detailed description by typing the following in Terminal
man hdiutil
This does not work, I get the following message:
hdiutil: segment: format UDRW not recognized
hdiutil: segment failed - Operation not supported
So wtf is wrong?
Try converting your read/write UDRW image to read-only UDCO with
-format UDCOthnx for the help man, now i know that the terminal is way better and stable then other shitty apps, thnx alot for the help ^^