From DMG to normal hard drive partition - without copying?

Discussion in 'macOS' started by jas870, Jan 4, 2014.

  1. jas870, Jan 4, 2014
    Last edited: Jan 4, 2014

    jas870 macrumors newbie

    Feb 6, 2009
    Summary - I have a 1.85TB DMG that is uncompressed and unencrypted. I'd like to essentially remove the DMG wrapper and make the contents accessible as files and folders on the same disk -- but without copying the content out of the mounted DMG and onto the same disk.

    Details - My 1.85TB media drive (the entire drive is 2TB, but a small part is partitioned for Time Machine backups -- I'm not concerned with that partition) started showing signs of impending failure after I returned home after the holidays (I guess it didn't like traveling). The drive wasn't backed up, because the data isn't important enough to warrant the extra time/expense/hassle involved. If I lose it all the world won't end, but I'm still willing to put in some work to save as much as possible.

    I'm currently using ddrescue to create a DMG of the failing drive on a new 3TB external drive that I purchased as a replacement last night. Thus far it's about 200GB in, without any errors. Fingers crossed! I'm assuming for purposes of this question that the final DMG won't have any errors -- if it does, that'll change things, of course.

    When ddrescue has finished creating the DMG, I'll have a 1.85TB DMG on a 3TB drive. That 3TB drive will become my new media drive, so I'll need all of the files be stored in the DMG accessible as individual files/folders.

    I know I can mount the DMG and copy the files from the image to the new media drive. But, I figure that'll be especially slow, since it'll be copying from and to the same physical hard drive. Also, I'll end up with about 700GB of data that I can't fit on the new media drive until I've erased the DMG. I don't have enough hard drive space available to temporarily put all 1.85TBs on a third drive (if I did I'd be using three HDDs in this process, and wouldn't have to ask this question). Although I could probably stash the extra 700GB onto separate drives temporarily, before deleting the 1.85TB DMG, thus freeing up room to copy the 700GB back to the new media drive. Still, that would be slow and a hassle as well.

    So, what I'd --really-- like to do is just convert the DMG into its component files and folders automatically and without copying -- simply by changing the way the OS refers to the content. I know that wouldn't work if the DMG were compressed or encrypted, but so far as I'm aware ddrescue is outputting a 1:1 copy of the original disk, so it should -- at least in theory -- be possible to make the change.

    That said, I haven't been able to find any info on doing such a thing with the usual forum and Google searches, so I suspect it's not possible. But I didn't find anything saying it can't be done either, so I figured I'd ask the experts.

    Many thanks for the help!

    EDIT: Forgot to mention - this is being done on an Early 2009 Mac Mini running Snow Leopard 10.8.5. Both external drives are USB 2.0.
  2. Parsec macrumors member

    Aug 24, 2007
    N53 E004
    I don't see how what you want can be done. You probably have no other option than to copy everything onto the drive chuck by chunk. Once you copy 700 Gb, you can delete those files from the DMG. Once you then close the DMG, it should shrink accordingly. Then you can do the next chunk. You don't have to sit there and wait for it to complete, just let it run during the day when you don't use it or overnight. That's usually what I do with large time-consuming operations that can run unmonitored.
  3. jas870 thread starter macrumors newbie

    Feb 6, 2009
    Thanks for the reply, Parsec ... I'd guessed that my "crazy scheme" wouldn't work, and appreciate the confirmation.

    I did not, however, realize that I could delete files from the DMG and that it would then shrink accordingly when closed/reopened. That'll definitely save me some time and hassle ... thanks!
  4. jas870 thread starter macrumors newbie

    Feb 6, 2009
    well, crap ... i might have broken it ...

    the DMG finally finished copying last night (with no errors ... phew). this morning i copied some files off the DMG and onto the new media drive (both on the same physical hard drive), until the new media drive was nearly full.

    then i tried to delete files from the DMG and resize it (smaller), and that's where i ran into trouble. it didn't happen automatically, and after some further google reading it appears that's not an automatic process. no problem ... i tried using disk utility first, and then terminal (using hdiutil) to resize, which i found directions to do. both methods would allow me to make the DMG larger, but not smaller.

    so, then i tried partitioning the DMG (not the volume it contains), based on a suggestion i found online. this was the stupid error on my part (although it didn't seem so at the time). my hope (and what the instructions suggested) was if i made one DMG partition slightly larger than the volume contained in the DMG, it would go onto that partition, and then i could delete the smaller partition. i checked, and the dialog in disk utility said that partitions would be resized, but no data would be erased. still, in hindsight, i feel like an idiot for thinking that would work.

    instead, i ended up with two new partitions, neither of which is or contains the volume that the DMG originally contained. all the stuff i spent days copying off the failing media drive is now completely inaccessible.

    is there any way to undo this? or am i going to have to copy everything off that failing media drive again, hoping that it doesn't die on me sometime during that process?

    sigh ... what a frustrating mess ... thanks for any help getting me out of it!

Share This Page