| OS X - Operating System General OS operation information and support |
| Post Reply | New Thread | Subscribe |
|
|
Thread Tools |
![]() Member Since: Apr 27, 2008
Posts: 92
![]() Mac Specs: MBP 2.5 Intel Core 2 Duo, 2GB 667 MHz DDR2, 17" Hi-Res Display ; iPhone 3G 2.1
|
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 | |
![]() Member Since: Oct 19, 2008
Location: Ottawa
Posts: 15,283
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2012 13" MBP (2.5 i5, 8GB)
|
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 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 :: M-F IRC Channel - Chats every Sunday at 8PM EST. Last edited by vansmith; 06-30-2009 at 01:38 PM. |
| QUOTE Thanks | |
![]() Member Since: Apr 27, 2008
Posts: 92
![]() Mac Specs: MBP 2.5 Intel Core 2 Duo, 2GB 667 MHz DDR2, 17" Hi-Res Display ; iPhone 3G 2.1
|
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 |
| Thread Tools | |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|
|||||||
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 01:36 AM.
Powered by vBulletin