10.5: Set up Time Machine on a NAS in three easy steps

Here's a three-step process to create a Time Machine backup on a network-attached storage (NAS) unit.Create a sparsebundle image on your local system. I'm not sure of the reason why, but I haven't been able to kick Time Machine off just by specifying a network share. It "prepares" for a while, then says it was unable to create the disk image. The solution appears to be to create a sparsebundle image locally. Thankfully, you don't need multiple Macs like another post suggested; you can accomplish this using hdiutil like so:hdiutil create -library SPUD -size $SIZESPEC -fs Journaled HFS+ -type SPARSEBUNDLE -volname $MACHINENAME_$MAC_ADDR​ESS.sparsebundleWhere...

published on Friday, the 25. April 2008, macosxhints

Erase free disk space from the command line

It is possible to use Disk Utility to erase the free space on a disk. However, I had difficulty finding a command, such as hdiutil, to do it from the command line. One advantage of doing it from the command line is that it is easier to use cron or launchd to automate the process. It turns out the solution is relatively straightforward: cat /dev/zero > /private/tmp/junk; rm /private/tmp/junk The first part of the command will keep enlarging a file with zeros until disk space runs out. After an error, the second part will delete the empty file. Lather, rinse, repeat for extra security (7-pass, 35-pass Guttman). [robg adds: I haven't tested this one...however, I'd be somewhat cautious about using it on your boot drive. Running out of space on the boot drive -- even briefly -- may cause issues. If you know more about that possibility than I do, please comment!]

published on Thursday, the 24. April 2008, macosxhints

10.5: Time machine, corrupt sparse images, and panics

This took me a long time to figure out. There are some tips here and elsewhere providing fixes for FileVault problems caused by sparse image corruption. I discovered today that similar problems on Time Machine sparse image files were causing reproducible kernel panics (KPs) on remote Macs backing up to these sparse image files via a server Mac. The problem is that there's very little indication to lead one to that conclusion. I was getting predictable KPs as soon as Time Machine backups would begin, and none of the disks involved (remote computer, server computer, attached USB Time Machine disk) showed any problem at all with Disk Utility or DiskWarrior.The solution was to log in as root on the server computer, and then use the following command to attach (but not mount -- this is key!) the image:hdiutil mount -nom...

published on Monday, the 10. March 2008, macosxhints

Mount VirtualPC 6 disk images via Terminal

To mount a Virtual PC 6 disk image from the command line, cd to the disk package directory in Terminal, and enter the following command: hdiutil attach -readonly -imagekey \ diskimage-class=CRawDisk​Image BaseDrive.vhd (An easy way to change to the package directory is to type in cd, press the Space Bar, and then drag the VPC disk image icon onto the terminal window.) It will take a long time for hdiutil to locate the MS-DOS partition, but it will eventually find it and mount it.

published on Wednesday, the 21. November 2007, macosxhints

Mount VirtualPC 6 disk images via Terminal

To mount a Virtual PC 6 disk image from the command line, cd to the disk package directory in Terminal, and enter the following command: hdiutil attach -readonly -imagekey \ diskimage-class=CRawDisk​Image BaseDrive.vhd (An easy way to change to the package directory is to type in cd, press the Space Bar, and then drag the VPC disk image icon onto the terminal window.) It will take a long time for hdiutil to locate the MS-DOS partition, but it will eventually find it and mount it.

published on Wednesday, the 21. November 2007, macosxhints

Burn a playable DVD from a VIDEO_TS folder

After searching the forums and trying various things, I still couldn't find a quick, reliable, free method of burning a VIDEO_TS folder to a pure UDF DVD, so that it would play in regular DVD players, as well trigger DVD Player to start up automatically. Anyway, as often is the case, Terminal had the answers. Just type in this command and change the paths to suit:hdiutil makehybrid -udf -udf-volume-name DVD_NAME \-o MY_DVD.iso /path/to/VIDEO_TS/parent/folde​rMake sure that /path/to/VIDEO_TS/parent/folde​r is the path to the folder containing the VIDEO_TS folder, not the VIDEO_TS folder itself. Once the .iso file has been created, drag this to Disk Utility and hit the Burn button.

published on Thursday, the 14. June 2007, macosxhints

Store Developer docs on a compressed disk image

I just got done re-installing OS-X (an old Microsoft habit, I guess), and was installing XCode when I realized that almost half of the installation size of XCode is the documentation. I need that documentation, but hate to see 1.3 Gb of my hard drive gobbled up by something that is:Very compressibleNot demanding on resourcesOnly rarely usedSo I hatched the hare-brained idea to compress it -- and it worked! I've cleaned up the code, so fire up Terminal and do this: $ cd /Developer $ sudo hdiutil create -srcfolder "ADC Reference Library" -format UDBZ DevLibrary.dmgThat will build the compressed reference library in the Developer folder. Once you are done, delete the "old" reference folder, and make an empty placeholder for later: $ sudo rm -rf "ADC Reference Library" $ mkdir "ADC Reference Library" Note: I didn't sudo the mkdir command on purpose, to keep the follow...

published on Thursday, the 3. May 2007, macosxhints

10.4: Compact sparse disk images via contextual menu

The following Automator workflow will simplify compacting a sparse disk image. You need to occasionally compact sparse disk images, because while they will grow automatically as you add files, they won't shrink when you delete files. Open Automator in Applications Folder, and create this workflow: Finder Library » Get Specified Finder Items Action Finder Library » Filter Finder Items, and select Name Extension is equal to sparseimage. Automator Library » Run Shell Script and select Pass input as arguments and replace the sample script with hdiutil compact $@. Save as Plugin for Finder (name it Compact Sparse Disk Image). In the Finder, select a sparse disk image and ctrl-click, go to the Automator entry, and select Compact Sparse Disk Image. That's it!

published on Thursday, the 29. March 2007, macosxhints

When a 'corrupt' disk image file really isn't corrupt

I recently ran into a problem trying to open a downloaded .dmg (disk image) file: I kept getting a corrupt dmg file message when trying to open it. I downloaded it from several other locations, but the file still refused to open. I checked with a friend of mine on another Mac OS X system, and he downloaded and opened the dmg file with no problem. We compared md5sums of the file, and they were identical.When I tried dragging the file into Disk Utility's left section, and then doing a verify on the dmg file, I'd get a Verify volume failed with error Invalid request (-9998) message. If I did a hdutil attach filename.dmg, it would give the following error:Initializing...Verifying​......[trimmed]...Veri​fication completed...calculated CRC32 $ABCDEF12, expected CRC32 $00000000Finishing...hdiut​il: attach failed - corrupt imageNote the expected CRC32 checksum was zero (the calculated value was an eight-digit hex, rep...

published on Tuesday, the 12. December 2006, macosxhints

CreaDMG 1.7

CreaDMG is a tool for creating disk images with an easy GUI. You choose a source (file or dir or volume), a destination archive file name and format, the name of the virtual disk and then you can also compress the resulting image with zip/gzip/tar and protect it with a password. This script is a frontend for the shell tool 'hdiutil'. Source code is available at my web site, check the 'About' window.

published on Sunday, the 25. June 2006, scriptbuilders