New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

OS 10.5 - Mounted Disk Image is significantly smaller than .dmg


Post Reply New Thread Subscribe

 
Thread Tools
jmullenberg

 
Member Since: Apr 27, 2008
Posts: 92
jmullenberg will become famous soon enough
Mac Specs: MBP 2.5 Intel Core 2 Duo, 2GB 667 MHz DDR2, 17" Hi-Res Display ; iPhone 3G 2.1

jmullenberg is offline
I am working on an applescript which includes creating a disk image and copying a folder to it. My script calculates the size the disk image needs to be to fit all the files on it, and then sends a shell command to create and mount the disk image. The problem is that the once the disk image is mounted the capacity is significantly less than the corresponding .dmg file.

(example: mydiskimage.dmg = 10.04 GB, but when mounted it only has a capacity of 9.72 GB, where is the missing 328 MB?)

So my question is where is the missing disk space, and is there a way to calculate how much that is going to be so I can include it when I'm creating the .dmg file?

Here is the applescript command I'm using to create the disk image:

do shell script "hdiutil create -size 10278.1640625m -fs HFS+ -volname \"Converted Clips\" converted_clips.dmg"

"Sure, I could compare PCs to Macs. But I make it a point to never argue about religion."
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,092
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
You can pass the -srcfolder option, which will create an image that contains the folder and calculates the required size for you. This will help you to avoid having to calculate a size. So, for instance, the following should create an image for you with you not having to worry about passing a size:
Code:
hdiutil create -srcfolder <folder> -volname "Converted Clips" converted_clips.dmg
(Replace <folder> with the name of the folder). You also don't need to pass the -fs parameter as it is redundant (the image will take the fs of the folder).

From the hdituil man page for the -srcfolder parameter: "Derive the image size from the the filesystem entity source and copy the contents of source to the resulting image. The filesystem type of the image volume will match that of the source as closely as possible unless overridden with -fs. Other size specifiers, such as -size, will override the default (size of the source directory plus some padding for filesystem overhead), allowing for more or less free space in the resulting filesystem. -srcfolder copies file by file, creating a fresh (theoretically defragmented) filesystem on the destination image." (important parts bolded).

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks
jmullenberg

 
Member Since: Apr 27, 2008
Posts: 92
jmullenberg will become famous soon enough
Mac Specs: MBP 2.5 Intel Core 2 Duo, 2GB 667 MHz DDR2, 17" Hi-Res Display ; iPhone 3G 2.1

jmullenberg is offline
Thanks for the reply, however, when working with large files it can take a long time to create the image and copy the files, and there is no status displayed.

With the previous method, i can create a log file to periodically check the size of the image while its being created, then mount the image, and copy the files, again periodically logging the available space left on the image. (all while displaying the log on my desktop with geektool)

With the method you provided, i can still log the creation of the image, but not the copying of the files, because I don't think there is a way to get the available space of an image without mounting it.

-- update --

I do think i have it working just by adding about 5% to the size of the image, however it is kind of a waste of disk space.

"Sure, I could compare PCs to Macs. But I make it a point to never argue about religion."
QUOTE Thanks

Post Reply New Thread Subscribe


« Confusion with OS and upgrade ability. | OS Installer Issue... »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Unable to create disk image: error code -61 pcarter263 Other Hardware and Peripherals 3 03-14-2009 05:55 PM
Safari and Facebook Problems MrTissues OS X - Apps and Games 7 02-26-2009 05:01 PM
Install windows from ISO disk image ebeccarayray Running Windows (or anything else) on your Mac 2 01-15-2009 01:58 AM
disk image issue rianm7 Switcher Hangout 3 02-10-2008 07:59 PM
Starting Computer Off Disk Image Basket_Case_24 OS X - Operating System 0 04-29-2005 03:20 PM

All times are GMT -4. The time now is 04:06 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?